aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog-be/pom.xml7
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverter.java105
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverterTest.java86
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactAccessInfoTest.java238
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactAccessListTest.java3
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactTemplateInfoTest.java5
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactTypesInfoTest.java58
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusListResponseTest.java35
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceInfoTest.java91
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceListResponceTest.java35
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java250
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupTemplateInfoTest.java74
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/info/ServicesWrapperTest.java33
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/info/ServletJsonResponseTest.java55
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/info/ToscaNodeTypeInfoTest.java115
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/info/ToscaNodeTypeInterfaceTest.java32
16 files changed, 234 insertions, 988 deletions
diff --git a/catalog-be/pom.xml b/catalog-be/pom.xml
index 2451d09e09..60a10084cd 100644
--- a/catalog-be/pom.xml
+++ b/catalog-be/pom.xml
@@ -667,6 +667,13 @@
<version>${jmockit.version}</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>com.google.code.bean-matchers</groupId>
+ <artifactId>bean-matchers</artifactId>
+ <version>0.11</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverter.java
index a5982c1f01..0f9c9be293 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverter.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverter.java
@@ -20,17 +20,17 @@
package org.openecomp.sdc.be.ecomp.converters;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
+import com.google.common.base.Strings;
+import com.google.common.collect.Sets;
+import fj.data.Either;
import org.openecomp.portalsdk.core.restful.domain.EcompRole;
import org.openecomp.portalsdk.core.restful.domain.EcompUser;
import org.openecomp.sdc.be.dao.utils.UserStatusEnum;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.user.Role;
-import fj.data.Either;
+import java.util.Iterator;
+import java.util.Objects;
public final class EcompUserConverter {
@@ -38,12 +38,41 @@ public final class EcompUserConverter {
}
public static Either<EcompUser, String> convertUserToEcompUser(User asdcUser) {
- EcompUser convertedUser = new EcompUser();
+ return (Objects.nonNull(asdcUser)) ? Either.left(convertToEcompUser(asdcUser)) : Either.right("User is null");
+ }
+
+
+ public static Either<User, String> convertEcompUserToUser(EcompUser ecompUser) {
+ return (Objects.nonNull(ecompUser)) ? Either.left(convertToUser(ecompUser)) : Either.right("EcompUser is null");
+ }
+
+ private static User convertToUser(EcompUser ecompUser) {
+ User convertedUser = new User();
+
+ convertedUser.setFirstName(ecompUser.getFirstName());
+ convertedUser.setLastName(ecompUser.getLastName());
+ convertedUser.setUserId((!isLoginIdEmpty(ecompUser) ? ecompUser.getLoginId() : ecompUser.getOrgUserId()));
+
+ convertedUser.setEmail(ecompUser.getEmail());
+
+ if (Objects.nonNull(ecompUser.getRoles())) {
+ Iterator<EcompRole> iter = ecompUser.getRoles().iterator();
- if (asdcUser == null) {
- return Either.right("User is null");
+ if (iter.hasNext()) {
+ String updatedRole = EcompRoleConverter.convertEcompRoleToRole(iter.next());
+ convertedUser.setRole(updatedRole);
+ }
}
+ convertedUser.setStatus((ecompUser.isActive()) ? UserStatusEnum.ACTIVE : UserStatusEnum.INACTIVE);
+
+
+ return convertedUser;
+ }
+
+ private static EcompUser convertToEcompUser(User asdcUser) {
+ EcompUser convertedUser = new EcompUser();
+
convertedUser.setFirstName(asdcUser.getFirstName());
convertedUser.setLastName(asdcUser.getLastName());
convertedUser.setLoginId(asdcUser.getUserId());
@@ -56,55 +85,33 @@ public final class EcompUserConverter {
convertedUser.setActive(false);
}
- EcompRole convertedRole = new EcompRole();
- for (Role role : Role.values()) {
- if (role.name().equals(asdcUser.getRole()) || role.toString().equals(asdcUser.getRole())) {
- convertedRole.setName(role.name());
- convertedRole.setId(new Long(role.ordinal()));
- break;
- }
- }
+ EcompRole convertedRole = getEcompRole(asdcUser);
- Set<EcompRole> convertedRoleSet = new HashSet<>();
- convertedRoleSet.add(convertedRole);
- convertedUser.setRoles(convertedRoleSet);
+ convertedUser.setRoles(Sets.newHashSet(convertedRole));
- return Either.left(convertedUser);
+ return convertedUser;
}
- public static Either<User, String> convertEcompUserToUser(EcompUser ecompUser) {
- User convertedUser = new User();
-
- if (ecompUser == null) {
- return Either.right("EcompUser is null");
- }
-
- convertedUser.setFirstName(ecompUser.getFirstName());
- convertedUser.setLastName(ecompUser.getLastName());
-
- if (ecompUser.getLoginId() != null && !ecompUser.getLoginId().isEmpty()) {
- convertedUser.setUserId(ecompUser.getLoginId());
- } else {
- convertedUser.setUserId(ecompUser.getOrgUserId());
- }
-
- convertedUser.setEmail(ecompUser.getEmail());
- if (ecompUser.getRoles() != null) {
- Iterator<EcompRole> iter = ecompUser.getRoles().iterator();
+ private static boolean isLoginIdEmpty(EcompUser user) {
+ return Strings.isNullOrEmpty(user.getLoginId());
+ }
- if (iter.hasNext()) {
- String updatedRole = EcompRoleConverter.convertEcompRoleToRole(iter.next());
- convertedUser.setRole(updatedRole);
+ private static EcompRole getEcompRole(User asdcUser) {
+ EcompRole convertedRole = new EcompRole();
+ for (Role role : Role.values()) {
+ if (isRolesNamesEqual(asdcUser, role)) {
+ convertedRole.setName(role.name());
+ convertedRole.setId((long) role.ordinal());
+ break;
}
}
+ return convertedRole;
+ }
- if (ecompUser.isActive()) {
- convertedUser.setStatus(UserStatusEnum.ACTIVE);
- } else {
- convertedUser.setStatus(UserStatusEnum.INACTIVE);
- }
-
- return Either.left(convertedUser);
+ private static boolean isRolesNamesEqual(User asdcUser, Role role) {
+ String asdcUserRole = asdcUser.getRole();
+ return role.name().equals(asdcUserRole) || role.toString().equals(asdcUserRole);
}
+
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverterTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverterTest.java
index fa16003792..20fa4d1bc2 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverterTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/ecomp/converters/EcompUserConverterTest.java
@@ -1,28 +1,84 @@
package org.openecomp.sdc.be.ecomp.converters;
+
+import fj.data.Either;
import org.junit.Test;
+import org.openecomp.portalsdk.core.restful.domain.EcompRole;
import org.openecomp.portalsdk.core.restful.domain.EcompUser;
import org.openecomp.sdc.be.model.User;
-import fj.data.Either;
+import java.util.Collections;
+
+import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
public class EcompUserConverterTest {
+ private static final String FIRST_NAME = "firstname";
+ private static final String LAST_NAME = "lastname";
+ private static final String USER_ID = "sample id";
+ private static final String EMAIL_ADDRESS = "sample@sample.com";
+ private static final String ROLE = "ADMIN";
+
+ private static final Long LAST_LOGIN_TIME = 12345L;
+ private static final User TEST_USER = new User(FIRST_NAME, LAST_NAME, USER_ID, EMAIL_ADDRESS, ROLE, LAST_LOGIN_TIME);
+
+
+ @Test
+ public void shouldProperlyConvertEcompUserToUser() {
+ Either<EcompUser, String> convertedUser = EcompUserConverter.convertUserToEcompUser(TEST_USER);
+
+ assertThat(convertedUser.isLeft()).isTrue();
+
+ EcompUser user = convertedUser.left().value();
+
+ assertThat(EMAIL_ADDRESS).isEqualTo(user.getEmail());
+ assertThat(FIRST_NAME).isEqualTo(user.getFirstName());
+ assertThat(LAST_NAME).isEqualTo(user.getLastName());
+ assertThat(USER_ID).isEqualTo(user.getLoginId());
+ assertThat(user.getRoles().stream().anyMatch((x) -> ROLE.equals(x.getName()))).isTrue();
+ }
+
+ @Test
+ public void shouldNotCrashWhenUserIsNotProvided() {
+ Either<EcompUser, String> convertedUser = EcompUserConverter.convertUserToEcompUser(null);
+
+ assertThat(convertedUser.isRight()).isTrue();
+ }
+
+ @Test
+ public void shouldNotCrashWhenEcompUserIsNotProvided() {
+ Either<User, String> convertedUser = EcompUserConverter.convertEcompUserToUser(null);
+
+ assertThat(convertedUser.isRight()).isTrue();
+ }
+
+ @Test
+ public void shouldProperlyConvertUserToEcompUser() {
+ Either<User, String> convertedUser = EcompUserConverter.convertEcompUserToUser(createEcompUser());
+
+ assertThat(convertedUser.isLeft()).isTrue();
+
+ User user = convertedUser.left().value();
+
+ assertThat(EMAIL_ADDRESS).isEqualTo(user.getEmail());
+ assertThat(FIRST_NAME).isEqualTo(user.getFirstName());
+ assertThat(LAST_NAME).isEqualTo(user.getLastName());
+ assertThat(USER_ID).isEqualTo(user.getUserId());
+ assertThat(ROLE).isEqualTo(user.getRole());
+ }
- @Test
- public void testConvertUserToEcompUser() throws Exception {
- User asdcUser = new User();
- Either<EcompUser, String> result;
+ private EcompUser createEcompUser() {
+ EcompUser user = new EcompUser();
- // test 1
- result = EcompUserConverter.convertUserToEcompUser(asdcUser);
- }
+ EcompRole role = new EcompRole();
- @Test
- public void testConvertEcompUserToUser() throws Exception {
- EcompUser ecompUser = new EcompUser();
- Either<User, String> result;
+ role.setName(ROLE);
+ role.setId(0L);
- // test 1
- result = EcompUserConverter.convertEcompUserToUser(ecompUser);
- }
+ user.setRoles(Collections.singleton(role));
+ user.setEmail(EMAIL_ADDRESS);
+ user.setLastName(LAST_NAME);
+ user.setFirstName(FIRST_NAME);
+ user.setOrgUserId(USER_ID);
+ return user;
+ }
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactAccessInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactAccessInfoTest.java
index c947d6258a..a6ad10a4f1 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactAccessInfoTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactAccessInfoTest.java
@@ -3,235 +3,21 @@ package org.openecomp.sdc.be.info;
import org.junit.Test;
import org.openecomp.sdc.be.resources.data.ESArtifactData;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
-public class ArtifactAccessInfoTest {
-
- private ArtifactAccessInfo createTestSubject() {
- return new ArtifactAccessInfo();
- }
-
- @Test
- public void testCtor() throws Exception {
- new ArtifactAccessInfo(new ESArtifactData());
- new ArtifactAccessInfo(new ESArtifactData(), "mock");
- }
-
- @Test
- public void testGetName() throws Exception {
- ArtifactAccessInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getName();
- }
-
-
- @Test
- public void testSetName() throws Exception {
- ArtifactAccessInfo testSubject;
- String name = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setName(name);
- }
-
-
- @Test
- public void testGetUrl() throws Exception {
- ArtifactAccessInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getUrl();
- }
-
-
- @Test
- public void testSetUrl() throws Exception {
- ArtifactAccessInfo testSubject;
- String url = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setUrl(url);
- }
-
-
- @Test
- public void testGetId() throws Exception {
- ArtifactAccessInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getId();
- }
-
-
- @Test
- public void testSetId() throws Exception {
- ArtifactAccessInfo testSubject;
- String id = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setId(id);
- }
-
-
- @Test
- public void testGetType() throws Exception {
- ArtifactAccessInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getType();
- }
-
-
- @Test
- public void testSetType() throws Exception {
- ArtifactAccessInfo testSubject;
- String type = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setType(type);
- }
-
-
- @Test
- public void testGetDescription() throws Exception {
- ArtifactAccessInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getDescription();
- }
-
- @Test
- public void testSetDescription() throws Exception {
- ArtifactAccessInfo testSubject;
- String description = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setDescription(description);
- }
-
-
- @Test
- public void testGetCreator() throws Exception {
- ArtifactAccessInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getCreator();
- }
-
-
- @Test
- public void testSetCreator() throws Exception {
- ArtifactAccessInfo testSubject;
- String creator = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setCreator(creator);
- }
-
-
- @Test
- public void testGetCreationTime() throws Exception {
- ArtifactAccessInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getCreationTime();
- }
-
-
- @Test
- public void testSetCreationTime() throws Exception {
- ArtifactAccessInfo testSubject;
- String creationTime = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setCreationTime(creationTime);
- }
-
-
- @Test
- public void testGetLastUpdater() throws Exception {
- ArtifactAccessInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getLastUpdater();
- }
-
-
- @Test
- public void testSetLastUpdater() throws Exception {
- ArtifactAccessInfo testSubject;
- String lastUpdater = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setLastUpdater(lastUpdater);
- }
-
-
- @Test
- public void testGetLastUpdateTime() throws Exception {
- ArtifactAccessInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getLastUpdateTime();
- }
-
-
- @Test
- public void testSetLastUpdateTime() throws Exception {
- ArtifactAccessInfo testSubject;
- String lastUpdateTime = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setLastUpdateTime(lastUpdateTime);
- }
-
-
- @Test
- public void testGetChecksum() throws Exception {
- ArtifactAccessInfo testSubject;
- String result;
+public class ArtifactAccessInfoTest {
- // default test
- testSubject = createTestSubject();
- result = testSubject.getChecksum();
- }
-
- @Test
- public void testSetChecksum() throws Exception {
- ArtifactAccessInfo testSubject;
- String checksum = "";
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(ArtifactAccessInfo.class, hasValidGettersAndSetters());
+ }
- // default test
- testSubject = createTestSubject();
- testSubject.setChecksum(checksum);
- }
+ @Test
+ public void testCtor() throws Exception {
+ new ArtifactAccessInfo(new ESArtifactData());
+ new ArtifactAccessInfo(new ESArtifactData(), "mock");
+ }
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactAccessListTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactAccessListTest.java
index 4c8da955ae..89be01cbfc 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactAccessListTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactAccessListTest.java
@@ -11,7 +11,6 @@ public class ArtifactAccessListTest {
return new ArtifactAccessList(null);
}
-
@Test
public void testGetArtifacts() throws Exception {
ArtifactAccessList testSubject;
@@ -22,7 +21,7 @@ public class ArtifactAccessListTest {
result = testSubject.getArtifacts();
}
-
+
@Test
public void testSetArtifacts() throws Exception {
ArtifactAccessList testSubject;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactTemplateInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactTemplateInfoTest.java
index e16540f523..8b820eaa74 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactTemplateInfoTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactTemplateInfoTest.java
@@ -1,5 +1,6 @@
package org.openecomp.sdc.be.info;
+import java.util.LinkedList;
import java.util.List;
import org.junit.Test;
@@ -11,6 +12,10 @@ public class ArtifactTemplateInfoTest {
return new ArtifactTemplateInfo();
}
+ @Test
+ public void testCtor() throws Exception {
+ new ArtifactTemplateInfo("mock", "mock", "mock", new LinkedList<>());
+ }
@Test
public void testGetType() throws Exception {
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactTypesInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactTypesInfoTest.java
index 1474d9433b..b129247acc 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactTypesInfoTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ArtifactTypesInfoTest.java
@@ -1,58 +1,14 @@
package org.openecomp.sdc.be.info;
-import java.util.List;
-
import org.junit.Test;
-import org.openecomp.sdc.be.model.ArtifactType;
-
-
-public class ArtifactTypesInfoTest {
-
- private ArtifactTypesInfo createTestSubject() {
- return new ArtifactTypesInfo();
- }
-
-
- @Test
- public void testGetArtifactTypes() throws Exception {
- ArtifactTypesInfo testSubject;
- List<ArtifactType> result;
- // default test
- testSubject = createTestSubject();
- result = testSubject.getArtifactTypes();
- }
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
-
- @Test
- public void testSetArtifactTypes() throws Exception {
- ArtifactTypesInfo testSubject;
- List<ArtifactType> artifactTypes = null;
- // default test
- testSubject = createTestSubject();
- testSubject.setArtifactTypes(artifactTypes);
- }
-
-
- @Test
- public void testGetHeatDefaultTimeout() throws Exception {
- ArtifactTypesInfo testSubject;
- Integer result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getHeatDefaultTimeout();
- }
-
-
- @Test
- public void testSetHeatDefaultTimeout() throws Exception {
- ArtifactTypesInfo testSubject;
- Integer heatDefaultTimeout = 0;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setHeatDefaultTimeout(heatDefaultTimeout);
- }
+public class ArtifactTypesInfoTest {
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(ArtifactTypesInfo.class, hasValidGettersAndSetters());
+ }
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusListResponseTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusListResponseTest.java
index 488cb31a55..74b8fdbdfa 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusListResponseTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusListResponseTest.java
@@ -1,34 +1,13 @@
package org.openecomp.sdc.be.info;
-import java.util.List;
-
import org.junit.Test;
-public class DistributionStatusListResponseTest {
-
- private DistributionStatusListResponse createTestSubject() {
- return new DistributionStatusListResponse();
- }
-
-
- @Test
- public void testGetDistributionStatusList() throws Exception {
- DistributionStatusListResponse testSubject;
- List<DistributionStatusInfo> result;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
- // default test
- testSubject = createTestSubject();
- result = testSubject.getDistributionStatusList();
- }
-
-
- @Test
- public void testSetDistributionStatusList() throws Exception {
- DistributionStatusListResponse testSubject;
- List<DistributionStatusInfo> distribStatusInfoList = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setDistributionStatusList(distribStatusInfoList);
- }
+public class DistributionStatusListResponseTest {
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(DistributionStatusListResponse.class, hasValidGettersAndSetters());
+ }
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceInfoTest.java
index 698be20124..987db462c5 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceInfoTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceInfoTest.java
@@ -2,102 +2,21 @@ package org.openecomp.sdc.be.info;
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
public class DistributionStatusOfServiceInfoTest {
- private DistributionStatusOfServiceInfo createTestSubject() {
- return new DistributionStatusOfServiceInfo();
- }
@Test
public void testCtor() throws Exception {
new DistributionStatusOfServiceInfo("","","","");
}
-
- @Test
- public void testGetDistributionID() throws Exception {
- DistributionStatusOfServiceInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getDistributionID();
- }
-
@Test
- public void testSetDistributionID() throws Exception {
- DistributionStatusOfServiceInfo testSubject;
- String distributionID = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setDistributionID(distributionID);
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(DistributionStatusOfServiceInfo.class, hasValidGettersAndSetters());
}
-
- @Test
- public void testGetTimestamp() throws Exception {
- DistributionStatusOfServiceInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getTimestamp();
- }
-
-
- @Test
- public void testSetTimestamp() throws Exception {
- DistributionStatusOfServiceInfo testSubject;
- String timestamp = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setTimestamp(timestamp);
- }
-
-
- @Test
- public void testGetUserId() throws Exception {
- DistributionStatusOfServiceInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getUserId();
- }
-
-
- @Test
- public void testSetUserId() throws Exception {
- DistributionStatusOfServiceInfo testSubject;
- String userId = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setUserId(userId);
- }
-
-
- @Test
- public void testGetDeployementStatus() throws Exception {
- DistributionStatusOfServiceInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getDeployementStatus();
- }
-
-
- @Test
- public void testSetDeployementStatus() throws Exception {
- DistributionStatusOfServiceInfo testSubject;
- String deployementStatus = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setDeployementStatus(deployementStatus);
- }
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceListResponceTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceListResponceTest.java
index 4a5964aaf6..e4d3c9bce9 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceListResponceTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/DistributionStatusOfServiceListResponceTest.java
@@ -1,35 +1,14 @@
package org.openecomp.sdc.be.info;
-import java.util.List;
-
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
-public class DistributionStatusOfServiceListResponceTest {
-
- private DistributionStatusOfServiceListResponce createTestSubject() {
- return new DistributionStatusOfServiceListResponce();
- }
-
-
- @Test
- public void testGetDistributionStatusOfServiceList() throws Exception {
- DistributionStatusOfServiceListResponce testSubject;
- List<DistributionStatusOfServiceInfo> result;
- // default test
- testSubject = createTestSubject();
- result = testSubject.getDistributionStatusOfServiceList();
- }
-
-
- @Test
- public void testSetDistributionStatusOfServiceList() throws Exception {
- DistributionStatusOfServiceListResponce testSubject;
- List<DistributionStatusOfServiceInfo> distribStatusOfServiceInfoList = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setDistributionStatusOfServiceList(distribStatusOfServiceInfoList);
- }
+public class DistributionStatusOfServiceListResponceTest {
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(DistributionStatusOfServiceListResponce.class, hasValidGettersAndSetters());
+ }
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java
index 662b96ccbf..61a27689a1 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupDefinitionInfoTest.java
@@ -1,245 +1,27 @@
package org.openecomp.sdc.be.info;
-import java.util.List;
-
import org.junit.Test;
-import org.openecomp.sdc.be.model.GroupProperty;
-
-
-public class GroupDefinitionInfoTest {
-
- private GroupDefinitionInfo createTestSubject() {
- return new GroupDefinitionInfo();
- }
-
-
- @Test
- public void testGetInvariantUUID() throws Exception {
- GroupDefinitionInfo testSubject;
- String result;
+import org.openecomp.sdc.be.model.GroupDefinition;
+import org.openecomp.sdc.be.model.GroupInstance;
- // default test
- testSubject = createTestSubject();
- result = testSubject.getInvariantUUID();
- }
+import com.google.code.beanmatchers.BeanMatchers;
+import static org.hamcrest.MatcherAssert.assertThat;
-
- @Test
- public void testSetInvariantUUID() throws Exception {
- GroupDefinitionInfo testSubject;
- String invariantUUID = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setInvariantUUID(invariantUUID);
- }
-
-
- @Test
- public void testGetName() throws Exception {
- GroupDefinitionInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getName();
- }
-
-
- @Test
- public void testSetName() throws Exception {
- GroupDefinitionInfo testSubject;
- String name = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setName(name);
- }
-
-
- @Test
- public void testGetUniqueId() throws Exception {
- GroupDefinitionInfo testSubject;
- String result;
- // default test
- testSubject = createTestSubject();
- result = testSubject.getUniqueId();
- }
-
-
- @Test
- public void testSetUniqueId() throws Exception {
- GroupDefinitionInfo testSubject;
- String uniqueId = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setUniqueId(uniqueId);
- }
-
-
- @Test
- public void testGetGroupUUID() throws Exception {
- GroupDefinitionInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getGroupUUID();
- }
-
-
- @Test
- public void testSetGroupUUID() throws Exception {
- GroupDefinitionInfo testSubject;
- String groupUUID = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setGroupUUID(groupUUID);
- }
-
-
- @Test
- public void testGetVersion() throws Exception {
- GroupDefinitionInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getVersion();
- }
-
-
- @Test
- public void testSetVersion() throws Exception {
- GroupDefinitionInfo testSubject;
- String version = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setVersion(version);
- }
-
-
- @Test
- public void testGetCustomizationUUID() throws Exception {
- GroupDefinitionInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getCustomizationUUID();
- }
-
-
- @Test
- public void testSetCustomizationUUID() throws Exception {
- GroupDefinitionInfo testSubject;
- String customizationUUID = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setCustomizationUUID(customizationUUID);
- }
-
-
- @Test
- public void testGetIsBase() throws Exception {
- GroupDefinitionInfo testSubject;
- Boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getIsBase();
- }
-
-
- @Test
- public void testSetIsBase() throws Exception {
- GroupDefinitionInfo testSubject;
- Boolean isBase = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIsBase(isBase);
- }
-
-
- @Test
- public void testGetArtifacts() throws Exception {
- GroupDefinitionInfo testSubject;
- List<ArtifactDefinitionInfo> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getArtifacts();
- }
-
-
- @Test
- public void testSetArtifacts() throws Exception {
- GroupDefinitionInfo testSubject;
- List<ArtifactDefinitionInfo> artifacts = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setArtifacts(artifacts);
- }
-
-
- @Test
- public void testGetProperties() throws Exception {
- GroupDefinitionInfo testSubject;
- List<? extends GroupProperty> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getProperties();
- }
-
-
- @Test
- public void testSetProperties() throws Exception {
- GroupDefinitionInfo testSubject;
- List<? extends GroupProperty> properties = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setProperties(properties);
- }
-
-
- @Test
- public void testGetGroupInstanceUniqueId() throws Exception {
- GroupDefinitionInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getGroupInstanceUniqueId();
- }
-
-
+public class GroupDefinitionInfoTest {
@Test
- public void testSetGroupInstanceUniqueId() throws Exception {
- GroupDefinitionInfo testSubject;
- String groupInstanceUniqueId = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setGroupInstanceUniqueId(groupInstanceUniqueId);
+ public void testCtor() {
+ new GroupDefinitionInfo(new GroupDefinition());
+ new GroupDefinitionInfo(new GroupInstance());
}
-
@Test
- public void testToString() throws Exception {
- GroupDefinitionInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.toString();
- }
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(GroupDefinitionInfo.class, BeanMatchers.hasValidGettersAndSetters());
+ }
+
+ @Test
+ public void testToString() {
+ (new GroupDefinitionInfo()).toString();
+ }
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupTemplateInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupTemplateInfoTest.java
index a77c1385a7..03573e13c6 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupTemplateInfoTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/GroupTemplateInfoTest.java
@@ -2,76 +2,16 @@ package org.openecomp.sdc.be.info;
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
-public class GroupTemplateInfoTest {
-
- private GroupTemplateInfo createTestSubject() {
- return new GroupTemplateInfo();
- }
-
-
- @Test
- public void testGetGroupName() throws Exception {
- GroupTemplateInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getGroupName();
- }
-
-
- @Test
- public void testSetGroupName() throws Exception {
- GroupTemplateInfo testSubject;
- String groupName = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setGroupName(groupName);
- }
-
- @Test
- public void testIsBase() throws Exception {
- GroupTemplateInfo testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isBase();
- }
-
-
- @Test
- public void testSetBase() throws Exception {
- GroupTemplateInfo testSubject;
- boolean isBase = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setBase(isBase);
- }
-
-
- @Test
- public void testGetArtifactTemplateInfo() throws Exception {
- GroupTemplateInfo testSubject;
- ArtifactTemplateInfo result;
+public class GroupTemplateInfoTest {
- // default test
- testSubject = createTestSubject();
- result = testSubject.getArtifactTemplateInfo();
- }
-
- @Test
- public void testSetArtifactTemplateInfo() throws Exception {
- GroupTemplateInfo testSubject;
- ArtifactTemplateInfo artifactTemplateInfo = null;
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(GroupTemplateInfo.class, hasValidGettersAndSetters());
+ }
- // default test
- testSubject = createTestSubject();
- testSubject.setArtifactTemplateInfo(artifactTemplateInfo);
- }
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServicesWrapperTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServicesWrapperTest.java
index ca0006d43c..98860586b0 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServicesWrapperTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServicesWrapperTest.java
@@ -1,35 +1,16 @@
package org.openecomp.sdc.be.info;
-import java.util.List;
-
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
-public class ServicesWrapperTest {
-
- private ServicesWrapper createTestSubject() {
- return new ServicesWrapper();
- }
-
- @Test
- public void testGetServices() throws Exception {
- ServicesWrapper testSubject;
- List<ServiceInfo> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getServices();
- }
+public class ServicesWrapperTest {
-
- @Test
- public void testSetServices() throws Exception {
- ServicesWrapper testSubject;
- List<ServiceInfo> services = null;
- // default test
- testSubject = createTestSubject();
- testSubject.setServices(services);
- }
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(ServicesWrapper.class, hasValidGettersAndSetters());
+ }
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServletJsonResponseTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServletJsonResponseTest.java
index 9b0c5fc453..f542019980 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServletJsonResponseTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ServletJsonResponseTest.java
@@ -2,54 +2,13 @@ package org.openecomp.sdc.be.info;
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
-public class ServletJsonResponseTest {
-
- private ServletJsonResponse createTestSubject() {
- return new ServletJsonResponse();
- }
-
-
- @Test
- public void testGetDescription() throws Exception {
- ServletJsonResponse testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getDescription();
- }
-
-
- @Test
- public void testSetDescription() throws Exception {
- ServletJsonResponse testSubject;
- String description = "";
- // default test
- testSubject = createTestSubject();
- testSubject.setDescription(description);
- }
-
-
- @Test
- public void testGetSource() throws Exception {
- ServletJsonResponse testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getSource();
- }
-
-
- @Test
- public void testSetSource() throws Exception {
- ServletJsonResponse testSubject;
- String source = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setSource(source);
- }
+public class ServletJsonResponseTest {
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(ServletJsonResponse.class, hasValidGettersAndSetters());
+ }
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ToscaNodeTypeInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ToscaNodeTypeInfoTest.java
index c2a1e82564..5642b2f1ef 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ToscaNodeTypeInfoTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ToscaNodeTypeInfoTest.java
@@ -1,112 +1,21 @@
package org.openecomp.sdc.be.info;
-import java.util.List;
-
import org.junit.Test;
+import com.google.code.beanmatchers.BeanMatchers;
+import static org.hamcrest.MatcherAssert.assertThat;
-public class ToscaNodeTypeInfoTest {
-
- private ToscaNodeTypeInfo createTestSubject() {
- return new ToscaNodeTypeInfo();
- }
-
-
- @Test
- public void testGetNodeName() throws Exception {
- ToscaNodeTypeInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getNodeName();
- }
-
-
- @Test
- public void testSetNodeName() throws Exception {
- ToscaNodeTypeInfo testSubject;
- String nodeName = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setNodeName(nodeName);
- }
-
-
- @Test
- public void testGetTemplateVersion() throws Exception {
- ToscaNodeTypeInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getTemplateVersion();
- }
-
-
- @Test
- public void testSetTemplateVersion() throws Exception {
- ToscaNodeTypeInfo testSubject;
- String templateVersion = "";
- // default test
- testSubject = createTestSubject();
- testSubject.setTemplateVersion(templateVersion);
- }
-
-
- @Test
- public void testGetInterfaces() throws Exception {
- ToscaNodeTypeInfo testSubject;
- List<ToscaNodeTypeInterface> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getInterfaces();
- }
-
-
- @Test
- public void testSetInterfaces() throws Exception {
- ToscaNodeTypeInfo testSubject;
- List<ToscaNodeTypeInterface> interfaces = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setInterfaces(interfaces);
- }
-
-
- @Test
- public void testGetIconPath() throws Exception {
- ToscaNodeTypeInfo testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getIconPath();
- }
-
-
- @Test
- public void testSetIconPath() throws Exception {
- ToscaNodeTypeInfo testSubject;
- String iconPath = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIconPath(iconPath);
- }
+public class ToscaNodeTypeInfoTest {
-
- @Test
- public void testToString() throws Exception {
- ToscaNodeTypeInfo testSubject;
- String result;
- // default test
- testSubject = createTestSubject();
- result = testSubject.toString();
- }
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(ToscaNodeTypeInfo.class, BeanMatchers.hasValidGettersAndSetters());
+ }
+
+ @Test
+ public void allPropertiesShouldBeRepresentedInToStringOutput() {
+ assertThat(ToscaNodeTypeInfo.class, BeanMatchers.hasValidBeanToString());
+ }
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ToscaNodeTypeInterfaceTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ToscaNodeTypeInterfaceTest.java
index 67b0cdfd33..c74ce36a92 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/info/ToscaNodeTypeInterfaceTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/info/ToscaNodeTypeInterfaceTest.java
@@ -1,35 +1,17 @@
package org.openecomp.sdc.be.info;
-import java.util.List;
-
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
-public class ToscaNodeTypeInterfaceTest {
-
- private ToscaNodeTypeInterface createTestSubject() {
- return new ToscaNodeTypeInterface();
- }
-
- @Test
- public void testGetScripts() throws Exception {
- ToscaNodeTypeInterface testSubject;
- List<String> result;
+public class ToscaNodeTypeInterfaceTest {
- // default test
- testSubject = createTestSubject();
- result = testSubject.getScripts();
- }
-
- @Test
- public void testSetScripts() throws Exception {
- ToscaNodeTypeInterface testSubject;
- List<String> scripts = null;
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(ToscaNodeTypeInterface.class, hasValidGettersAndSetters());
+ }
- // default test
- testSubject = createTestSubject();
- testSubject.setScripts(scripts);
- }
} \ No newline at end of file