diff options
author | Betzer, Rony (rb844h) <rb844h@intl.att.com> | 2018-10-14 14:18:43 +0300 |
---|---|---|
committer | Michael Lando <michael.lando@intl.att.com> | 2018-10-15 08:49:34 +0000 |
commit | dd9576c7ac5b05c774b85062617a957a52c24b53 (patch) | |
tree | 2298747137d8f9162068f40a1cab9d1bca088eec /src/main | |
parent | 0480c02475da8066748103251f854ecad774a265 (diff) |
increase coverage - added getter and setter tests
increase coverage - added getter and setter tests
Change-Id: I6546636666d41229898bca1eeb1740aff04ec8c3
Issue-ID: DCAEGEN2-839
Signed-off-by: Betzer, Rony (rb844h) <rb844h@intl.att.com>
Diffstat (limited to 'src/main')
15 files changed, 127 insertions, 26 deletions
diff --git a/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerAudit.java b/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerAudit.java index f6e2c98..d4cc26d 100644 --- a/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerAudit.java +++ b/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerAudit.java @@ -18,6 +18,8 @@ public class OnapLoggerAudit extends OnapLoggerBase { logger = LoggerFactory.getLogger(this.getClass().getName()); } + OnapLoggerAudit(){} + public static OnapLoggerAudit getInstance() { return instanceLoggerAudit; } diff --git a/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerBase.java b/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerBase.java index 70d5973..5e8f841 100644 --- a/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerBase.java +++ b/src/main/java/org/onap/sdc/common/onaplog/OnapLoggerBase.java @@ -27,6 +27,8 @@ public abstract class OnapLoggerBase implements IOnapLogger { this.myMarker = marker; } + OnapLoggerBase(){} + @Override public void log(LogLevel errorLevel, String className, String message, Object... args) { MDC.put("ClassName", className); diff --git a/src/main/java/org/onap/sdc/common/onaplog/Stopwatch.java b/src/main/java/org/onap/sdc/common/onaplog/Stopwatch.java index de56853..20582b9 100644 --- a/src/main/java/org/onap/sdc/common/onaplog/Stopwatch.java +++ b/src/main/java/org/onap/sdc/common/onaplog/Stopwatch.java @@ -11,10 +11,10 @@ import java.time.Duration; import java.time.LocalDateTime; /** - * Created by dd4296 on 12/13/2017. * this is local implementation of the stopwatch class from EELF standard with the same interface * can be replaced if needed with EELF lib */ + public class Stopwatch implements IStopWatch { private static final Logger log = LoggerFactory.getLogger(Stopwatch.class.getName()); diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/CreateMcResponse.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/CreateMcResponse.java index 49248f9..e6bda39 100644 --- a/src/main/java/org/onap/sdc/dcae/composition/restmodels/CreateMcResponse.java +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/CreateMcResponse.java @@ -30,4 +30,6 @@ public class CreateMcResponse { this.vfcmt = vfcmt; this.cdump = cdump; } + + CreateMcResponse(){} } diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/MessageResponse.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/MessageResponse.java index e498097..df87ea5 100644 --- a/src/main/java/org/onap/sdc/dcae/composition/restmodels/MessageResponse.java +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/MessageResponse.java @@ -2,7 +2,7 @@ package org.onap.sdc.dcae.composition.restmodels; import com.fasterxml.jackson.annotation.JsonProperty; -public class MessageResponse{ +public class MessageResponse { @JsonProperty("errorResponse") private String errorResponse; diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/MonitoringComponent.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/MonitoringComponent.java index 09777a5..2372836 100644 --- a/src/main/java/org/onap/sdc/dcae/composition/restmodels/MonitoringComponent.java +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/MonitoringComponent.java @@ -1,10 +1,10 @@ package org.onap.sdc.dcae.composition.restmodels; -import com.fasterxml.jackson.annotation.JsonInclude; import org.onap.sdc.dcae.composition.restmodels.sdc.ResourceDetailed; import org.onap.sdc.dcae.composition.util.DcaeBeConstants; -@JsonInclude(JsonInclude.Include.NON_NULL) +import java.util.Objects; + public class MonitoringComponent { // VFCMT metadata @@ -22,6 +22,11 @@ public class MonitoringComponent { // The name of the vfi monitored by the VFCMT private String vfiName; + // 1810 US436244 add invariantUuid, submittedUuid to MC data + private String invariantUUID; + private String submittedUuid; + + public MonitoringComponent(ResourceDetailed mc, String vfiName) { this.uuid = mc.getUuid(); this.name = mc.getName(); @@ -29,7 +34,12 @@ public class MonitoringComponent { this.lastUpdaterUserId = mc.getLastUpdaterUserId(); this.description = mc.getDescription(); this.lifecycleState = mc.getLifecycleState(); - this.status = DcaeBeConstants.LifecycleStateEnum.CERTIFIED == DcaeBeConstants.LifecycleStateEnum.findState(lifecycleState) ? "Submitted" : "Not Submitted"; + this.invariantUUID = mc.getInvariantUUID(); + this.status = "Not Submitted"; + if(DcaeBeConstants.LifecycleStateEnum.CERTIFIED == DcaeBeConstants.LifecycleStateEnum.findState(lifecycleState)) { + this.submittedUuid = mc.getUuid(); + this.status = "Submitted"; + } this.vfiName = vfiName; } @@ -73,6 +83,16 @@ public class MonitoringComponent { return lifecycleState; } + public String getSubmittedUuid() { return submittedUuid; } + + public String getInvariantUUID() { + return invariantUUID; + } + + public void setInvariantUUID(String invariantUUID) { + this.invariantUUID = invariantUUID; + } + public void setVfiName(String vfiName) { this.vfiName = vfiName; } @@ -93,4 +113,51 @@ public class MonitoringComponent { this.lifecycleState = lifecycleState; } + public void setSubmittedUuid(String submittedUuid) { this.submittedUuid = submittedUuid; } + + public void setStatus(String status) { this.status = status; } + + public void setLastUpdaterUserId(String lastUpdaterUserId) { + this.lastUpdaterUserId = lastUpdaterUserId; + } + + public void setVersion(String version) { + this.version = version; + } + + + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + if (null == obj || getClass() != obj.getClass()) { + return false; + } + MonitoringComponent other = (MonitoringComponent) obj; + return Objects.equals(status, other.status) && Objects.equals(vfiName, other.vfiName) && dataFieldsEqual(other); + + } + + @Override + public int hashCode() { + return Objects.hash(uuid, name, version, lastUpdaterUserId, lifecycleState, status, vfiName, invariantUUID, submittedUuid); + } + + + private boolean resourceFieldsEqual(MonitoringComponent other) { + return Objects.equals(lastUpdaterUserId, other.lastUpdaterUserId) && Objects.equals(name, other.name) && Objects.equals(description, other.description); + } + + private boolean lifecycleFieldsEqual(MonitoringComponent other) { + return Objects.equals(uuid, other.uuid) && Objects.equals(version, other.version) && Objects.equals(lifecycleState, other.lifecycleState); + } + + private boolean additionalUuidFieldsEqual(MonitoringComponent other) { + return Objects.equals(invariantUUID, other.invariantUUID) && Objects.equals(submittedUuid, other.submittedUuid); + } + + private boolean dataFieldsEqual(MonitoringComponent other) { + return resourceFieldsEqual(other) && lifecycleFieldsEqual(other) && additionalUuidFieldsEqual(other); + } } diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ReferenceUUID.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ReferenceUUID.java index 19bf0b7..54bfa6d 100644 --- a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ReferenceUUID.java +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ReferenceUUID.java @@ -11,6 +11,8 @@ public class ReferenceUUID { this.referenceUUID = referenceUUID; } + ReferenceUUID(){} + public String getReferenceUUID() { return referenceUUID; } diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/VfcmtData.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/VfcmtData.java index 6c7a65e..e0a038a 100644 --- a/src/main/java/org/onap/sdc/dcae/composition/restmodels/VfcmtData.java +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/VfcmtData.java @@ -1,14 +1,14 @@ package org.onap.sdc.dcae.composition.restmodels; +import com.fasterxml.jackson.annotation.JsonInclude; import org.onap.sdc.dcae.composition.restmodels.sdc.ResourceDetailed; +@JsonInclude(JsonInclude.Include.NON_NULL) public class VfcmtData extends MonitoringComponent { private String flowType; private String serviceUuid; - private String invariantUUID; - public VfcmtData(ResourceDetailed vfcmt) { setUuid(vfcmt.getUuid()); setName(vfcmt.getName()); @@ -28,6 +28,8 @@ public class VfcmtData extends MonitoringComponent { setServiceUuid(serviceUuid); } + VfcmtData(){} + public String getFlowType() { return flowType; } @@ -44,13 +46,4 @@ public class VfcmtData extends MonitoringComponent { this.serviceUuid = serviceUuid; } - public String getInvariantUUID() { - return invariantUUID; - } - - public void setInvariantUUID(String invariantUUID) { - this.invariantUUID = invariantUUID; - } - - } diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ApplyFilterRequest.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ApplyFilterRequest.java index eba446e..1c08a73 100644 --- a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ApplyFilterRequest.java +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ApplyFilterRequest.java @@ -35,4 +35,6 @@ public class ApplyFilterRequest extends TranslateRequest { super(vfcmtUuid, dcaeCompLabel, nid, configParam, notifyId, entryPhase, publishPhase); this.filter = filter; } + + ApplyFilterRequest(){} } diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/EventTypeDefinitionUI.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/EventTypeDefinitionUI.java index 667eb03..4b2139f 100644 --- a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/EventTypeDefinitionUI.java +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/EventTypeDefinitionUI.java @@ -24,27 +24,45 @@ public class EventTypeDefinitionUI { .collect(Collectors.toList()); } + EventTypeDefinitionUI(){} + public String getName() { return name; } + public void setName(String name) { + this.name = name; + } public List<EventTypeDefinitionUI> getChildren() { return children; } + public void setChildren(List<EventTypeDefinitionUI> children) { + this.children = children; + } public Boolean getIsRequired() { return isRequired; } + public void setIsRequired(Boolean isRequired) { + this.isRequired = isRequired; + } public List<String> getRequiredChildren() { return requiredChildren; } + public void setRequiredChildren(List<String> requiredChildren) { + this.requiredChildren = requiredChildren; + } public String getId() { return id; } + + public void setId(String id) { + this.id = id; + } } diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/EventTypesByVersionUI.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/EventTypesByVersionUI.java index ed77144..56ac7d9 100644 --- a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/EventTypesByVersionUI.java +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/EventTypesByVersionUI.java @@ -10,7 +10,9 @@ public class EventTypesByVersionUI { private String version; private Set<String> eventTypes; - + + EventTypesByVersionUI(){} + public EventTypesByVersionUI(String version, Set<String> eventTypes) { super(); this.version = version; @@ -24,5 +26,13 @@ public class EventTypesByVersionUI { public Set<String> getEventTypes() { return eventTypes; } + + public void setVersion(String version) { + this.version = version; + } + + public void setEventTypes(Set<String> eventTypes) { + this.eventTypes = eventTypes; + } } diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ImportPhaseRequest.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ImportPhaseRequest.java index 985b53d..445f081 100644 --- a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ImportPhaseRequest.java +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ImportPhaseRequest.java @@ -8,15 +8,6 @@ public class ImportPhaseRequest extends RuleEditorRequest { private String eventType; private MappingRulesResponse payload; -// public ImportPhaseRequest(String vfcmtUuid, String dcaeCompLabel, String nid, String configParam, String groupId, String phase, String version, String eventType) { -// super(vfcmtUuid, dcaeCompLabel, nid, configParam); -// this.groupId = groupId; -// this.phase = phase; -// // validation performed against selected VES version/eventType -// this.version = version; -// this.eventType = eventType; -// } - public String getGroupId() { return groupId; } diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/LogEventAction.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/LogEventAction.java index e3ccd44..909e6c9 100644 --- a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/LogEventAction.java +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/LogEventAction.java @@ -28,6 +28,10 @@ public class LogEventAction extends BaseAction { return logEvent; } + public void setLogEvent(LogEvent logEvent) { + this.logEvent = logEvent; + } + public String logTitle() { return logEvent.title; } diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/LogTextAction.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/LogTextAction.java index 16d2a9a..97f3744 100644 --- a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/LogTextAction.java +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/LogTextAction.java @@ -45,6 +45,10 @@ public class LogTextAction extends BaseAction { return logText; } + public void setLogText(LogText logText) { + this.logText = logText; + } + public String logName() { return logText.name; } diff --git a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ReplaceTextAction.java b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ReplaceTextAction.java index 5594d73..f765563 100644 --- a/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ReplaceTextAction.java +++ b/src/main/java/org/onap/sdc/dcae/composition/restmodels/ruleeditor/ReplaceTextAction.java @@ -40,6 +40,10 @@ public class ReplaceTextAction extends UnaryFieldAction { return replaceText; } + public void setReplaceText(ReplaceText replaceText) { + this.replaceText = replaceText; + } + public String find() { return replaceText.find; } |