diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-enrichment-lib')
3 files changed, 26 insertions, 43 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml index d09775fd19..28d4a1950a 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml @@ -54,11 +54,6 @@ <artifactId>openecomp-sdc-versioning-api</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>org.jmockit</groupId> - <artifactId>jmockit</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfo.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfo.java index bd14e5a1e5..90399247c5 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfo.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/main/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfo.java @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.core.enrichment.types; import static org.openecomp.core.enrichment.types.MonitoringUploadType.SNMP_POLL; @@ -25,10 +26,12 @@ import static org.openecomp.core.enrichment.types.MonitoringUploadType.VES_EVENT import java.util.HashMap; import java.util.Map; +import lombok.NoArgsConstructor; +@NoArgsConstructor public class ComponentMonitoringUploadInfo { - private Map<MonitoringUploadType, MonitoringArtifactInfo> infoByType = new HashMap<>(); + private final Map<MonitoringUploadType, MonitoringArtifactInfo> infoByType = new HashMap<>(); public MonitoringArtifactInfo getSnmpTrap() { return infoByType.get(SNMP_TRAP); @@ -42,7 +45,8 @@ public class ComponentMonitoringUploadInfo { return infoByType.get(VES_EVENTS); } - public void setMonitoringArtifactFile(MonitoringUploadType type, MonitoringArtifactInfo monitoringArtifactInfo) { + public void setMonitoringArtifactFile(final MonitoringUploadType type, + final MonitoringArtifactInfo monitoringArtifactInfo) { infoByType.put(type, monitoringArtifactInfo); } } diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/test/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfoTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/test/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfoTest.java index b857d0cc04..977f691c31 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/test/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfoTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/src/test/java/org/openecomp/core/enrichment/types/ComponentMonitoringUploadInfoTest.java @@ -16,59 +16,43 @@ package org.openecomp.core.enrichment.types; -import static org.hamcrest.CoreMatchers.isA; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import java.util.HashMap; -import java.util.Map; -import mockit.Deencapsulation; -import org.junit.Test; - -public class ComponentMonitoringUploadInfoTest { +class ComponentMonitoringUploadInfoTest { @Test - public void testGetSnmpTrap() { - ComponentMonitoringUploadInfo uploadInfo = new ComponentMonitoringUploadInfo(); + void testGetSnmpTrap() { + final ComponentMonitoringUploadInfo uploadInfo = new ComponentMonitoringUploadInfo(); setInternals(uploadInfo); - - assertThat(uploadInfo.getSnmpTrap(), isA(MonitoringArtifactInfo.class)); + Assertions.assertTrue(uploadInfo.getSnmpTrap() instanceof MonitoringArtifactInfo); } @Test - public void testGetSnmpPoll() { - ComponentMonitoringUploadInfo uploadInfo = new ComponentMonitoringUploadInfo(); + void testGetSnmpPoll() { + final ComponentMonitoringUploadInfo uploadInfo = new ComponentMonitoringUploadInfo(); setInternals(uploadInfo); - - assertThat(uploadInfo.getSnmpPoll(), isA(MonitoringArtifactInfo.class)); + Assertions.assertTrue(uploadInfo.getSnmpPoll() instanceof MonitoringArtifactInfo); } @Test - public void testGetVesEvent() { - ComponentMonitoringUploadInfo uploadInfo = new ComponentMonitoringUploadInfo(); + void testGetVesEvent() { + final ComponentMonitoringUploadInfo uploadInfo = new ComponentMonitoringUploadInfo(); setInternals(uploadInfo); - - assertThat(uploadInfo.getVesEvent(), isA(MonitoringArtifactInfo.class)); + Assertions.assertTrue(uploadInfo.getVesEvent() instanceof MonitoringArtifactInfo); } @Test - public void testSetMonitoringArtifactFile() { - ComponentMonitoringUploadInfo uploadInfo = new ComponentMonitoringUploadInfo(); + void testSetMonitoringArtifactFile() { + final ComponentMonitoringUploadInfo uploadInfo = new ComponentMonitoringUploadInfo(); uploadInfo.setMonitoringArtifactFile(MonitoringUploadType.SNMP_POLL, new MonitoringArtifactInfo()); - - assertThat(getInternal(uploadInfo).containsKey(MonitoringUploadType.SNMP_POLL), is(true)); - } - - private Map<MonitoringUploadType, MonitoringArtifactInfo> getInternal(ComponentMonitoringUploadInfo componentMonitoringUploadInfo) { - return Deencapsulation.getField(componentMonitoringUploadInfo, "infoByType"); + Assertions.assertTrue(uploadInfo.getSnmpPoll() instanceof MonitoringArtifactInfo); } - private void setInternals(ComponentMonitoringUploadInfo componentMonitoringUploadInfo) { - Map<MonitoringUploadType, MonitoringArtifactInfo> infoMap = new HashMap<>(); - infoMap.put(MonitoringUploadType.SNMP_POLL, new MonitoringArtifactInfo()); - infoMap.put(MonitoringUploadType.SNMP_TRAP, new MonitoringArtifactInfo()); - infoMap.put(MonitoringUploadType.VES_EVENTS, new MonitoringArtifactInfo()); - Deencapsulation.setField(componentMonitoringUploadInfo, "infoByType", infoMap); + private void setInternals(final ComponentMonitoringUploadInfo componentMonitoringUploadInfo) { + componentMonitoringUploadInfo.setMonitoringArtifactFile(MonitoringUploadType.SNMP_POLL, new MonitoringArtifactInfo()); + componentMonitoringUploadInfo.setMonitoringArtifactFile(MonitoringUploadType.SNMP_TRAP, new MonitoringArtifactInfo()); + componentMonitoringUploadInfo.setMonitoringArtifactFile(MonitoringUploadType.VES_EVENTS, new MonitoringArtifactInfo()); } -}
\ No newline at end of file +} |