diff options
Diffstat (limited to 'models/src/test')
4 files changed, 25 insertions, 40 deletions
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProviderTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProviderTest.java index f5d094f9e..eb6a02898 100644 --- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProviderTest.java +++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProviderTest.java @@ -41,8 +41,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; public class ClElementStatisticsProviderTest { private static final String LIST_IS_NULL = ".*. is marked .*ull but is null"; private static final Coder CODER = new StandardCoder(); - private static final String CL_ELEMENT_STATS_JSON = - "src/test/resources/providers/TestClElementStatistics.json"; + private static final String CL_ELEMENT_STATS_JSON = "src/test/resources/providers/TestClElementStatistics.json"; private static AtomicInteger dbNameCounter = new AtomicInteger(); @@ -53,9 +52,11 @@ public class ClElementStatisticsProviderTest { /** * Set up test ClElement statistics provider. + * + * @throws Exception on errors */ @Before - public void setupDao() throws Exception { + public void beforeSetupDao() throws Exception { parameters = new PolicyModelsProviderParameters(); parameters.setDatabaseDriver("org.h2.Driver"); @@ -82,8 +83,8 @@ public class ClElementStatisticsProviderTest { }).hasMessageMatching(LIST_IS_NULL); ClElementStatisticsList createdClElementStats = new ClElementStatisticsList(); - createdClElementStats.setClElementStatistics(clElementStatisticsProvider - .createClElementStatistics(inputClElementStats.getClElementStatistics())); + createdClElementStats.setClElementStatistics( + clElementStatisticsProvider.createClElementStatistics(inputClElementStats.getClElementStatistics())); assertEquals(inputClElementStats.toString().replaceAll("\\s+", ""), createdClElementStats.toString().replaceAll("\\s+", "")); @@ -94,22 +95,18 @@ public class ClElementStatisticsProviderTest { List<ClElementStatistics> getResponse; - //Return empty list when no data present in db - getResponse = clElementStatisticsProvider.getClElementStatistics(null, null, null, - null); + // Return empty list when no data present in db + getResponse = clElementStatisticsProvider.getClElementStatistics(null, null, null, null); assertThat(getResponse).isEmpty(); - clElementStatisticsProvider.createClElementStatistics(inputClElementStats - .getClElementStatistics()); - ToscaConceptIdentifier identifier = inputClElementStats.getClElementStatistics().get(0) - .getParticipantId(); + clElementStatisticsProvider.createClElementStatistics(inputClElementStats.getClElementStatistics()); + ToscaConceptIdentifier identifier = inputClElementStats.getClElementStatistics().get(0).getParticipantId(); Instant instant = inputClElementStats.getClElementStatistics().get(0).getTimeStamp(); String id = inputClElementStats.getClElementStatistics().get(0).getId().toString(); - assertEquals(1, clElementStatisticsProvider.getClElementStatistics(identifier.getName(), - identifier.getVersion(), id, instant).size()); + assertEquals(1, clElementStatisticsProvider + .getClElementStatistics(identifier.getName(), identifier.getVersion(), id, instant).size()); - assertEquals(1, clElementStatisticsProvider.getFilteredClElementStatistics("name2", - "1.0.1", null, null, null, - "DESC", 1).size()); + assertEquals(1, clElementStatisticsProvider + .getFilteredClElementStatistics("name2", "1.0.1", null, null, null, "DESC", 1).size()); } } diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProviderTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProviderTest.java index 96b63a23d..d362c2718 100644 --- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProviderTest.java +++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProviderTest.java @@ -56,11 +56,8 @@ public class ControlLoopProviderTest { private String originalJson = ResourceUtils.getResourceAsString(CONTROL_LOOP_JSON); private String updateClJson = ResourceUtils.getResourceAsString(UPDATE_CL_JSON); - /** - * Set up test control loop provider. - */ @Before - public void setupDao() throws Exception { + public void beforeSetupDao() throws Exception { parameters = new PolicyModelsProviderParameters(); parameters.setDatabaseDriver("org.h2.Driver"); @@ -90,7 +87,7 @@ public class ControlLoopProviderTest { ControlLoops createdControlLoops = new ControlLoops(); createdControlLoops - .setControlLoopList(controlLoopProvider.createControlLoops(inputControlLoops.getControlLoopList())); + .setControlLoopList(controlLoopProvider.createControlLoops(inputControlLoops.getControlLoopList())); assertEquals(inputControlLoops, createdControlLoops); } @@ -120,11 +117,10 @@ public class ControlLoopProviderTest { }).hasMessageMatching("filter is marked .*ull but is null"); final ToscaTypedEntityFilter<ControlLoop> filter = ToscaTypedEntityFilter.<ControlLoop>builder() - .type("org.onap.domain.pmsh.PMSHControlLoopDefinition").build(); + .type("org.onap.domain.pmsh.PMSHControlLoopDefinition").build(); assertEquals(2, controlLoopProvider.getFilteredControlLoops(filter).size()); } - @Test public void testUpdateControlLoops() throws Exception { assertThatThrownBy(() -> { @@ -133,7 +129,7 @@ public class ControlLoopProviderTest { ControlLoops existingControlLoops = new ControlLoops(); existingControlLoops - .setControlLoopList(controlLoopProvider.createControlLoops(inputControlLoops.getControlLoopList())); + .setControlLoopList(controlLoopProvider.createControlLoops(inputControlLoops.getControlLoopList())); ControlLoop updateResponse = new ControlLoop(); updateResponse = controlLoopProvider.updateControlLoop(updateControlLoops.getControlLoopList().get(0)); @@ -156,5 +152,3 @@ public class ControlLoopProviderTest { } } - - diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantProviderTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantProviderTest.java index 7a86a49dc..41c106577 100644 --- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantProviderTest.java +++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantProviderTest.java @@ -42,7 +42,7 @@ public class ParticipantProviderTest { private static final Coder CODER = new StandardCoder(); private static final String PARTICIPANT_JSON = - "src/test/resources/providers/TestParticipant.json"; + "src/test/resources/providers/TestParticipant.json"; private static final String LIST_IS_NULL = ".*. is marked .*ull but is null"; private static AtomicInteger dbNameCounter = new AtomicInteger(); @@ -53,11 +53,8 @@ public class ParticipantProviderTest { private Participant updateParticipants; private String originalJson = ResourceUtils.getResourceAsString(PARTICIPANT_JSON); - /** - * Set up test Participant provider. - */ @Before - public void setupDao() throws Exception { + public void beforeSetupDao() throws Exception { parameters = new PolicyModelsProviderParameters(); parameters.setDatabaseDriver("org.h2.Driver"); @@ -86,10 +83,10 @@ public class ParticipantProviderTest { List<Participant> createdParticipants = new ArrayList<>(); createdParticipants.addAll(participantProvider - .createParticipants(inputParticipants)); + .createParticipants(inputParticipants)); assertEquals(createdParticipants.get(0), - inputParticipants.get(0)); + inputParticipants.get(0)); } @@ -108,14 +105,14 @@ public class ParticipantProviderTest { assertEquals(1, participantProvider.getParticipants(name, version).size()); assertThat(participantProvider.getParticipants("invalid_name", - "1.0.1")).isEmpty(); + "1.0.1")).isEmpty(); assertThatThrownBy(() -> { participantProvider.getFilteredParticipants(null); }).hasMessageMatching("filter is marked .*ull but is null"); final ToscaTypedEntityFilter<Participant> filter = ToscaTypedEntityFilter.<Participant>builder() - .type("org.onap.domain.pmsh.PMSHControlLoopDefinition").build(); + .type("org.onap.domain.pmsh.PMSHControlLoopDefinition").build(); assertEquals(1, participantProvider.getFilteredParticipants(filter).size()); } diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProviderTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProviderTest.java index d4bc9777a..0fd3693c0 100644 --- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProviderTest.java +++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProviderTest.java @@ -51,11 +51,8 @@ public class ParticipantStatisticsProviderTest { private ParticipantStatisticsList inputParticipantStatistics; private String originalJson = ResourceUtils.getResourceAsString(PARTICIPANT_STATS_JSON); - /** - * Set up test Participant statistics provider. - */ @Before - public void setupDao() throws Exception { + public void beforeSetupDao() throws Exception { parameters = new PolicyModelsProviderParameters(); parameters.setDatabaseDriver("org.h2.Driver"); |