summaryrefslogtreecommitdiffstats
path: root/catalog-dao/src
diff options
context:
space:
mode:
authorTal Gitelman <tg851x@intl.att.com>2018-06-03 17:14:51 +0300
committerTal Gitelman <tg851x@intl.att.com>2018-06-03 17:15:45 +0300
commit06b1f35479a40194c6d84c38cc1215ae76b81ba6 (patch)
tree99f1da66ec9014a69df68bb30281aa2d24c9697f /catalog-dao/src
parent5ed3340e27b3ab90fb617fac13dbd578285b519d (diff)
new unit tests for sdc-dao
Change-Id: I78124626e54cf578f0cb4459ee26591cab4af24f Issue-ID: SDC-1333 Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-dao/src')
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditRecordFactory.java6
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java19
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGenericEvent.java7
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuditRecordFactoryTest.java30
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnumTest.java39
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGetUebClusterEventTest.java11
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuthEventTest.java12
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/CategoryEventTest.java10
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/ConsumerEventTest.java7
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDeployEventTest.java8
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDownloadEventTest.java8
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionEngineEventTest.java7
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionNotificationEventTest.java35
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionStatusEventTest.java7
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/EcompOperationalEnvironmentEventTest.java178
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEventTest.java8
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/GetCategoryHierarchyEventTest.java7
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/GetUsersListEventTest.java7
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/ResourceAdminEventTest.java59
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/UserAccessEventTest.java15
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/UserAdminEventTest.java7
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/CommonAuditDataTest.java48
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceAuditDataTest.java35
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/CategoryDataTest.java6
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/GroupingDataTest.java6
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/SubCategoryDataTest.java6
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/exception/ResourceDAOExceptionTest.java7
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/impl/ResourceUploaderTest.java230
28 files changed, 742 insertions, 83 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditRecordFactory.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditRecordFactory.java
index 09d37ac03d..bae33384e4 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditRecordFactory.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditRecordFactory.java
@@ -26,8 +26,14 @@ import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum;
public final class AuditRecordFactory {
public static AuditingGenericEvent createAuditRecord(Map<AuditingFieldsKeysEnum, Object> auditingFields) {
+ if (auditingFields == null) {
+ return null;
+ }
AuditingActionEnum actionEnum = AuditingActionEnum
.getActionByName((String) auditingFields.get(AuditingFieldsKeysEnum.AUDIT_ACTION));
+ if (actionEnum == null) {
+ return null;
+ }
String tableName = actionEnum.getAuditingEsType();
AuditingGenericEvent event = null;
switch (tableName) {
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java
index e810925fcd..0c1352f4ec 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java
@@ -104,19 +104,12 @@ public enum AuditingActionEnum {
GET_ASSET_METADATA("GetAssetMetadata", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE),
GET_TOSCA_MODEL("GetToscaModel", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE);
- private String name;
- // private Class<? extends AuditingGenericEvent> auditingEsType;
- private String auditingEsType;
+ private final String name;
+ private final String auditingEsType;
private static Logger log = LoggerFactory.getLogger(AuditingActionEnum.class.getName());
- // AuditingActionEnum(String name, Class<? extends AuditingGenericEvent>
- // auditingEsType){
- // this.name = name;
- // this.auditingEsType = auditingEsType;
- // }
-
- AuditingActionEnum(String name, String auditingEsType) {
+ private AuditingActionEnum(String name, String auditingEsType) {
this.name = name;
this.auditingEsType = auditingEsType;
}
@@ -125,15 +118,11 @@ public enum AuditingActionEnum {
return name;
}
- // public Class<? extends AuditingGenericEvent> getAuditingEsType(){
- // return auditingEsType;
- // }
-
public String getAuditingEsType() {
return auditingEsType;
}
- public static AuditingActionEnum getActionByName(String name) {
+ public static AuditingActionEnum getActionByName(String name) {
AuditingActionEnum res = null;
AuditingActionEnum[] values = values();
for (AuditingActionEnum value : values) {
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGenericEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGenericEvent.java
index 9e220bf8da..7789e47766 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGenericEvent.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGenericEvent.java
@@ -76,13 +76,6 @@ public class AuditingGenericEvent extends ESTimeBasedEvent {
public void setDesc(String desc) {
this.desc = desc;
}
- // public Map<String, Object> getFields() {
- // return fields;
- // }
- //
- // public void setFields(Map<String, Object> fields) {
- // this.fields = fields;
- // }
public void fillFields() {
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuditRecordFactoryTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuditRecordFactoryTest.java
new file mode 100644
index 0000000000..ac3b912d64
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuditRecordFactoryTest.java
@@ -0,0 +1,30 @@
+package org.openecomp.sdc.be.resources.data.auditing;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.openecomp.sdc.common.datastructure.AuditingFieldsKeysEnum;
+
+public class AuditRecordFactoryTest {
+
+ private AuditRecordFactory createTestSubject() {
+ return new AuditRecordFactory();
+ }
+
+ @Test
+ public void testCreateAuditRecord() throws Exception {
+ Map<AuditingFieldsKeysEnum, Object> auditingFields = new HashMap<>();
+ AuditingGenericEvent result;
+
+ // default test
+ result = AuditRecordFactory.createAuditRecord(null);
+ result = AuditRecordFactory.createAuditRecord(auditingFields);
+
+ for (AuditingActionEnum iterable_element : AuditingActionEnum.values()) {
+ auditingFields = new HashMap<>();
+ auditingFields.put(AuditingFieldsKeysEnum.AUDIT_ACTION, iterable_element.getName());
+ result = AuditRecordFactory.createAuditRecord(auditingFields);
+ }
+ }
+} \ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnumTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnumTest.java
new file mode 100644
index 0000000000..7bd05b71b2
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnumTest.java
@@ -0,0 +1,39 @@
+package org.openecomp.sdc.be.resources.data.auditing;
+
+import org.junit.Test;
+
+public class AuditingActionEnumTest {
+
+ private AuditingActionEnum createTestSubject() {
+ return AuditingActionEnum.ACTIVATE_SERVICE_BY_API;
+ }
+
+ @Test
+ public void testGetName() throws Exception {
+ AuditingActionEnum testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getName();
+ }
+
+ @Test
+ public void testGetAuditingEsType() throws Exception {
+ AuditingActionEnum testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getAuditingEsType();
+ }
+
+ @Test
+ public void testGetActionByName() throws Exception {
+ String name = "";
+ AuditingActionEnum result;
+
+ // default test
+ result = AuditingActionEnum.getActionByName(name);
+ }
+} \ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGetUebClusterEventTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGetUebClusterEventTest.java
index 72ccc52b88..a277ca8fbd 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGetUebClusterEventTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGetUebClusterEventTest.java
@@ -1,9 +1,12 @@
package org.openecomp.sdc.be.resources.data.auditing;
import java.util.Date;
+import java.util.HashMap;
import java.util.UUID;
import org.junit.Test;
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder;
public class AuditingGetUebClusterEventTest {
@@ -12,6 +15,14 @@ public class AuditingGetUebClusterEventTest {
}
@Test
+ public void testCtor() throws Exception {
+ new AuditingGetUebClusterEvent(new HashMap<>());
+ Builder newBuilder = CommonAuditData.newBuilder();
+ CommonAuditData build = newBuilder.build();
+ new AuditingGetUebClusterEvent("mock", build, "mock");
+ }
+
+ @Test
public void testFillFields() throws Exception {
AuditingGetUebClusterEvent testSubject;
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuthEventTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuthEventTest.java
index 39de467030..1e715cae00 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuthEventTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/AuthEventTest.java
@@ -1,16 +1,26 @@
package org.openecomp.sdc.be.resources.data.auditing;
import java.util.Date;
+import java.util.HashMap;
import java.util.UUID;
import org.junit.Test;
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder;
public class AuthEventTest {
private AuthEvent createTestSubject() {
return new AuthEvent();
}
-
+
+ @Test
+ public void testCtor() throws Exception {
+ new AuthEvent(new HashMap<>());
+ Builder newBuilder = CommonAuditData.newBuilder();
+ new AuthEvent("mock", newBuilder.build(), "mock", "mock", "mock", "mock");
+ }
+
@Test
public void testGetUrl() throws Exception {
AuthEvent testSubject;
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/CategoryEventTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/CategoryEventTest.java
index 3e508307ed..bd36f3a789 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/CategoryEventTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/CategoryEventTest.java
@@ -1,9 +1,12 @@
package org.openecomp.sdc.be.resources.data.auditing;
import java.util.Date;
+import java.util.HashMap;
import java.util.UUID;
import org.junit.Test;
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builder;
public class CategoryEventTest {
@@ -12,6 +15,13 @@ public class CategoryEventTest {
}
@Test
+ public void testCtor() throws Exception {
+ new CategoryEvent(new HashMap());
+ Builder newBuilder = CommonAuditData.newBuilder();
+ new CategoryEvent("mock", newBuilder.build(), "mock", "mock", "mock", "mock", "mock");
+ }
+
+ @Test
public void testFillFields() throws Exception {
CategoryEvent testSubject;
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/ConsumerEventTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/ConsumerEventTest.java
index 1f8050907a..fa8abeb093 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/ConsumerEventTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/ConsumerEventTest.java
@@ -1,9 +1,11 @@
package org.openecomp.sdc.be.resources.data.auditing;
import java.util.Date;
+import java.util.HashMap;
import java.util.UUID;
import org.junit.Test;
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
public class ConsumerEventTest {
@@ -12,6 +14,11 @@ public class ConsumerEventTest {
return new ConsumerEvent();
}
+ @Test
+ public void testCtor() throws Exception {
+ new ConsumerEvent(new HashMap<>());
+ new ConsumerEvent("mock", CommonAuditData.newBuilder().build(), "mock", "mock");
+ }
@Test
public void testFillFields() throws Exception {
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDeployEventTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDeployEventTest.java
index 11c995716b..8a27de9db4 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDeployEventTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDeployEventTest.java
@@ -1,9 +1,11 @@
package org.openecomp.sdc.be.resources.data.auditing;
import java.util.Date;
+import java.util.HashMap;
import java.util.UUID;
import org.junit.Test;
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
public class DistributionDeployEventTest {
@@ -12,6 +14,11 @@ public class DistributionDeployEventTest {
return new DistributionDeployEvent();
}
+ @Test
+ public void testCtor() throws Exception {
+ new DistributionDeployEvent(new HashMap<>());
+ new DistributionDeployEvent("mock", CommonAuditData.newBuilder().build(), "mock", "mock", "mock", "mock", "mock");
+ }
@Test
public void testFillFields() throws Exception {
@@ -264,7 +271,6 @@ public class DistributionDeployEventTest {
testSubject.setModifier(modifier);
}
-
@Test
public void testGetDid() throws Exception {
DistributionDeployEvent testSubject;
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDownloadEventTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDownloadEventTest.java
index bf005c6d06..c3e1faf257 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDownloadEventTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDownloadEventTest.java
@@ -1,9 +1,12 @@
package org.openecomp.sdc.be.resources.data.auditing;
import java.util.Date;
+import java.util.HashMap;
import java.util.UUID;
import org.junit.Test;
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
+import org.openecomp.sdc.be.resources.data.auditing.model.DistributionData;
public class DistributionDownloadEventTest {
@@ -12,6 +15,11 @@ public class DistributionDownloadEventTest {
return new DistributionDownloadEvent();
}
+ @Test
+ public void testCtor() throws Exception {
+ new DistributionDownloadEvent(new HashMap<>());
+ new DistributionDownloadEvent("mock", CommonAuditData.newBuilder().build(), new DistributionData("mock", "mock"));
+ }
@Test
public void testFillFields() throws Exception {
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionEngineEventTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionEngineEventTest.java
index 89b0ea2dba..10e61e40d5 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionEngineEventTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionEngineEventTest.java
@@ -1,9 +1,11 @@
package org.openecomp.sdc.be.resources.data.auditing;
import java.util.Date;
+import java.util.HashMap;
import java.util.UUID;
import org.junit.Test;
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
public class DistributionEngineEventTest {
@@ -12,6 +14,11 @@ public class DistributionEngineEventTest {
return new DistributionEngineEvent();
}
+ @Test
+ public void testCtor() throws Exception {
+ new DistributionEngineEvent(new HashMap<>());
+ new DistributionEngineEvent("mock", CommonAuditData.newBuilder().build(), "mock", "mock", "mock", "mock", "mock", "mock");
+ }
@Test
public void testFillFields() throws Exception {
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionNotificationEventTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionNotificationEventTest.java
index c9934271ad..102c7c4d1c 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionNotificationEventTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionNotificationEventTest.java
@@ -1,9 +1,12 @@
package org.openecomp.sdc.be.resources.data.auditing;
import java.util.Date;
+import java.util.HashMap;
import java.util.UUID;
import org.junit.Test;
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
+import org.openecomp.sdc.be.resources.data.auditing.model.OperationalEnvAuditData;
public class DistributionNotificationEventTest {
@@ -11,6 +14,11 @@ public class DistributionNotificationEventTest {
return new DistributionNotificationEvent();
}
+ @Test
+ public void testCtor() throws Exception {
+ new DistributionNotificationEvent(new HashMap<>());
+ new DistributionNotificationEvent("mock", CommonAuditData.newBuilder().build(), "mock", "mock", "mock", "mock", "mock", "mock", "mock", new OperationalEnvAuditData("mock", "mock", "mock"));
+ }
@Test
public void testFillFields() throws Exception {
@@ -339,4 +347,31 @@ public class DistributionNotificationEventTest {
testSubject = createTestSubject();
result = testSubject.toString();
}
+
+ @Test
+ public void testSetVnfWorkloadContext() throws Exception {
+ DistributionNotificationEvent testSubject;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setVnfWorkloadContext("mock");
+ }
+
+ @Test
+ public void testSetEnvId() throws Exception {
+ DistributionNotificationEvent testSubject;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setEnvId("mock");
+ }
+
+ @Test
+ public void testSetTenant() throws Exception {
+ DistributionNotificationEvent testSubject;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setTenant("mock");
+ }
} \ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionStatusEventTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionStatusEventTest.java
index 04ebe334cf..d266135671 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionStatusEventTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/DistributionStatusEventTest.java
@@ -1,9 +1,11 @@
package org.openecomp.sdc.be.resources.data.auditing;
import java.util.Date;
+import java.util.HashMap;
import java.util.UUID;
import org.junit.Test;
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
public class DistributionStatusEventTest {
@@ -12,6 +14,11 @@ public class DistributionStatusEventTest {
return new DistributionStatusEvent();
}
+ @Test
+ public void testCtor() throws Exception {
+ new DistributionStatusEvent(new HashMap<>());
+ new DistributionStatusEvent("mock", CommonAuditData.newBuilder().build(), "mock", "mock", "mock", "mock", "mock");
+ }
@Test
public void testFillFields() throws Exception {
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/EcompOperationalEnvironmentEventTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/EcompOperationalEnvironmentEventTest.java
new file mode 100644
index 0000000000..ed047f85c6
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/EcompOperationalEnvironmentEventTest.java
@@ -0,0 +1,178 @@
+package org.openecomp.sdc.be.resources.data.auditing;
+
+import java.util.Date;
+import java.util.HashMap;
+
+import org.junit.Test;
+
+public class EcompOperationalEnvironmentEventTest {
+
+ private EcompOperationalEnvironmentEvent createTestSubject() {
+ return new EcompOperationalEnvironmentEvent();
+ }
+
+ @Test
+ public void testCtor() throws Exception {
+ new EcompOperationalEnvironmentEvent(new HashMap<>());
+ new EcompOperationalEnvironmentEvent("mock", "mock", "mock", "mock", "mock", "mock");
+ }
+
+ @Test
+ public void testGetOperationalEnvironmentId() throws Exception {
+ EcompOperationalEnvironmentEvent testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOperationalEnvironmentId();
+ }
+
+ @Test
+ public void testSetOperationalEnvironmentId() throws Exception {
+ EcompOperationalEnvironmentEvent testSubject;
+ String operationalEnvironmentId = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOperationalEnvironmentId(operationalEnvironmentId);
+ }
+
+ @Test
+ public void testGetOperationalEnvironmentAction() throws Exception {
+ EcompOperationalEnvironmentEvent testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOperationalEnvironmentAction();
+ }
+
+ @Test
+ public void testSetOperationalEnvironmentAction() throws Exception {
+ EcompOperationalEnvironmentEvent testSubject;
+ String operationalEnvironmentAction = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOperationalEnvironmentAction(operationalEnvironmentAction);
+ }
+
+ @Test
+ public void testGetOperationalEnvironmentName() throws Exception {
+ EcompOperationalEnvironmentEvent testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOperationalEnvironmentName();
+ }
+
+ @Test
+ public void testSetOperationalEnvironmentName() throws Exception {
+ EcompOperationalEnvironmentEvent testSubject;
+ String operationalEnvironmentName = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOperationalEnvironmentName(operationalEnvironmentName);
+ }
+
+ @Test
+ public void testGetOperationalEnvironmentType() throws Exception {
+ EcompOperationalEnvironmentEvent testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOperationalEnvironmentType();
+ }
+
+ @Test
+ public void testSetOperational_environment_type() throws Exception {
+ EcompOperationalEnvironmentEvent testSubject;
+ String operationalEnvironmentType = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOperational_environment_type(operationalEnvironmentType);
+ }
+
+ @Test
+ public void testGetTenantContext() throws Exception {
+ EcompOperationalEnvironmentEvent testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getTenantContext();
+ }
+
+ @Test
+ public void testSetTenantContext() throws Exception {
+ EcompOperationalEnvironmentEvent testSubject;
+ String tenantContext = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setTenantContext(tenantContext);
+ }
+
+ @Test
+ public void testGetTimestamp1() throws Exception {
+ EcompOperationalEnvironmentEvent testSubject;
+ Date result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getTimestamp1();
+ }
+
+ @Test
+ public void testSetTimestamp1() throws Exception {
+ EcompOperationalEnvironmentEvent testSubject;
+ Date timestamp = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setTimestamp1(timestamp);
+ }
+
+ @Test
+ public void testGetAction() throws Exception {
+ EcompOperationalEnvironmentEvent testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getAction();
+ }
+
+ @Test
+ public void testSetAction() throws Exception {
+ EcompOperationalEnvironmentEvent testSubject;
+ String action = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setAction(action);
+ }
+
+ @Test
+ public void testFillFields() throws Exception {
+ EcompOperationalEnvironmentEvent testSubject;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.fillFields();
+ }
+
+ @Test
+ public void testToString() throws Exception {
+ EcompOperationalEnvironmentEvent testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.toString();
+ }
+} \ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEventTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEventTest.java
index 58ef795885..33e86ea6d9 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEventTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEventTest.java
@@ -1,9 +1,12 @@
package org.openecomp.sdc.be.resources.data.auditing;
import java.util.Date;
+import java.util.HashMap;
import java.util.UUID;
import org.junit.Test;
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
+import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData;
public class ExternalApiEventTest {
@@ -12,6 +15,11 @@ public class ExternalApiEventTest {
return new ExternalApiEvent();
}
+ @Test
+ public void testCtor() throws Exception {
+ new ExternalApiEvent(new HashMap<>());
+ new ExternalApiEvent("mock", CommonAuditData.newBuilder().build(), "mock", "mock", "mock", "mock", ResourceAuditData.newBuilder().build(), ResourceAuditData.newBuilder().build(), "mock", "mock", "mock");
+ }
@Test
public void testFillFields() throws Exception {
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/GetCategoryHierarchyEventTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/GetCategoryHierarchyEventTest.java
index c63c6a80cb..fb5ed00927 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/GetCategoryHierarchyEventTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/GetCategoryHierarchyEventTest.java
@@ -1,9 +1,11 @@
package org.openecomp.sdc.be.resources.data.auditing;
import java.util.Date;
+import java.util.HashMap;
import java.util.UUID;
import org.junit.Test;
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
public class GetCategoryHierarchyEventTest {
@@ -12,6 +14,11 @@ public class GetCategoryHierarchyEventTest {
return new GetCategoryHierarchyEvent();
}
+ @Test
+ public void testCtor() throws Exception {
+ new GetCategoryHierarchyEvent(new HashMap<>());
+ new GetCategoryHierarchyEvent("mock", CommonAuditData.newBuilder().build(), "mock", "mock");
+ }
@Test
public void testFillFields() throws Exception {
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/GetUsersListEventTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/GetUsersListEventTest.java
index bde5ff7892..7214a45cbf 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/GetUsersListEventTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/GetUsersListEventTest.java
@@ -1,9 +1,11 @@
package org.openecomp.sdc.be.resources.data.auditing;
import java.util.Date;
+import java.util.HashMap;
import java.util.UUID;
import org.junit.Test;
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
public class GetUsersListEventTest {
@@ -12,6 +14,11 @@ public class GetUsersListEventTest {
return new GetUsersListEvent();
}
+ @Test
+ public void testCtor() throws Exception {
+ new GetUsersListEvent(new HashMap<>());
+ new GetUsersListEvent("mock", CommonAuditData.newBuilder().build(), "mock", "mock");
+ }
@Test
public void testFillFields() throws Exception {
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/ResourceAdminEventTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/ResourceAdminEventTest.java
index 49887fb1f9..43f9b7757f 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/ResourceAdminEventTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/ResourceAdminEventTest.java
@@ -1,10 +1,12 @@
package org.openecomp.sdc.be.resources.data.auditing;
import java.util.Date;
+import java.util.HashMap;
import java.util.UUID;
import org.junit.Test;
-
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
+import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData;
public class ResourceAdminEventTest {
@@ -12,7 +14,13 @@ public class ResourceAdminEventTest {
return new ResourceAdminEvent();
}
-
+ @Test
+ public void testCtor() throws Exception {
+ new ResourceAdminEvent(new HashMap<>());
+ new ResourceAdminEvent("mock", CommonAuditData.newBuilder().build(), ResourceAuditData.newBuilder().build(),
+ ResourceAuditData.newBuilder().build(), "mock", "mock", "mock", "mock", "mock", "mock", "mock", "mock");
+ }
+
@Test
public void testFillFields() throws Exception {
ResourceAdminEvent testSubject;
@@ -22,7 +30,6 @@ public class ResourceAdminEventTest {
testSubject.fillFields();
}
-
@Test
public void testGetResourceName() throws Exception {
ResourceAdminEvent testSubject;
@@ -33,7 +40,6 @@ public class ResourceAdminEventTest {
result = testSubject.getResourceName();
}
-
@Test
public void testSetResourceName() throws Exception {
ResourceAdminEvent testSubject;
@@ -44,7 +50,6 @@ public class ResourceAdminEventTest {
testSubject.setResourceName(resourceName);
}
-
@Test
public void testGetResourceType() throws Exception {
ResourceAdminEvent testSubject;
@@ -55,7 +60,6 @@ public class ResourceAdminEventTest {
result = testSubject.getResourceType();
}
-
@Test
public void testSetResourceType() throws Exception {
ResourceAdminEvent testSubject;
@@ -66,7 +70,6 @@ public class ResourceAdminEventTest {
testSubject.setResourceType(resourceType);
}
-
@Test
public void testGetPrevVersion() throws Exception {
ResourceAdminEvent testSubject;
@@ -77,7 +80,6 @@ public class ResourceAdminEventTest {
result = testSubject.getPrevVersion();
}
-
@Test
public void testSetPrevVersion() throws Exception {
ResourceAdminEvent testSubject;
@@ -88,7 +90,6 @@ public class ResourceAdminEventTest {
testSubject.setPrevVersion(prevVersion);
}
-
@Test
public void testGetCurrVersion() throws Exception {
ResourceAdminEvent testSubject;
@@ -99,7 +100,6 @@ public class ResourceAdminEventTest {
result = testSubject.getCurrVersion();
}
-
@Test
public void testSetCurrVersion() throws Exception {
ResourceAdminEvent testSubject;
@@ -110,7 +110,6 @@ public class ResourceAdminEventTest {
testSubject.setCurrVersion(currVersion);
}
-
@Test
public void testGetPrevState() throws Exception {
ResourceAdminEvent testSubject;
@@ -121,7 +120,6 @@ public class ResourceAdminEventTest {
result = testSubject.getPrevState();
}
-
@Test
public void testSetPrevState() throws Exception {
ResourceAdminEvent testSubject;
@@ -132,7 +130,6 @@ public class ResourceAdminEventTest {
testSubject.setPrevState(prevState);
}
-
@Test
public void testGetCurrState() throws Exception {
ResourceAdminEvent testSubject;
@@ -143,7 +140,6 @@ public class ResourceAdminEventTest {
result = testSubject.getCurrState();
}
-
@Test
public void testSetCurrState() throws Exception {
ResourceAdminEvent testSubject;
@@ -154,7 +150,6 @@ public class ResourceAdminEventTest {
testSubject.setCurrState(currState);
}
-
@Test
public void testGetTimebaseduuid() throws Exception {
ResourceAdminEvent testSubject;
@@ -165,7 +160,6 @@ public class ResourceAdminEventTest {
result = testSubject.getTimebaseduuid();
}
-
@Test
public void testSetTimebaseduuid() throws Exception {
ResourceAdminEvent testSubject;
@@ -176,7 +170,6 @@ public class ResourceAdminEventTest {
testSubject.setTimebaseduuid(timebaseduuid);
}
-
@Test
public void testGetTimestamp1() throws Exception {
ResourceAdminEvent testSubject;
@@ -187,7 +180,6 @@ public class ResourceAdminEventTest {
result = testSubject.getTimestamp1();
}
-
@Test
public void testSetTimestamp1() throws Exception {
ResourceAdminEvent testSubject;
@@ -198,7 +190,6 @@ public class ResourceAdminEventTest {
testSubject.setTimestamp1(timestamp1);
}
-
@Test
public void testGetAction() throws Exception {
ResourceAdminEvent testSubject;
@@ -209,7 +200,6 @@ public class ResourceAdminEventTest {
result = testSubject.getAction();
}
-
@Test
public void testSetAction() throws Exception {
ResourceAdminEvent testSubject;
@@ -220,7 +210,6 @@ public class ResourceAdminEventTest {
testSubject.setAction(action);
}
-
@Test
public void testGetRequestId() throws Exception {
ResourceAdminEvent testSubject;
@@ -231,7 +220,6 @@ public class ResourceAdminEventTest {
result = testSubject.getRequestId();
}
-
@Test
public void testSetRequestId() throws Exception {
ResourceAdminEvent testSubject;
@@ -242,7 +230,6 @@ public class ResourceAdminEventTest {
testSubject.setRequestId(requestId);
}
-
@Test
public void testGetServiceInstanceId() throws Exception {
ResourceAdminEvent testSubject;
@@ -253,7 +240,6 @@ public class ResourceAdminEventTest {
result = testSubject.getServiceInstanceId();
}
-
@Test
public void testSetServiceInstanceId() throws Exception {
ResourceAdminEvent testSubject;
@@ -264,7 +250,6 @@ public class ResourceAdminEventTest {
testSubject.setServiceInstanceId(serviceInstanceId);
}
-
@Test
public void testGetStatus() throws Exception {
ResourceAdminEvent testSubject;
@@ -275,7 +260,6 @@ public class ResourceAdminEventTest {
result = testSubject.getStatus();
}
-
@Test
public void testSetStatus() throws Exception {
ResourceAdminEvent testSubject;
@@ -286,7 +270,6 @@ public class ResourceAdminEventTest {
testSubject.setStatus(status);
}
-
@Test
public void testGetDesc() throws Exception {
ResourceAdminEvent testSubject;
@@ -297,7 +280,6 @@ public class ResourceAdminEventTest {
result = testSubject.getDesc();
}
-
@Test
public void testSetDesc() throws Exception {
ResourceAdminEvent testSubject;
@@ -308,7 +290,6 @@ public class ResourceAdminEventTest {
testSubject.setDesc(desc);
}
-
@Test
public void testGetModifier() throws Exception {
ResourceAdminEvent testSubject;
@@ -319,7 +300,6 @@ public class ResourceAdminEventTest {
result = testSubject.getModifier();
}
-
@Test
public void testSetModifier() throws Exception {
ResourceAdminEvent testSubject;
@@ -330,7 +310,6 @@ public class ResourceAdminEventTest {
testSubject.setModifier(modifier);
}
-
@Test
public void testGetPrevArtifactUUID() throws Exception {
ResourceAdminEvent testSubject;
@@ -341,7 +320,6 @@ public class ResourceAdminEventTest {
result = testSubject.getPrevArtifactUUID();
}
-
@Test
public void testSetPrevArtifactUUID() throws Exception {
ResourceAdminEvent testSubject;
@@ -352,7 +330,6 @@ public class ResourceAdminEventTest {
testSubject.setPrevArtifactUUID(prevArtifactUUID);
}
-
@Test
public void testGetCurrArtifactUUID() throws Exception {
ResourceAdminEvent testSubject;
@@ -363,7 +340,6 @@ public class ResourceAdminEventTest {
result = testSubject.getCurrArtifactUUID();
}
-
@Test
public void testSetCurrArtifactUUID() throws Exception {
ResourceAdminEvent testSubject;
@@ -374,7 +350,6 @@ public class ResourceAdminEventTest {
testSubject.setCurrArtifactUUID(currArtifactUUID);
}
-
@Test
public void testGetArtifactData() throws Exception {
ResourceAdminEvent testSubject;
@@ -385,7 +360,6 @@ public class ResourceAdminEventTest {
result = testSubject.getArtifactData();
}
-
@Test
public void testSetArtifactData() throws Exception {
ResourceAdminEvent testSubject;
@@ -396,7 +370,6 @@ public class ResourceAdminEventTest {
testSubject.setArtifactData(artifactData);
}
-
@Test
public void testGetDid() throws Exception {
ResourceAdminEvent testSubject;
@@ -407,7 +380,6 @@ public class ResourceAdminEventTest {
result = testSubject.getDid();
}
-
@Test
public void testSetDid() throws Exception {
ResourceAdminEvent testSubject;
@@ -418,7 +390,6 @@ public class ResourceAdminEventTest {
testSubject.setDid(did);
}
-
@Test
public void testGetDprevStatus() throws Exception {
ResourceAdminEvent testSubject;
@@ -429,7 +400,6 @@ public class ResourceAdminEventTest {
result = testSubject.getDprevStatus();
}
-
@Test
public void testSetDprevStatus() throws Exception {
ResourceAdminEvent testSubject;
@@ -440,7 +410,6 @@ public class ResourceAdminEventTest {
testSubject.setDprevStatus(dprevStatus);
}
-
@Test
public void testGetDcurrStatus() throws Exception {
ResourceAdminEvent testSubject;
@@ -451,7 +420,6 @@ public class ResourceAdminEventTest {
result = testSubject.getDcurrStatus();
}
-
@Test
public void testSetDcurrStatus() throws Exception {
ResourceAdminEvent testSubject;
@@ -462,7 +430,6 @@ public class ResourceAdminEventTest {
testSubject.setDcurrStatus(dcurrStatus);
}
-
@Test
public void testGetToscaNodeType() throws Exception {
ResourceAdminEvent testSubject;
@@ -473,7 +440,6 @@ public class ResourceAdminEventTest {
result = testSubject.getToscaNodeType();
}
-
@Test
public void testSetToscaNodeType() throws Exception {
ResourceAdminEvent testSubject;
@@ -484,7 +450,6 @@ public class ResourceAdminEventTest {
testSubject.setToscaNodeType(toscaNodeType);
}
-
@Test
public void testGetComment() throws Exception {
ResourceAdminEvent testSubject;
@@ -495,7 +460,6 @@ public class ResourceAdminEventTest {
result = testSubject.getComment();
}
-
@Test
public void testSetComment() throws Exception {
ResourceAdminEvent testSubject;
@@ -506,7 +470,6 @@ public class ResourceAdminEventTest {
testSubject.setComment(comment);
}
-
@Test
public void testGetInvariantUUID() throws Exception {
ResourceAdminEvent testSubject;
@@ -517,7 +480,6 @@ public class ResourceAdminEventTest {
result = testSubject.getInvariantUUID();
}
-
@Test
public void testSetInvariantUUID() throws Exception {
ResourceAdminEvent testSubject;
@@ -528,7 +490,6 @@ public class ResourceAdminEventTest {
testSubject.setInvariantUUID(invariantUUID);
}
-
@Test
public void testToString() throws Exception {
ResourceAdminEvent testSubject;
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/UserAccessEventTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/UserAccessEventTest.java
index f869bdb431..6d0fface25 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/UserAccessEventTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/UserAccessEventTest.java
@@ -1,9 +1,11 @@
package org.openecomp.sdc.be.resources.data.auditing;
import java.util.Date;
+import java.util.HashMap;
import java.util.UUID;
import org.junit.Test;
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
public class UserAccessEventTest {
@@ -12,6 +14,11 @@ public class UserAccessEventTest {
return new UserAccessEvent();
}
+ @Test
+ public void testCtor() throws Exception {
+ new UserAccessEvent(new HashMap<>());
+ new UserAccessEvent("mock", CommonAuditData.newBuilder().build(), "mock");
+ }
@Test
public void testFillFields() throws Exception {
@@ -176,6 +183,14 @@ public class UserAccessEventTest {
testSubject.setTimestamp1(timestamp);
}
+ @Test
+ public void testSetServiceInstanceId() throws Exception {
+ UserAccessEvent testSubject;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setServiceInstanceId("mock");
+ }
@Test
public void testToString() throws Exception {
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/UserAdminEventTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/UserAdminEventTest.java
index 532d31a5bc..71a02929c6 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/UserAdminEventTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/UserAdminEventTest.java
@@ -1,9 +1,11 @@
package org.openecomp.sdc.be.resources.data.auditing;
import java.util.Date;
+import java.util.HashMap;
import java.util.UUID;
import org.junit.Test;
+import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData;
public class UserAdminEventTest {
@@ -12,6 +14,11 @@ public class UserAdminEventTest {
return new UserAdminEvent();
}
+ @Test
+ public void testCtor() throws Exception {
+ new UserAdminEvent(new HashMap<>());
+ new UserAdminEvent("mock", CommonAuditData.newBuilder().build(), "mock", "mock", "mock");
+ }
@Test
public void testFillFields() throws Exception {
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/CommonAuditDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/CommonAuditDataTest.java
index eb5ee579cb..b41410edad 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/CommonAuditDataTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/CommonAuditDataTest.java
@@ -6,13 +6,9 @@ import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData.Builde
public class CommonAuditDataTest {
private CommonAuditData createTestSubject() {
- Builder newBuilder = CommonAuditData.newBuilder();
- return newBuilder.build();
+ return CommonAuditData.newBuilder().build();
}
-
-
-
@Test
public void testGetStatus() throws Exception {
CommonAuditData testSubject;
@@ -23,7 +19,6 @@ public class CommonAuditDataTest {
result = testSubject.getStatus();
}
-
@Test
public void testGetDescription() throws Exception {
CommonAuditData testSubject;
@@ -34,7 +29,6 @@ public class CommonAuditDataTest {
result = testSubject.getDescription();
}
-
@Test
public void testGetRequestId() throws Exception {
CommonAuditData testSubject;
@@ -45,7 +39,6 @@ public class CommonAuditDataTest {
result = testSubject.getRequestId();
}
-
@Test
public void testGetServiceInstanceId() throws Exception {
CommonAuditData testSubject;
@@ -56,7 +49,6 @@ public class CommonAuditDataTest {
result = testSubject.getServiceInstanceId();
}
-
@Test
public void testSetServiceInstanceId() throws Exception {
CommonAuditData testSubject;
@@ -67,7 +59,6 @@ public class CommonAuditDataTest {
testSubject.setServiceInstanceId(serviceInstanceId);
}
-
@Test
public void testNewBuilder() throws Exception {
Builder result;
@@ -75,4 +66,41 @@ public class CommonAuditDataTest {
// default test
result = CommonAuditData.newBuilder();
}
+
+ @Test
+ public void testDescription() throws Exception {
+ Builder result;
+
+ // default test
+ result = CommonAuditData.newBuilder();
+ result.description("mock");
+ }
+
+ @Test
+ public void testStatus() throws Exception {
+ Builder result;
+
+ // default test
+ result = CommonAuditData.newBuilder();
+ result.status(1);
+ result.status("mock");
+ }
+
+ @Test
+ public void testRequestId() throws Exception {
+ Builder result;
+
+ // default test
+ result = CommonAuditData.newBuilder();
+ result.requestId("mock");
+ }
+
+ @Test
+ public void testServiceInstanceId() throws Exception {
+ Builder result;
+
+ // default test
+ result = CommonAuditData.newBuilder();
+ result.serviceInstanceId("mock");
+ }
} \ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceAuditDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceAuditDataTest.java
index df6968da7c..42ff896caf 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceAuditDataTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceAuditDataTest.java
@@ -19,6 +19,41 @@ public class ResourceAuditDataTest {
result = ResourceAuditData.newBuilder();
}
+ @Test
+ public void testArtifactUuid() throws Exception {
+ Builder result;
+
+ // default test
+ result = ResourceAuditData.newBuilder();
+ result.artifactUuid("mock");
+ }
+
+ @Test
+ public void testState() throws Exception {
+ Builder result;
+
+ // default test
+ result = ResourceAuditData.newBuilder();
+ result.state("mock");
+ }
+
+ @Test
+ public void testvVersion() throws Exception {
+ Builder result;
+
+ // default test
+ result = ResourceAuditData.newBuilder();
+ result.version("mock");
+ }
+
+ @Test
+ public void testDistributionStatus() throws Exception {
+ Builder result;
+
+ // default test
+ result = ResourceAuditData.newBuilder();
+ result.distributionStatus("mock");
+ }
@Test
public void testGetArtifactUuid() throws Exception {
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/CategoryDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/CategoryDataTest.java
index f6f8a90a35..8f18888b6c 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/CategoryDataTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/CategoryDataTest.java
@@ -1,5 +1,6 @@
package org.openecomp.sdc.be.resources.data.category;
+import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
@@ -12,6 +13,11 @@ public class CategoryDataTest {
return new CategoryData(NodeTypeEnum.AdditionalInfoParameters);
}
+ @Test
+ public void testCtor() throws Exception {
+ new CategoryData(NodeTypeEnum.AdditionalInfoParameters, new CategoryDataDefinition());
+ new CategoryData(new HashMap<>());
+ }
@Test
public void testGetUniqueId() throws Exception {
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/GroupingDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/GroupingDataTest.java
index 89e35d0d59..0d72d3dd98 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/GroupingDataTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/GroupingDataTest.java
@@ -1,5 +1,6 @@
package org.openecomp.sdc.be.resources.data.category;
+import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
@@ -12,6 +13,11 @@ public class GroupingDataTest {
return new GroupingData(NodeTypeEnum.AdditionalInfoParameters);
}
+ @Test
+ public void testCtor() throws Exception {
+ new GroupingData(new HashMap<>());
+ new GroupingData(NodeTypeEnum.AdditionalInfoParameters, new GroupingDataDefinition());
+ }
@Test
public void testGetGroupingDataDefinition() throws Exception {
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/SubCategoryDataTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/SubCategoryDataTest.java
index c02c47926c..407488f375 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/SubCategoryDataTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/data/category/SubCategoryDataTest.java
@@ -1,5 +1,6 @@
package org.openecomp.sdc.be.resources.data.category;
+import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
@@ -12,6 +13,11 @@ public class SubCategoryDataTest {
return new SubCategoryData(NodeTypeEnum.AdditionalInfoParameters);
}
+ @Test
+ public void testCtor() throws Exception {
+ new SubCategoryData(new HashMap<>());
+ new SubCategoryData(NodeTypeEnum.AdditionalInfoParameters, new SubCategoryDataDefinition());
+ }
@Test
public void testGetSubCategoryDataDefinition() throws Exception {
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/exception/ResourceDAOExceptionTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/exception/ResourceDAOExceptionTest.java
index 71b7b4f245..7502598bfb 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/exception/ResourceDAOExceptionTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/exception/ResourceDAOExceptionTest.java
@@ -10,6 +10,13 @@ public class ResourceDAOExceptionTest {
return new ResourceDAOException("", null);
}
+ @Test
+ public void testCtor() throws Exception {
+ new ResourceDAOException("mock");
+ new ResourceDAOException("mock", new Throwable());
+ new ResourceDAOException(ResourceUploadStatus.ALREADY_EXIST, "mock");
+ new ResourceDAOException(ResourceUploadStatus.ALREADY_EXIST, "mock", new Throwable());
+ }
@Test
public void testGetStatus() throws Exception {
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/impl/ResourceUploaderTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/impl/ResourceUploaderTest.java
new file mode 100644
index 0000000000..37c0902a73
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/impl/ResourceUploaderTest.java
@@ -0,0 +1,230 @@
+package org.openecomp.sdc.be.resources.impl;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.openecomp.sdc.be.dao.api.ICatalogDAO;
+import org.openecomp.sdc.be.dao.api.ResourceUploadStatus;
+import org.openecomp.sdc.be.resources.data.ESArtifactData;
+import org.openecomp.sdc.be.resources.exception.ResourceDAOException;
+import org.openecomp.sdc.be.utils.DAOConfDependentTest;
+
+import fj.data.Either;
+import mockit.Deencapsulation;
+
+public class ResourceUploaderTest extends DAOConfDependentTest{
+
+ @InjectMocks
+ ResourceUploader testSubject;
+
+ @Mock
+ ICatalogDAO resourceDAO;
+
+ @Before
+ public void setUpMocks() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testCtor() throws Exception {
+ new ResourceUploader();
+ ICatalogDAO resourcetDAO = Mockito.mock(ICatalogDAO.class);
+ new ResourceUploader(resourcetDAO);
+ }
+
+ @Test
+ public void testInit() throws Exception {
+ // default test
+ testSubject.init();
+ }
+
+ @Test
+ public void testGetResourceDAO() throws Exception {
+ ICatalogDAO result;
+
+ // default test
+ result = testSubject.getResourceDAO();
+ }
+
+ @Test
+ public void testSetResourceDAO() throws Exception {
+ ICatalogDAO resourceDAO = null;
+
+ // default test
+ testSubject.setResourceDAO(resourceDAO);
+ }
+
+ @Test
+ public void testSaveArtifact() throws Exception {
+ ESArtifactData artifactData = new ESArtifactData();
+ artifactData.setId("mock");
+ boolean isReload = false;
+ ResourceUploadStatus result;
+
+ Either<ESArtifactData, ResourceUploadStatus> value = Either.left(new ESArtifactData());
+ Mockito.when(resourceDAO.getArtifact(Mockito.anyString())).thenReturn(value);
+
+ // default test
+ result = testSubject.saveArtifact(artifactData, isReload);
+ }
+
+ @Test
+ public void testSaveArtifact2() throws Exception {
+ ESArtifactData artifactData = new ESArtifactData();
+ artifactData.setId("mock");
+ boolean isReload = true;
+ ResourceUploadStatus result;
+
+ Either<ESArtifactData, ResourceUploadStatus> value = Either.left(new ESArtifactData());
+ Mockito.when(resourceDAO.getArtifact(Mockito.anyString())).thenReturn(value);
+
+ // default test
+ result = testSubject.saveArtifact(artifactData, isReload);
+ }
+
+ @Test
+ public void testSaveArtifactFailed() throws Exception {
+ ESArtifactData artifactData = new ESArtifactData();
+ artifactData.setId("mock");
+ boolean isReload = false;
+ ResourceUploadStatus result;
+
+ Either<ESArtifactData, ResourceUploadStatus> value = Either.right(ResourceUploadStatus.ALREADY_EXIST);
+ Mockito.when(resourceDAO.getArtifact(Mockito.anyString())).thenReturn(value);
+
+ // default test
+ result = testSubject.saveArtifact(artifactData, isReload);
+ }
+
+ @Test
+ public void testSaveArtifactFailedException() throws Exception {
+ ESArtifactData artifactData = new ESArtifactData();
+ artifactData.setId("mock");
+ boolean isReload = false;
+ ResourceUploadStatus result;
+
+ Either<ESArtifactData, ResourceUploadStatus> value = Either.right(ResourceUploadStatus.ALREADY_EXIST);
+ Mockito.when(resourceDAO.getArtifact(Mockito.anyString())).thenReturn(value);
+ Mockito.doThrow(new ResourceDAOException("mock")).when(resourceDAO).writeArtifact(Mockito.any());
+
+ // default test
+ result = testSubject.saveArtifact(artifactData, isReload);
+ }
+
+ @Test
+ public void testSaveArtifactFailedDAONull() throws Exception {
+ ESArtifactData artifactData = new ESArtifactData();
+ boolean isReload = false;
+ ResourceUploadStatus result;
+
+ // default test
+ ResourceUploader resourceUploader = new ResourceUploader(null);
+ result = resourceUploader.saveArtifact(artifactData, isReload);
+ }
+
+ @Test
+ public void testUpdateArtifact() throws Exception {
+ ESArtifactData artifactUpdateData = new ESArtifactData();
+ artifactUpdateData.setId("mock");
+ ResourceUploadStatus result;
+
+ Either<ESArtifactData, ResourceUploadStatus> value = Either.left(new ESArtifactData());
+ Mockito.when(resourceDAO.getArtifact(Mockito.anyString())).thenReturn(value);
+
+ // default test
+ result = testSubject.updateArtifact(artifactUpdateData);
+ }
+
+ @Test
+ public void testUpdateArtifactNotFound() throws Exception {
+ ESArtifactData artifactUpdateData = new ESArtifactData();
+ artifactUpdateData.setId("mock");
+ ResourceUploadStatus result;
+
+ Either<ESArtifactData, ResourceUploadStatus> value = Either.right(ResourceUploadStatus.NOT_EXIST);
+ Mockito.when(resourceDAO.getArtifact(Mockito.anyString())).thenReturn(value);
+
+ // default test
+ result = testSubject.updateArtifact(artifactUpdateData);
+ }
+
+ @Test
+ public void testUpdateArtifactException() throws Exception {
+ ESArtifactData artifactUpdateData = new ESArtifactData();
+ artifactUpdateData.setId("mock");
+ ResourceUploadStatus result;
+
+ Either<ESArtifactData, ResourceUploadStatus> value = Either.left(new ESArtifactData());
+ Mockito.when(resourceDAO.getArtifact(Mockito.anyString())).thenReturn(value);
+ Mockito.doThrow(new ResourceDAOException("mock")).when(resourceDAO).writeArtifact(Mockito.any());
+
+ // default test
+ result = testSubject.updateArtifact(artifactUpdateData);
+ }
+
+ @Test
+ public void testUpdateArtifactDAONull() throws Exception {
+ ESArtifactData artifactUpdateData = new ESArtifactData();
+ ResourceUploadStatus result;
+
+ // default test
+ ResourceUploader resourceUploader = new ResourceUploader();
+ result = resourceUploader.updateArtifact(artifactUpdateData);
+ }
+
+ @Test
+ public void testGetArtifact() throws Exception {
+ String id = "";
+ Either<ESArtifactData, ResourceUploadStatus> result;
+
+ // default test
+ result = testSubject.getArtifact(id);
+ }
+
+ @Test
+ public void testGetArtifactNull() throws Exception {
+ String id = "";
+ Either<ESArtifactData, ResourceUploadStatus> result;
+
+ // default test
+ ResourceUploader resourceUploader = new ResourceUploader();
+ result = resourceUploader.getArtifact(id);
+ }
+
+ @Test
+ public void testDeleteArtifact() throws Exception {
+ String id = "";
+
+ // default test
+ testSubject.deleteArtifact(id);
+ }
+
+ @Test
+ public void testUpdateArtifact_1() throws Exception {
+ ESArtifactData artifactUpdateData = new ESArtifactData();
+ ESArtifactData existData = new ESArtifactData();
+ ResourceUploadStatus result;
+
+ // default test
+ result = Deencapsulation.invoke(testSubject, "updateArtifact",
+ artifactUpdateData, existData);
+ }
+
+ @Test
+ public void testUpdateData() throws Exception {
+ ESArtifactData artifactUpdateData = new ESArtifactData();
+ ESArtifactData existData = new ESArtifactData();
+
+ // default test
+ Deencapsulation.invoke(testSubject, "updateData", artifactUpdateData, existData);
+ }
+
+ @Test
+ public void testDeleteAllArtifacts() throws Exception {
+ // default test
+ testSubject.deleteAllArtifacts();
+ }
+} \ No newline at end of file