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

    https://github.com/apache/cloudstack/pull/1511#discussion_r78644594
  
    --- 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());
    +        final String password = "test";
     
    -        String cert = readFileToString(new File(certFile));
    -        String key = readFileToString(new File(keyFile));
    +        final String cert = readFileToString(new File(certFile));
    +        final String key = readFileToString(new File(keyFile));
    --- End diff --
    
    Lines 154-155 and 158-159 are a repeating group.  Please consider 
extracting to a utility method with proper unit tests.


---
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