diff options
author | Tal Gitelman <tg851x@intl.att.com> | 2018-06-06 19:15:13 +0300 |
---|---|---|
committer | Tal Gitelman <tg851x@intl.att.com> | 2018-06-06 17:15:27 +0000 |
commit | cd0672f83bef9965fe3f109e43d78c65d321544b (patch) | |
tree | e0bb21a9050d856a4034a9b9dbd558d646d636f0 /catalog-model/src/main/java/org | |
parent | e3fcd5c1b090bee890ad4b2f1363ebd6c8391410 (diff) |
new unit tests for sdc-model
Change-Id: I14b1d527b18b354b8c29149135a1dbb800a454bb
Issue-ID: SDC-1333
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-model/src/main/java/org')
3 files changed, 13 insertions, 34 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java index 6292218837..7cd57be442 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java @@ -45,8 +45,8 @@ public class PropertyDefinition extends PropertyDataDefinition AVAILABILTY_ZONE_COUNT("availability_zone_count", GroupInstancePropertyValueUpdateBehavior.UPDATABLE_ON_SERVICE_LEVEL), VFC_LIST("vfc_list", GroupInstancePropertyValueUpdateBehavior.UPDATABLE_ON_SERVICE_LEVEL); - private String propertyName; - private GroupInstancePropertyValueUpdateBehavior updateBehavior; + private final String propertyName; + private final GroupInstancePropertyValueUpdateBehavior updateBehavior; private PropertyNames(String propertyName,GroupInstancePropertyValueUpdateBehavior updateBehavior){ this.propertyName = propertyName; @@ -84,8 +84,8 @@ public class PropertyDefinition extends PropertyDataDefinition UPDATABLE_ON_RESOURCE_LEVEL("UPDATABLE_ON_VF_LEVEL", 0), UPDATABLE_ON_SERVICE_LEVEL("UPDATABLE_ON_SERVICE_LEVEL", 1); - String levelName; - int levelNumber; + private final String levelName; + private final int levelNumber; private GroupInstancePropertyValueUpdateBehavior(String name, int levelNumber){ this.levelName = name; @@ -141,25 +141,6 @@ public class PropertyDefinition extends PropertyDataDefinition + constraints + "]]"; } - // public void setSchema(Schema entrySchema) { - // this.schema = entrySchema; - // - // } - // - // public Schema getSchema() { - // return schema; - // } - -// public String getStatus() { -// return status; -// } -// -// public void setStatus(String status) { -// this.status = status; -// } - - - @Override public boolean isDefinition() { return false; @@ -198,11 +179,6 @@ public class PropertyDefinition extends PropertyDataDefinition return false; } else if (!getName().equals(other.getName())) return false; -// if (status == null) { -// if (other.status != null) -// return false; -// } else if (!status.equals(other.status)) -// return false; return true; } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java index 917678380b..58efa5689e 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java @@ -23,6 +23,7 @@ package org.openecomp.sdc.be.model; import java.io.Serializable; import java.util.List; import java.util.Map; +import java.util.Optional; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.utils.MapUtil; @@ -324,8 +325,7 @@ public class Resource extends Component implements Serializable { } private String getInstanceNameFromInstanceId(Resource resource, String instId) { - return resource.getComponentInstanceById(instId).get().getName(); + Optional<ComponentInstance> componentInstanceById = resource.getComponentInstanceById(instId); + return componentInstanceById.isPresent() ? componentInstanceById.get().getName() : null; } - - } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/User.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/User.java index 129c35b708..b10214efe2 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/User.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/User.java @@ -45,9 +45,9 @@ public class User { public User() { } - public User(UserData userDate) { - this(userDate.getFirstName(), userDate.getLastName(), userDate.getUserId(), userDate.getEmail(), - userDate.getRole(), userDate.getLastLoginTime()); + public User(UserData userData) { + this(userData.getFirstName(), userData.getLastName(), userData.getUserId(), userData.getEmail(), + userData.getRole(), userData.getLastLoginTime()); } public User(String firstName, String lastName, String userId, String emailAddress, String role, @@ -62,6 +62,9 @@ public class User { } public void copyData(User other) { + if(other == null) { + return; + } this.firstName = other.getFirstName(); this.lastName = other.getLastName(); this.userId = other.getUserId(); |