aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-dao/src/main/java/org/openecomp
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/main/java/org/openecomp
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/main/java/org/openecomp')
-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
3 files changed, 10 insertions, 22 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() {