Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1511#discussion_r78644423
  
    --- Diff: server/test/org/apache/cloudstack/network/lb/CertServiceTest.java 
---
    @@ -125,48 +125,48 @@ public void runUploadSslCertWithCAChain() throws 
Exception {
             
when(certService._accountDao.findByIdIncludingRemoved(anyLong())).thenReturn((AccountVO)account);
     
             //creating the command
    -        UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
    -        Class<?> _class = uploadCmd.getClass().getSuperclass();
    +        final UploadSslCertCmd uploadCmd = new UploadSslCertCmdExtn();
    +        final Class<?> klazz = uploadCmd.getClass().getSuperclass();
     
    -        Field certField = _class.getDeclaredField("cert");
    +        final Field certField = klazz.getDeclaredField("cert");
             certField.setAccessible(true);
             certField.set(uploadCmd, cert);
     
    -        Field keyField = _class.getDeclaredField("key");
    +        final Field keyField = klazz.getDeclaredField("key");
             keyField.setAccessible(true);
             keyField.set(uploadCmd, key);
     
    -        Field chainField = _class.getDeclaredField("chain");
    +        final Field chainField = klazz.getDeclaredField("chain");
             chainField.setAccessible(true);
             chainField.set(uploadCmd, chain);
     
             certService.uploadSslCert(uploadCmd);
         }
     
    -    @Test
    +    //    @Test
         /**
          * Given a Self-signed Certificate with encrypted key, upload should 
succeed
          */
         public void runUploadSslCertSelfSignedWithPassword() throws Exception {
     
    -        TransactionLegacy txn = 
TransactionLegacy.open("runUploadSslCertSelfSignedWithPassword");
    +        TransactionLegacy.open("runUploadSslCertSelfSignedWithPassword");
     
    -        String certFile = 
URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed_with_pwd.crt").getFile(),Charset.defaultCharset().name());
    -        String keyFile = 
URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed_with_pwd.key").getFile(),Charset.defaultCharset().name());
    -        String password = "test";
    +        final String certFile = 
URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed_with_pwd.crt").getFile(),Charset.defaultCharset().name());
    +        final String keyFile = 
URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed_with_pwd.key").getFile(),Charset.defaultCharset().name());
    --- End diff --
    
    From the best I can see, this code is finding the resource's URL, changing 
to a `File` instance, and decoding it to a `String` only to turn around and 
turn it back into a `File` on lines 158-159.  Please consider simplifying as 
follows:
    
    ```
            final File certFile = 
getClass().getResource("/certs/rsa_self_signed_with_pwd.crt").getFile();
            final File keyFile = 
getClass().getResource("/certs/rsa_self_signed_with_pwd.key").getFile());
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to