diff options
author | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-03-15 11:26:17 +0100 |
---|---|---|
committer | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-03-15 11:26:17 +0100 |
commit | b646d524270c8ca093974751b6696e0c0e0b3a08 (patch) | |
tree | 5694a5ab2d99a188ad2ae5c124afd5de0cf84521 /src | |
parent | b3737db89cab5d43b7ef18f32052a9749487e1bb (diff) |
Fix Checkstyle issues
Fix the checkstyle issues reported by the build
Issue-ID: CLAMP-74
Change-Id: Ia2b3e332808d59aefcc7140d9638c7a18ef24e65
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'src')
11 files changed, 39 insertions, 42 deletions
diff --git a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java index 5946416ad..143cb14bb 100644 --- a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java +++ b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java @@ -35,8 +35,8 @@ import java.util.Map; import javax.sql.DataSource; -import org.onap.clamp.clds.model.CLDSMonitoringDetails; -import org.onap.clamp.clds.model.CldsDBServiceCache; +import org.onap.clamp.clds.model.CldsMonitoringDetails; +import org.onap.clamp.clds.model.CldsDbServiceCache; import org.onap.clamp.clds.model.CldsEvent; import org.onap.clamp.clds.model.CldsModel; import org.onap.clamp.clds.model.CldsModelInstance; @@ -381,7 +381,7 @@ public class CldsDao { } } - public void setCldsServiceCache(CldsDBServiceCache cldsDBServiceCache) { + public void setCldsServiceCache(CldsDbServiceCache cldsDBServiceCache) { if (cldsDBServiceCache != null && cldsDBServiceCache.getInvariantId() != null && cldsDBServiceCache.getServiceId() != null) { String invariantUuid = cldsDBServiceCache.getInvariantId(); @@ -442,16 +442,16 @@ public class CldsDao { * generate the ClosedLoop model. ACTION_CD | Current state of the * ClosedLoop in CLDS application. */ - public List<CLDSMonitoringDetails> getCLDSMonitoringDetails() { + public List<CldsMonitoringDetails> getCLDSMonitoringDetails() { SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss"); - List<CLDSMonitoringDetails> cldsMonitoringDetailsList = new ArrayList<CLDSMonitoringDetails>(); + List<CldsMonitoringDetails> cldsMonitoringDetailsList = new ArrayList<CldsMonitoringDetails>(); String modelsSql = "SELECT CONCAT(M.CONTROL_NAME_PREFIX, M.CONTROL_NAME_UUID) AS CLOSELOOP_NAME , M.MODEL_NAME, M.SERVICE_TYPE_ID, M.DEPLOYMENT_ID, T.TEMPLATE_NAME, E.ACTION_CD, E.USER_ID, E.TIMESTAMP " + "FROM MODEL M, TEMPLATE T, EVENT E " + "WHERE M.TEMPLATE_ID = T.TEMPLATE_ID AND M.EVENT_ID = E.EVENT_ID " + "ORDER BY ACTION_CD"; List<Map<String, Object>> rows = jdbcTemplateObject.queryForList(modelsSql); - CLDSMonitoringDetails cldsMonitoringDetails = null; + CldsMonitoringDetails cldsMonitoringDetails = null; for (Map<String, Object> row : rows) { - cldsMonitoringDetails = new CLDSMonitoringDetails(); + cldsMonitoringDetails = new CldsMonitoringDetails(); cldsMonitoringDetails.setCloseloopName((String) row.get("CLOSELOOP_NAME")); cldsMonitoringDetails.setModelName((String) row.get("MODEL_NAME")); cldsMonitoringDetails.setServiceTypeId((String) row.get("SERVICE_TYPE_ID")); diff --git a/src/main/java/org/onap/clamp/clds/model/CldsDBServiceCache.java b/src/main/java/org/onap/clamp/clds/model/CldsDbServiceCache.java index 80e8d8538..fe3088bc4 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsDBServiceCache.java +++ b/src/main/java/org/onap/clamp/clds/model/CldsDbServiceCache.java @@ -29,13 +29,13 @@ import java.io.IOException; import java.io.InputStream; import java.io.ObjectOutputStream; -public class CldsDBServiceCache { +public class CldsDbServiceCache { private String invariantId; private String serviceId; private InputStream cldsDataInstream; - public CldsDBServiceCache(CldsServiceData cldsServiceData) throws IOException { + public CldsDbServiceCache(CldsServiceData cldsServiceData) throws IOException { setCldsDataInstream(cldsServiceData); setInvariantId(cldsServiceData.getServiceInvariantUUID()); setServiceId(cldsServiceData.getServiceUUID()); diff --git a/src/main/java/org/onap/clamp/clds/model/CLDSMonitoringDetails.java b/src/main/java/org/onap/clamp/clds/model/CldsMonitoringDetails.java index be4f95096..a042ae4fb 100644 --- a/src/main/java/org/onap/clamp/clds/model/CLDSMonitoringDetails.java +++ b/src/main/java/org/onap/clamp/clds/model/CldsMonitoringDetails.java @@ -26,7 +26,7 @@ package org.onap.clamp.clds.model; /** * Maintains model and template details. */ -public class CLDSMonitoringDetails { +public class CldsMonitoringDetails { private String closeloopName; private String modelName; diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java index 9bd9c4173..34bd3d787 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java @@ -67,8 +67,8 @@ import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.exception.CldsConfigException; import org.onap.clamp.clds.exception.policy.PolicyClientException; import org.onap.clamp.clds.exception.sdc.SdcCommunicationException; -import org.onap.clamp.clds.model.CLDSMonitoringDetails; -import org.onap.clamp.clds.model.CldsDBServiceCache; +import org.onap.clamp.clds.model.CldsMonitoringDetails; +import org.onap.clamp.clds.model.CldsDbServiceCache; import org.onap.clamp.clds.model.CldsEvent; import org.onap.clamp.clds.model.CldsHealthCheck; import org.onap.clamp.clds.model.CldsInfo; @@ -156,10 +156,10 @@ public class CldsService extends SecureServiceBase { @GET @Path("/cldsDetails") @Produces(MediaType.APPLICATION_JSON) - public List<CLDSMonitoringDetails> getCLDSDetails() { + public List<CldsMonitoringDetails> getCLDSDetails() { Date startTime = new Date(); LoggingUtils.setRequestContext("CldsService: GET model details", getPrincipalName()); - List<CLDSMonitoringDetails> cldsMonitoringDetailsList = new ArrayList<CLDSMonitoringDetails>(); + List<CldsMonitoringDetails> cldsMonitoringDetailsList = new ArrayList<CldsMonitoringDetails>(); cldsMonitoringDetailsList = cldsDao.getCLDSMonitoringDetails(); // audit log LoggingUtils.setTimeContext(startTime, new Date()); @@ -610,7 +610,7 @@ public class CldsService extends SecureServiceBase { } if (sdcCatalogServices.isCldsSdcCacheDataExpired(cldsServiceData)) { cldsServiceData = sdcCatalogServices.getCldsServiceDataWithAlarmConditions(serviceInvariantUUID); - cldsDao.setCldsServiceCache(new CldsDBServiceCache(cldsServiceData)); + cldsDao.setCldsServiceCache(new CldsDbServiceCache(cldsServiceData)); } // filter out VFs the user is not authorized for cldsServiceData.filterVfs(this); diff --git a/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java b/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java index 287bc1791..ecef30ee4 100644 --- a/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java +++ b/src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java @@ -40,7 +40,7 @@ import org.onap.clamp.clds.util.ResourceFileUtil; */ public class SdcSingleControllerConfigurationTest { - public final SdcSingleControllerConfiguration loadControllerConfiguration(String fileName, String sdcControllerName) + private SdcSingleControllerConfiguration loadControllerConfiguration(String fileName, String sdcControllerName) throws JsonParseException, JsonMappingException, IOException { JsonNode jsonNode = new ObjectMapper().readValue(ResourceFileUtil.getResourceAsStream(fileName), JsonNode.class); @@ -78,7 +78,7 @@ public class SdcSingleControllerConfigurationTest { } @Test - public final void testConsumerGroupWithNULL() throws JsonParseException, JsonMappingException, IOException { + public final void testConsumerGroupWithNull() throws JsonParseException, JsonMappingException, IOException { SdcSingleControllerConfiguration sdcConfig = loadControllerConfiguration("clds/sdc-controller-config-NULL.json", "sdc-controller1"); assertTrue(sdcConfig.getConsumerGroup() == null); 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 861921c13..ba37b57f8 100644 --- a/src/test/java/org/onap/clamp/clds/it/CldsDaoItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/CldsDaoItCase.java @@ -44,8 +44,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.onap.clamp.clds.client.req.sdc.SdcCatalogServices; import org.onap.clamp.clds.dao.CldsDao; -import org.onap.clamp.clds.model.CLDSMonitoringDetails; -import org.onap.clamp.clds.model.CldsDBServiceCache; +import org.onap.clamp.clds.model.CldsMonitoringDetails; +import org.onap.clamp.clds.model.CldsDbServiceCache; import org.onap.clamp.clds.model.CldsEvent; import org.onap.clamp.clds.model.CldsModel; import org.onap.clamp.clds.model.CldsServiceData; @@ -156,13 +156,11 @@ public class CldsDaoItCase { } @Test - public void testGetCLDSMonitoringDetails() { - List<CLDSMonitoringDetails> cldsMonitoringDetailsList = new ArrayList<CLDSMonitoringDetails>(); + public void testGetCldsMonitoringDetails() { + List<CldsMonitoringDetails> cldsMonitoringDetailsList = new ArrayList<CldsMonitoringDetails>(); cldsMonitoringDetailsList = cldsDao.getCLDSMonitoringDetails(); cldsMonitoringDetailsList.forEach(clName -> { - logger.info(clName.getCloseloopName()); // Uncomment this line to - // view the result on - // console + logger.info(clName.getCloseloopName()); assertNotNull(clName.getCloseloopName()); }); } @@ -174,7 +172,7 @@ public class CldsDaoItCase { // Test not in cache so should be null CldsServiceData cldsServiceDataCache = cldsDao.getCldsServiceCache("4cc5b45a-1f63-4194-8100-cd8e14248c92"); assertNull(cldsServiceDataCache); - cldsDao.setCldsServiceCache(new CldsDBServiceCache(cldsServiceData)); + cldsDao.setCldsServiceCache(new CldsDbServiceCache(cldsServiceData)); cldsServiceDataCache = cldsDao.getCldsServiceCache("4cc5b45a-1f63-4194-8100-cd8e14248c92"); assertNotNull(cldsServiceDataCache); assertEquals("56441b4b-0467-41dc-9a0e-e68613838219", cldsServiceDataCache.getServiceUUID()); @@ -187,7 +185,7 @@ public class CldsDaoItCase { assertEquals(0, cldsServiceDataCache.getCldsVfs().get(0).getCldsKPIList().size()); // Second update cldsServiceData.setCldsVfs(null); - cldsDao.setCldsServiceCache(new CldsDBServiceCache(cldsServiceData)); + cldsDao.setCldsServiceCache(new CldsDbServiceCache(cldsServiceData)); cldsServiceDataCache = cldsDao.getCldsServiceCache("4cc5b45a-1f63-4194-8100-cd8e14248c92"); assertNotNull(cldsServiceDataCache); assertNull(cldsServiceDataCache.getCldsVfs()); 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 c2b6fb167..a699ca769 100644 --- a/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java @@ -183,7 +183,7 @@ public class CldsServiceItCase { } @Test - public void testGetSdcPropertiesByServiceUUIDForRefresh() + public void testGetSdcPropertiesByServiceUuidForRefresh() throws GeneralSecurityException, DecoderException, JSONException, IOException { SecurityContext securityContext = Mockito.mock(SecurityContext.class); Principal principal = Mockito.mock(Principal.class); diff --git a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java b/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java index 43fc95981..e080baccc 100644 --- a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java @@ -50,11 +50,9 @@ public class CldsReferencePropertiesItCase { /** * Test getting a value the properties in string. - * - * @throws IOException */ @Test - public void testGetStringValue() throws IOException { + public void testGetStringValue() { assertEquals(refProp.getStringValue("policy.onap.name"), "DCAE"); assertEquals(refProp.getStringValue("policy.ms.policyNamePrefix", ""), "Config_MS_"); assertEquals(refProp.getStringValue("policy.ms.policyNamePrefix", "testos"), "Config_MS_"); diff --git a/src/test/java/org/onap/clamp/clds/model/CldsDBServiceCacheTest.java b/src/test/java/org/onap/clamp/clds/model/CldsDbServiceCacheTest.java index ad1689157..447e25531 100644 --- a/src/test/java/org/onap/clamp/clds/model/CldsDBServiceCacheTest.java +++ b/src/test/java/org/onap/clamp/clds/model/CldsDbServiceCacheTest.java @@ -33,7 +33,7 @@ import java.util.List; import org.junit.Test; -public class CldsDBServiceCacheTest { +public class CldsDbServiceCacheTest { @Test public void testConstructor() throws IOException, ClassNotFoundException { @@ -52,8 +52,8 @@ public class CldsDBServiceCacheTest { cldsVfData.setCldsKPIList(cldsKPIList); cldsVfs.add(cldsVfData); cldsServiceData.setCldsVfs(cldsVfs); - CldsDBServiceCache cldsDBServiceCache = new CldsDBServiceCache(cldsServiceData); - ObjectInputStream reader = new ObjectInputStream(cldsDBServiceCache.getCldsDataInstream()); + CldsDbServiceCache cldsDbServiceCache = new CldsDbServiceCache(cldsServiceData); + ObjectInputStream reader = new ObjectInputStream(cldsDbServiceCache.getCldsDataInstream()); CldsServiceData cldsServiceDataResult = (CldsServiceData) reader.readObject(); assertNotNull(cldsServiceDataResult); assertNotNull(cldsServiceDataResult.getCldsVfs()); diff --git a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java index 4c3ab86b7..d1b177d22 100644 --- a/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java +++ b/src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java @@ -68,17 +68,17 @@ public class CsarHandlerTest { Mockito.when(serviceArtifact.getArtifactName()).thenReturn(csarArtifactName); List<IArtifactInfo> servicesList = new ArrayList<>(); servicesList.add(serviceArtifact); - INotificationData iNotifData = Mockito.mock(INotificationData.class); - Mockito.when(iNotifData.getServiceArtifacts()).thenReturn(servicesList); - CsarHandler csar = new CsarHandler(iNotifData, "test-controller", sdcFolder); + INotificationData notifData = Mockito.mock(INotificationData.class); + Mockito.when(notifData.getServiceArtifacts()).thenReturn(servicesList); + CsarHandler csar = new CsarHandler(notifData, "test-controller", sdcFolder); assertEquals(sdcFolder + "/test-controller" + "/" + csarArtifactName, csar.getFilePath()); } @Test(expected = CsarHandlerException.class) public void testFailingConstructor() throws CsarHandlerException { - INotificationData iNotifData = Mockito.mock(INotificationData.class); - Mockito.when(iNotifData.getServiceArtifacts()).thenReturn(new ArrayList<>()); - new CsarHandler(iNotifData, "test-controller", "/tmp/csar-handler-tests"); + INotificationData notifData = Mockito.mock(INotificationData.class); + Mockito.when(notifData.getServiceArtifacts()).thenReturn(new ArrayList<>()); + new CsarHandler(notifData, "test-controller", "/tmp/csar-handler-tests"); fail("Exception should have been raised"); } @@ -90,9 +90,9 @@ public class CsarHandlerTest { Mockito.when(serviceArtifact.getArtifactName()).thenReturn(csarArtifactName); List<IArtifactInfo> servicesList = new ArrayList<>(); servicesList.add(serviceArtifact); - INotificationData iNotifData = Mockito.mock(INotificationData.class); - Mockito.when(iNotifData.getServiceArtifacts()).thenReturn(servicesList); - CsarHandler csar = new CsarHandler(iNotifData, "test-controller", "/tmp/csar-handler-tests"); + INotificationData notifData = Mockito.mock(INotificationData.class); + Mockito.when(notifData.getServiceArtifacts()).thenReturn(servicesList); + CsarHandler csar = new CsarHandler(notifData, "test-controller", "/tmp/csar-handler-tests"); IDistributionClientDownloadResult resultArtifact = Mockito.mock(IDistributionClientDownloadResult.class); Mockito.when(resultArtifact.getArtifactPayload()).thenReturn( IOUtils.toByteArray(ResourceFileUtil.getResourceAsStream("example/sdc/service-Simsfoimap0112.csar"))); diff --git a/src/test/java/org/onap/clamp/clds/transform/XslTransformerTest.java b/src/test/java/org/onap/clamp/clds/transform/XslTransformerTest.java index fd61ef4ed..2570aeb44 100644 --- a/src/test/java/org/onap/clamp/clds/transform/XslTransformerTest.java +++ b/src/test/java/org/onap/clamp/clds/transform/XslTransformerTest.java @@ -44,6 +44,7 @@ public class XslTransformerTest { * @throws IOException * In case of issues * @throws JSONException + * In case of issues to decode Json */ @Test public void xslTransformTest() throws TransformerException, IOException, JSONException { |