diff options
author | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2017-11-17 12:08:32 +0100 |
---|---|---|
committer | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2017-11-17 12:08:32 +0100 |
commit | f73e0b1ff4282aca2e7cb186be7acb12d3ed446b (patch) | |
tree | 757f2aeba530f8bc45245c50c2e685f83c6360ec /src/test/java | |
parent | 98344de96ed80b839929be0bd272753675009a5d (diff) |
Fix for Checkstyle
Fix the checkstyle issues reported by the tool
Change-Id: Ia330dcf6eead508b0c250d85617ea599c3ce42aa
Issue-ID: CLAMP-74
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'src/test/java')
5 files changed, 40 insertions, 41 deletions
diff --git a/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java b/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java index 5f73ac161..999822c26 100644 --- a/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java +++ b/src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java @@ -30,15 +30,20 @@ import org.junit.Test; import org.onap.clamp.clds.service.CldsUser; public class CldsUserJsonDecoderTest { - private String user1 = "admin1"; - private String user2 = "admin2"; - private String password = "5f4dcc3b5aa765d61d8327deb882cf99"; - private String[] normalPermissionsArray = { "permission-type-cl|dev|read", "permission-type-cl|dev|update", - "permission-type-cl-manage|dev|*", "permission-type-filter-vf|dev|*", "permission-type-template|dev|read", - "permission-type-template|dev|update" }; - private String[] incompletePermissionsArray = { "permission-type-cl|dev|*", "permission-type-cl|dev|*", - "permission-type-cl-manage|dev|*", "permission-type-filter-vf|dev|*", "permission-type-template|dev|read", - "permission-type-template|dev|update" }; + + private String user1 = "admin1"; + private String user2 = "admin2"; + private String password = "5f4dcc3b5aa765d61d8327deb882cf99"; + private String[] normalPermissionsArray = { + "permission-type-cl|dev|read", "permission-type-cl|dev|update", "permission-type-cl-manage|dev|*", + "permission-type-filter-vf|dev|*", "permission-type-template|dev|read", + "permission-type-template|dev|update" + }; + private String[] incompletePermissionsArray = { + "permission-type-cl|dev|*", "permission-type-cl|dev|*", "permission-type-cl-manage|dev|*", + "permission-type-filter-vf|dev|*", "permission-type-template|dev|read", + "permission-type-template|dev|update" + }; @Test public void testDecodingDoubleUsers() { diff --git a/src/test/java/org/onap/clamp/clds/it/CldsDaoItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsDaoItCase.java index 78b240134..6373e1531 100644 --- a/src/test/java/org/onap/clamp/clds/it/CldsDaoItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/CldsDaoItCase.java @@ -75,7 +75,6 @@ public class CldsDaoItCase extends AbstractItCase { @Test public void testModelSave() throws IOException { String randomNameTemplate = RandomStringUtils.randomAlphanumeric(5); - String randomNameModel = RandomStringUtils.randomAlphanumeric(5); // Add the template first CldsTemplate newTemplate = new CldsTemplate(); newTemplate.setName(randomNameTemplate); @@ -89,6 +88,7 @@ public class CldsDaoItCase extends AbstractItCase { assertEquals(imageText, newTemplateRead.getImageText()); // Save the model CldsModel newModel = new CldsModel(); + String randomNameModel = RandomStringUtils.randomAlphanumeric(5); newModel.setName(randomNameModel); newModel.setBpmnText(bpmnText); newModel.setImageText(imageText); diff --git a/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java index f6e9abddf..0193613a6 100644 --- a/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java @@ -63,7 +63,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @TestPropertySource(locations = "classpath:application-no-camunda.properties") public class CldsServiceItCase extends AbstractItCase { @Autowired - CldsService cldsService; + CldsService cldsService; private String bpmnText; private String imageText; private String bpmnPropText; @@ -100,9 +100,9 @@ public class CldsServiceItCase extends AbstractItCase { @Test public void testCldsInfoAuthorized() throws Exception { SecurityContext securityContext = Mockito.mock(SecurityContext.class); - Principal p = Mockito.mock(Principal.class); - Mockito.when(p.getName()).thenReturn("admin"); - Mockito.when(securityContext.getUserPrincipal()).thenReturn(p); + Principal principal = Mockito.mock(Principal.class); + Mockito.when(principal.getName()).thenReturn("admin"); + Mockito.when(securityContext.getUserPrincipal()).thenReturn(principal); Mockito.when(securityContext.isUserInRole("permission-type-cl|dev|read")).thenReturn(true); Mockito.when(securityContext.isUserInRole("permission-type-cl|dev|update")).thenReturn(true); Mockito.when(securityContext.isUserInRole("permission-type-template|dev|read")).thenReturn(true); @@ -132,12 +132,10 @@ public class CldsServiceItCase extends AbstractItCase { @Test public void testPutModel() throws Exception { - String randomNameTemplate = RandomStringUtils.randomAlphanumeric(5); - String randomNameModel = RandomStringUtils.randomAlphanumeric(5); SecurityContext securityContext = Mockito.mock(SecurityContext.class); - Principal p = Mockito.mock(Principal.class); - Mockito.when(p.getName()).thenReturn("admin"); - Mockito.when(securityContext.getUserPrincipal()).thenReturn(p); + Principal principal = Mockito.mock(Principal.class); + Mockito.when(principal.getName()).thenReturn("admin"); + Mockito.when(securityContext.getUserPrincipal()).thenReturn(principal); Mockito.when(securityContext.isUserInRole("permission-type-cl|dev|read")).thenReturn(true); Mockito.when(securityContext.isUserInRole("permission-type-cl|dev|update")).thenReturn(true); Mockito.when(securityContext.isUserInRole("permission-type-template|dev|read")).thenReturn(true); @@ -145,6 +143,7 @@ public class CldsServiceItCase extends AbstractItCase { cldsService.setSecurityContext(securityContext); // Add the template first CldsTemplate newTemplate = new CldsTemplate(); + String randomNameTemplate = RandomStringUtils.randomAlphanumeric(5); newTemplate.setName(randomNameTemplate); newTemplate.setBpmnText(bpmnText); newTemplate.setImageText(imageText); @@ -166,6 +165,7 @@ public class CldsServiceItCase extends AbstractItCase { newModel.setDocText(newTemplate.getPropText()); newModel.setDocId(newTemplate.getPropId()); // Test the PutModel method + String randomNameModel = RandomStringUtils.randomAlphanumeric(5); cldsService.putModel(randomNameModel, newModel); // Verify whether it has been added properly or not assertNotNull(cldsDao.getModel(randomNameModel)); diff --git a/src/test/java/org/onap/clamp/clds/it/DcaeHttpConnectionManagerItCase.java b/src/test/java/org/onap/clamp/clds/it/DcaeHttpConnectionManagerItCase.java index cf9fa4e29..56de81d46 100644 --- a/src/test/java/org/onap/clamp/clds/it/DcaeHttpConnectionManagerItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/DcaeHttpConnectionManagerItCase.java @@ -60,25 +60,23 @@ import org.springframework.test.context.junit4.SpringRunner; @TestPropertySource(locations = "classpath:https/https-test.properties") public class DcaeHttpConnectionManagerItCase extends AbstractItCase { @Value("${server.port}") - private String httpsPort; + private String httpsPort; @Value("${server.http-to-https-redirection.port}") - private String httpPort; + private String httpPort; private static TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { - @Override - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return null; - } + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return null; + } - @Override - public void checkClientTrusted(X509Certificate[] arg0, String arg1) - throws CertificateException { - } + @Override + public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { + } - @Override - public void checkServerTrusted(X509Certificate[] arg0, String arg1) - throws CertificateException { - } - } }; + @Override + public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { + } + } }; private void enableSslNoCheck() throws NoSuchAlgorithmException, KeyManagementException { SSLContext sc = SSLContext.getInstance("SSL"); diff --git a/src/test/java/org/onap/clamp/clds/it/HolmesPolicyDelegateItCase.java b/src/test/java/org/onap/clamp/clds/it/HolmesPolicyDelegateItCase.java index b45c29719..62e04ede3 100644 --- a/src/test/java/org/onap/clamp/clds/it/HolmesPolicyDelegateItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/HolmesPolicyDelegateItCase.java @@ -24,7 +24,6 @@ package org.onap.clamp.clds.it; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertNotNull; import java.io.IOException; @@ -46,17 +45,14 @@ import org.springframework.test.context.junit4.SpringRunner; @SpringBootTest @TestPropertySource(locations = "classpath:application-no-camunda.properties") public class HolmesPolicyDelegateItCase extends AbstractItCase { - @Test public void testCreatePolicyJson() throws IOException { String modelBpmnProp = ResourceFileUtil .getResourceAsString("example/model-properties/holmes/modelBpmnProperties.json"); String modelBpmn = ResourceFileUtil.getResourceAsString("example/model-properties/holmes/modelBpmn.json"); - - ModelProperties prop = new ModelProperties("example-model-name", "ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf", null, true, modelBpmn, - modelBpmnProp); - - Holmes holmes = prop.getType(Holmes.class); + ModelProperties prop = new ModelProperties("example-model-name", + "ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf", null, true, modelBpmn, modelBpmnProp); + Holmes holmes = prop.getType(Holmes.class); String result = HolmesPolicyDelegate.formatHolmesConfigBody(prop, holmes); assertTrue("ClosedLoop_FRWL_SIG_fad4dcae_e498_11e6_852e_0050568c4ccf$$$blabla".equals(result)); } |