diff options
Diffstat (limited to 'dcae-analytics-model/src')
24 files changed, 65 insertions, 95 deletions
diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/BaseDynamicPropertiesProvider.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/BaseDynamicPropertiesProvider.java index 4190587..80e1665 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/BaseDynamicPropertiesProvider.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/BaseDynamicPropertiesProvider.java @@ -62,8 +62,6 @@ public abstract class BaseDynamicPropertiesProvider implements DynamicProperties * @return return true if Dynamic Properties are present */ public boolean isDynamicPropertiesPresent() { - return dynamicProperties.size() == 0; + return dynamicProperties.isEmpty(); } - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/DynamicPropertiesProvider.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/DynamicPropertiesProvider.java index 28b607a..e4fc373 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/DynamicPropertiesProvider.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/DynamicPropertiesProvider.java @@ -38,7 +38,6 @@ import java.util.Map; */ public interface DynamicPropertiesProvider extends DCAEAnalyticsModel { - /** * Adds dynamic properties in a Map object * diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/AlertAction.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/AlertAction.java index 664bd4a..4e6759c 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/AlertAction.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/AlertAction.java @@ -27,6 +27,6 @@ package org.openecomp.dcae.apod.analytics.model.domain.cef; */ public enum AlertAction implements CEFModel { - CLEAR, CONT, SET; + CLEAR, CONT, SET } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/AlertType.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/AlertType.java index 9fc8046..aa17043 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/AlertType.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/AlertType.java @@ -32,7 +32,7 @@ public enum AlertType implements CEFModel { SERVICE_ANOMALY("SERVICE-ANOMALY"), UNKNOWN(null); - private String name; + private final String name; AlertType(String name) { this.name = name; @@ -41,5 +41,4 @@ public enum AlertType implements CEFModel { public String getName() { return name; } - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/BaseCEFModel.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/BaseCEFModel.java index 5438297..519e961 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/BaseCEFModel.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/BaseCEFModel.java @@ -36,6 +36,4 @@ import org.openecomp.dcae.apod.analytics.model.domain.BaseDynamicPropertiesProvi @Data @EqualsAndHashCode(callSuper = true) public abstract class BaseCEFModel extends BaseDynamicPropertiesProvider implements CEFModel { - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/CEFModel.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/CEFModel.java index 8df7d61..e6351b3 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/CEFModel.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/CEFModel.java @@ -29,6 +29,4 @@ import org.openecomp.dcae.apod.analytics.model.domain.DCAEAnalyticsModel; * @author Rajiv Singla. Creation Date: 08/15/2017. */ public interface CEFModel extends DCAEAnalyticsModel { - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Criticality.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Criticality.java index 69d23c4..d8e334c 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Criticality.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Criticality.java @@ -27,5 +27,5 @@ package org.openecomp.dcae.apod.analytics.model.domain.cef; */ public enum Criticality implements CEFModel { - CRIT, MAJ, UNKNOWN; + CRIT, MAJ, UNKNOWN } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Event.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Event.java index bb8a13a..d727a0e 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Event.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Event.java @@ -44,7 +44,7 @@ public class Event extends BaseCEFModel { private CommonEventHeader commonEventHeader; /** - * MeasurementsForVfScaling fields + * Measurements for Vf scaling fields * * @param measurementsForVfScalingFields New value for MeasurementsForVfScaling * @return MeasurementsForVfScaling fields @@ -52,12 +52,10 @@ public class Event extends BaseCEFModel { private MeasurementsForVfScalingFields measurementsForVfScalingFields; /** - * Threshold crossing Fields + * Threshold crossing alert Fields. * * @param thresholdCrossingAlertFields New value for Threshold crossing Fields * @return Threshold crossing Fields */ private ThresholdCrossingAlertFields thresholdCrossingAlertFields; - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/EventListener.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/EventListener.java index 0854790..aa543f7 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/EventListener.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/EventListener.java @@ -34,13 +34,12 @@ public class EventListener extends BaseCEFModel { private static final long serialVersionUID = 1L; - /** + + /** * Common Event Format - Event * * @param event New value for Event * @return Common Event Format Event */ private Event event; - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/EventSeverity.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/EventSeverity.java index d7f85fa..6626e77 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/EventSeverity.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/EventSeverity.java @@ -32,5 +32,5 @@ public enum EventSeverity implements CEFModel { MAJOR, MINOR, WARNING, - NORMAL; + NORMAL } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/PerformanceCounter.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/PerformanceCounter.java index e8dbee9..46b4c4f 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/PerformanceCounter.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/PerformanceCounter.java @@ -33,13 +33,15 @@ import lombok.EqualsAndHashCode; public class PerformanceCounter extends BaseCEFModel { private static final long serialVersionUID = 1L; + /** - * Performance Counter Criticality + * Performance Counter Criticality. * * @param criticality New value for Criticality * @return Performance Counter Criticality */ private Criticality criticality; + /** * Performance Counter Name * @@ -47,19 +49,20 @@ public class PerformanceCounter extends BaseCEFModel { * @return Performance Counter Name */ private String name; - /** - * Performance Counter Threshold Crossed + + /** + * Performance Counter for Threshold Crossed. * * @param thresholdCrossed New value for Performance Counter Threshold Crossed * @return Performance Counter Threshold Crossed */ private String thresholdCrossed; + /** - * Performance Counter Value + * Performance Counter Value. * * @param value New Performance Counter Value * @return Performance Counter Value */ private String value; - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Priority.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Priority.java index f2c6674..0206899 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Priority.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/Priority.java @@ -27,6 +27,8 @@ package org.openecomp.dcae.apod.analytics.model.domain.cef; */ public enum Priority implements CEFModel { - High, Medium, Normal, Low; - + High, + Medium, + Normal, + Low } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/ThresholdCrossingAlertFields.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/ThresholdCrossingAlertFields.java index 55dd696..5fbe3e3 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/ThresholdCrossingAlertFields.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/domain/cef/ThresholdCrossingAlertFields.java @@ -20,11 +20,10 @@ package org.openecomp.dcae.apod.analytics.model.domain.cef; +import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.List; - /** * Common Event Format - Fields Specific to threshold crossing alert events * @@ -37,7 +36,7 @@ public class ThresholdCrossingAlertFields extends BaseCEFModel { private static final long serialVersionUID = 1L; /** - * Additional Performance counters + * Additional Performance counters parameters. * * @param additionalParameters New value for Additional Performance counters * @return Additional Performance counters @@ -45,10 +44,10 @@ public class ThresholdCrossingAlertFields extends BaseCEFModel { private List<PerformanceCounter> additionalParameters; /** - * Event Action + * Event alert action * * @param alertAction New Event Action - * @return Event Action + * @return Event alert action */ private AlertAction alertAction; @@ -156,6 +155,4 @@ public class ThresholdCrossingAlertFields extends BaseCEFModel { * @return Version of the thresholdCrossingAlertFields block */ private Integer thresholdCrossingFieldsVersion; - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/AnalyticsModelIOUtils.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/AnalyticsModelIOUtils.java index d6d5dc2..df1d46d 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/AnalyticsModelIOUtils.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/AnalyticsModelIOUtils.java @@ -22,15 +22,14 @@ package org.openecomp.dcae.apod.analytics.model.util; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.Charset; import java.util.Properties; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Utility class containing methods for IO related operations @@ -50,8 +49,9 @@ public abstract class AnalyticsModelIOUtils extends AnalyticsModelJsonUtils { * @param <T> binding Class Type * * @return binding Class Object which properties populated from JSON File Location + * @throws IOException when fails to do IO operations */ - public static final <T> T convertToJsonObject(String fileLocation, Class<T> bindingClass) { + public static final <T> T convertToJsonObject(String fileLocation, Class<T> bindingClass) throws IOException { // Load Resource from give path final InputStream resourceAsStream = loadResourceAsStream(fileLocation); @@ -59,14 +59,13 @@ public abstract class AnalyticsModelIOUtils extends AnalyticsModelJsonUtils { // If resource is null throw an exception if (resourceAsStream == null) { final String errorMessage = String.format("Invalid File location: %s", fileLocation); - throw new RuntimeException(errorMessage, new FileNotFoundException(errorMessage)); + throw new IOException(errorMessage, new FileNotFoundException(errorMessage)); } // Parse input stream try (InputStreamReader inputStreamReader = new InputStreamReader(resourceAsStream, Charset.forName("UTF-8"))) { return ANALYTICS_MODEL_OBJECT_MAPPER.readValue(inputStreamReader, bindingClass); - } catch (JsonMappingException | JsonParseException e) { // If parsing fails due to Invalid Json or Json IO Issues throw an exception @@ -74,17 +73,14 @@ public abstract class AnalyticsModelIOUtils extends AnalyticsModelJsonUtils { fileLocation); LOG.error(errorMessage); - throw new RuntimeException(errorMessage, e); - + throw new IOException(errorMessage, e); } catch (IOException e) { // If parsing fails due to IO Issues throw an exception final String errorMessage = String.format("IO Error while parsing Json File location: %s", fileLocation); LOG.error(errorMessage); - throw new RuntimeException(errorMessage, e); - + throw new IOException(errorMessage, e); } - } /** @@ -105,7 +101,8 @@ public abstract class AnalyticsModelIOUtils extends AnalyticsModelJsonUtils { // If properties file is not present throw an exception if (propertiesFileInputStream == null) { final String errorMessage = String.format("Invalid Properties File at location: %s", - propertiesFileLocation); + propertiesFileLocation); + //TODO: discuss and change this excpeiton as well. throw new RuntimeException(errorMessage, new FileNotFoundException(errorMessage)); } @@ -132,6 +129,4 @@ public abstract class AnalyticsModelIOUtils extends AnalyticsModelJsonUtils { // Load Resource from give path return Thread.currentThread().getContextClassLoader().getResourceAsStream(fileLocation); } - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/BaseCEFModelMixin.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/BaseCEFModelMixin.java index 092d554..dab6b76 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/BaseCEFModelMixin.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/BaseCEFModelMixin.java @@ -28,6 +28,4 @@ import org.openecomp.dcae.apod.analytics.model.util.json.mixin.BaseDynamicProper * @author Rajiv Singla. Creation Date: 08/15/2017. */ public abstract class BaseCEFModelMixin extends BaseDynamicPropertiesProviderMixin { - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/EventListenerMixin.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/EventListenerMixin.java index 9f92bd7..56112dd 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/EventListenerMixin.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/EventListenerMixin.java @@ -26,6 +26,4 @@ package org.openecomp.dcae.apod.analytics.model.util.json.mixin.cef; * @author Rajiv Singla. Creation Date: 08/15/2017. */ public abstract class EventListenerMixin extends BaseCEFModelMixin { - - } diff --git a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/EventMixin.java b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/EventMixin.java index 269ddb7..00a83ba 100644 --- a/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/EventMixin.java +++ b/dcae-analytics-model/src/main/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/cef/EventMixin.java @@ -26,6 +26,4 @@ package org.openecomp.dcae.apod.analytics.model.util.json.mixin.cef; * @author Rajiv Singla. Creation Date: 08/15/2017. */ public abstract class EventMixin extends BaseCEFModelMixin { - - } diff --git a/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/BaseAnalyticsModelUnitTest.java b/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/BaseAnalyticsModelUnitTest.java index df69c8c..f0cfd1b 100644 --- a/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/BaseAnalyticsModelUnitTest.java +++ b/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/BaseAnalyticsModelUnitTest.java @@ -43,6 +43,9 @@ public abstract class BaseAnalyticsModelUnitTest extends BaseDCAEAnalyticsUnitTe protected static ObjectMapper objectMapper; + /** + * Before running test cases need to assign object mapper. + */ @BeforeClass public static void beforeClass() { final AnalyticsModelObjectMapperSupplier analyticsModelObjectMapperSupplier = @@ -52,7 +55,7 @@ public abstract class BaseAnalyticsModelUnitTest extends BaseDCAEAnalyticsUnitTe /** - * Deserialize given Json file location to given model class and returns it back without any validation check + * Deserialize given Json file location to given model class and returns it back without any validation check. * * @param jsonFileLocation Classpath location of the json file * @param modelClass Model Class type @@ -81,7 +84,7 @@ public abstract class BaseAnalyticsModelUnitTest extends BaseDCAEAnalyticsUnitTe /** * Deserialize given Json file location to given model class and then validates deserialization by comparing it - * with given expected Object + * with given expected Object. * * @param jsonFileLocation Classpath location of the json file * @param modelClass Model Class type @@ -95,12 +98,18 @@ public abstract class BaseAnalyticsModelUnitTest extends BaseDCAEAnalyticsUnitTe return actualValue; } + /** + * Serialize model to json. + * @param model model + * @return json + * @throws JsonProcessingException when fails to process object + */ public static String serializeModelToJson(Object model) throws JsonProcessingException { return objectMapper.writeValueAsString(model); } /** - * Converts given model to json string and compare it with json present at given file location + * Converts given model to json string and compare it with json present at given file location. * * @param model Model which needs to be compared * @param expectedJsonFileLocation Location of file containing expected json string @@ -114,17 +123,16 @@ public abstract class BaseAnalyticsModelUnitTest extends BaseDCAEAnalyticsUnitTe assertJson(expectedModelString, actualModelString); return model; } catch (IOException | JSONException ex) { - LOG.error("Error while doing assert Json serialization Assertion: model: {}, " + - "expected Json File Location: {}, Exception {}", model, expectedJsonFileLocation, ex); + LOG.error("Error while doing assert Json serialization Assertion: model: {}, " + + "expected Json File Location: {}, Exception {}", model, expectedJsonFileLocation, ex); throw new RuntimeException(ex); } - } /** * Checks both serialization and deserialization. - * + * </p> * First checks deserialization and then serialize the deserialized object back to json * and check if matches the given json file location string * @@ -143,6 +151,4 @@ public abstract class BaseAnalyticsModelUnitTest extends BaseDCAEAnalyticsUnitTe return actualValue; } - - } diff --git a/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/facade/tca/AAITest.java b/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/facade/tca/AAITest.java index d5c5186..3aa6460 100644 --- a/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/facade/tca/AAITest.java +++ b/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/facade/tca/AAITest.java @@ -33,27 +33,25 @@ import static org.junit.Assert.assertThat; public class AAITest extends BaseAnalyticsModelUnitTest { private AAI aai; + private static final String GENERIC_VNF_ID = "testVNFID"; + private static final String CHANGED_GENERIC_VNF_ID = "changedVNFID"; @Before public void before() { - this.aai = new AAI(); + aai = new AAI(); } @Test public void getGenericVNFId() throws Exception { - final String genericVNFId = "testVNFID"; - aai.setGenericVNFId(genericVNFId); - assertThat("VNFID must be same", aai.getGenericVNFId(), is(genericVNFId)); + aai.setGenericVNFId(GENERIC_VNF_ID); + assertThat("VNFID must be same", aai.getGenericVNFId(), is(GENERIC_VNF_ID)); } @Test public void setGenericVNFId() throws Exception { final String genericVNFId = "testVNFID"; - aai.setGenericVNFId(genericVNFId); - final String changedGenericVNFId = "changedVNFID"; - aai.setGenericVNFId(changedGenericVNFId); - assertThat("VNFID must be same as changed VNFID", aai.getGenericVNFId(), is(changedGenericVNFId)); - + aai.setGenericVNFId(GENERIC_VNF_ID); + aai.setGenericVNFId(CHANGED_GENERIC_VNF_ID); + assertThat("VNFID must be same as changed VNFID", aai.getGenericVNFId(), is(CHANGED_GENERIC_VNF_ID)); } - } diff --git a/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/facade/tca/TCAVESResponseTest.java b/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/facade/tca/TCAVESResponseTest.java index 9696823..38dde65 100644 --- a/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/facade/tca/TCAVESResponseTest.java +++ b/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/facade/tca/TCAVESResponseTest.java @@ -31,14 +31,13 @@ import static org.junit.Assert.assertThat; */ public class TCAVESResponseTest extends BaseAnalyticsModelUnitTest { - final String tcaVESCEFResponseJsonFileLocation = "data/json/facade/tca_ves_cef_response.json"; - + private static final String TCA_VES_CEF_RESPONSE_JSON_FILE_LOCATION = "data/json/facade/tca_ves_cef_response.json"; @Test public void testTCAPolicyJsonConversions() throws Exception { final TCAVESResponse vesCEFMessageResponse = - assertJsonConversions(tcaVESCEFResponseJsonFileLocation, TCAVESResponse.class); + assertJsonConversions(TCA_VES_CEF_RESPONSE_JSON_FILE_LOCATION, TCAVESResponse.class); assertThat("VES CEF Message Response AAI generics VNF Id must match", vesCEFMessageResponse.getAai().getGenericVNFId(), is("vpp-test(?)")); @@ -74,5 +73,4 @@ public class TCAVESResponseTest extends BaseAnalyticsModelUnitTest { vesCEFMessageResponse.getClosedLoopEventStatus(), is("ONSET")); } - } diff --git a/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/util/AnalyticsModelIOUtilsTest.java b/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/util/AnalyticsModelIOUtilsTest.java index ac8d823..bbfb7f5 100644 --- a/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/util/AnalyticsModelIOUtilsTest.java +++ b/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/util/AnalyticsModelIOUtilsTest.java @@ -54,17 +54,16 @@ public class AnalyticsModelIOUtilsTest extends BaseAnalyticsModelUnitTest { assertEquals("App Description much with json settings file value", "Test App Description", appDescription); } - @Test(expected = RuntimeException.class) + @Test(expected = IOException.class) public void testConvertToJsonObjectWhenFileLocationIsInvValid() throws Exception { AnalyticsModelIOUtils.convertToJsonObject("InvalidFileLocation", ConfigHolder.class); } - @Test(expected = RuntimeException.class) + @Test(expected = IOException.class) public void testConvertToJsonObjectWhenJsonFileHasInvalidJson() throws Exception { AnalyticsModelIOUtils.convertToJsonObject(INVALID_TEST_CONFIG_FILE_LOCATION, ConfigHolder.class); } - @Test public void testValidPropertiesFileLoading() throws Exception { final Properties properties = @@ -82,8 +81,6 @@ public class AnalyticsModelIOUtilsTest extends BaseAnalyticsModelUnitTest { final Properties mockProperties = Mockito.mock(Properties.class); doThrow(new IOException()).when(mockProperties).load(any(InputStream.class)); AnalyticsModelIOUtils.loadPropertiesFile(TEST_PROPERTIES_FILE_LOCATION, mockProperties); - } - } diff --git a/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/util/TestAppConfig.java b/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/util/TestAppConfig.java index 5699192..0bae289 100644 --- a/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/util/TestAppConfig.java +++ b/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/util/TestAppConfig.java @@ -36,5 +36,3 @@ public class TestAppConfig { return appDescription; } } - - diff --git a/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/facade/tca/TCAVESResponseMixinTest.java b/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/facade/tca/TCAVESResponseMixinTest.java index 3285ded..1233d09 100644 --- a/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/facade/tca/TCAVESResponseMixinTest.java +++ b/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/facade/tca/TCAVESResponseMixinTest.java @@ -33,13 +33,13 @@ import static org.junit.Assert.assertThat; */ public class TCAVESResponseMixinTest extends BaseAnalyticsModelUnitTest { - final String tcaVESCEFResponseJsonFileLocation = "data/json/facade/tca_ves_cef_response.json"; + private static final String TCA_VES_CEF_RESPONSE_JSON_FILE_LOCATION = "data/json/facade/tca_ves_cef_response.json"; @Test public void testTCAPolicyJsonConversions() throws Exception { final TCAVESResponse vesCEFMessageResponse = - assertJsonConversions(tcaVESCEFResponseJsonFileLocation, TCAVESResponse.class); + assertJsonConversions(TCA_VES_CEF_RESPONSE_JSON_FILE_LOCATION, TCAVESResponse.class); assertThat("VES CEF Message Response AAI generics VNF Id must match", vesCEFMessageResponse.getAai().getGenericVNFId(), is("vpp-test(?)")); @@ -51,7 +51,5 @@ public class TCAVESResponseMixinTest extends BaseAnalyticsModelUnitTest { vesCEFMessageResponse.getTargetType(), is("VNF")); testSerialization(vesCEFMessageResponse, getClass()); - } - } diff --git a/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/policy/tca/TCAPolicyMixinTest.java b/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/policy/tca/TCAPolicyMixinTest.java index a42f816..4084f11 100644 --- a/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/policy/tca/TCAPolicyMixinTest.java +++ b/dcae-analytics-model/src/test/java/org/openecomp/dcae/apod/analytics/model/util/json/mixin/policy/tca/TCAPolicyMixinTest.java @@ -33,12 +33,12 @@ import static org.junit.Assert.assertThat; */ public class TCAPolicyMixinTest extends BaseAnalyticsModelUnitTest { - final String tcaPolicyJsonFileLocation = "data/json/policy/tca_policy.json"; + private static final String TCA_POLICY_JSON_FILE_LOCATION = "data/json/policy/tca_policy.json"; @Test public void testTCAPolicyJsonConversions() throws Exception { - final TCAPolicy tcaPolicy = assertJsonConversions(tcaPolicyJsonFileLocation, TCAPolicy.class); + final TCAPolicy tcaPolicy = assertJsonConversions(TCA_POLICY_JSON_FILE_LOCATION, TCAPolicy.class); assertThat("TCA Policy Metrics Per Event Name must be 2", tcaPolicy.getMetricsPerEventName().size(), is(2)); @@ -47,10 +47,5 @@ public class TCAPolicyMixinTest extends BaseAnalyticsModelUnitTest { tcaPolicy.getMetricsPerEventName().get(0).getThresholds().size(), is(3)); testSerialization(tcaPolicy, getClass()); - } - - - - } |