summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-fw
diff options
context:
space:
mode:
authorManoop Talasila <talasila@research.att.com>2018-10-09 19:22:49 +0000
committerGerrit Code Review <gerrit@onap.org>2018-10-09 19:22:49 +0000
commitcff81c33d3960c18be6f594bb0e8ebd2c5272f9e (patch)
treea0f0986808ce46f1d178bb7054ff19e2f70d41b0 /ecomp-sdk/epsdk-fw
parent1c5db38fc678634d474bf34560a7428c98d7c93a (diff)
parentcb9d34b572153c4a498841ae03fa4bf8aeab54cd (diff)
Merge "added test cases to DomainTest.java"
Diffstat (limited to 'ecomp-sdk/epsdk-fw')
-rw-r--r--ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/DomainTest.java233
1 files changed, 125 insertions, 108 deletions
diff --git a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/DomainTest.java b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/DomainTest.java
index 45145e43..a212e4fa 100644
--- a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/DomainTest.java
+++ b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/DomainTest.java
@@ -4,6 +4,8 @@
* ===================================================================
* Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ===================================================================
+ * Modifications Copyright © 2018 IBM.
+ * ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
* under the Apache License, Version 2.0 (the "License");
@@ -39,6 +41,7 @@
package org.onap.portalsdk.fw.test;
import java.util.HashSet;
+import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -52,118 +55,132 @@ import org.onap.portalsdk.core.restful.domain.SharedContext;
public class DomainTest extends AbstractModelTest {
- private final Log logger = LogFactory.getLog(DomainTest.class);
+ private final Log logger = LogFactory.getLog(DomainTest.class);
- @Test
- public void testPortalAPIResponse() {
- PortalAPIResponse m = new PortalAPIResponse(true, s1);
- Assert.assertEquals("ok", m.getStatus());
- Assert.assertEquals(s1, m.getMessage());
- logger.info(m.toString());
- }
+ @Test
+ public void testPortalAPIResponse() {
+ PortalAPIResponse m = new PortalAPIResponse(true, s1);
+ Assert.assertEquals("ok", m.getStatus());
+ Assert.assertEquals(s1, m.getMessage());
+ logger.info(m.toString());
+ }
- @Test
- public void testEcompRole() {
- EcompRole m = new EcompRole();
- m.setId(l1);
- m.setName(s1);
- Assert.assertEquals(l1, m.getId());
- Assert.assertEquals(s1, m.getName());
- Assert.assertTrue(m.equals(m));
- Assert.assertFalse(m.equals(new EcompRole()));
- Assert.assertNotNull(m.hashCode());
- logger.info(m.toString());
- }
+ @Test
+ public void testEcompRole() {
+ EcompRole m = new EcompRole();
+ EcompRole m1 = new EcompRole();
+ m1.setId(l1);
+ m.setId(l1);
+ m.setName(s1);
+ Set roleFunctions = new HashSet();
+ m.setRoleFunctions(roleFunctions);
+ Assert.assertEquals(roleFunctions, m.getRoleFunctions());
+ Assert.assertEquals(l1, m.getId());
+ Assert.assertEquals(s1, m.getName());
+ Assert.assertTrue(m.equals(m));
+ Assert.assertFalse(m.equals(new EcompRole()));
+ Assert.assertNotNull(m.hashCode());
+ Assert.assertEquals(0, m.compareTo(m1));
+ logger.info(m.toString());
+ }
- @Test
- public void testEcompUser() {
- EcompUser m = new EcompUser();
- m.setActive(false);
- m.setEmail(s1);
- m.setFirstName(s2);
- m.setHrid(s3);
- m.setJobTitle(s4);
- m.setLastName(s5);
- m.setLoginId(s6);
- m.setManagerId(s7);
- m.setMiddleInitial(s8);
- m.setOrgCode(s9);
- m.setOrgId(l1);
- m.setOrgManagerUserId(s10);
- // Start over at 1, but double
- m.setOrgUserId(s1 + s1);
- m.setPhone(s2 + s2);
- EcompRole r = new EcompRole();
- HashSet<EcompRole> roles = new HashSet<>();
- roles.add(r);
- m.setRoles(roles);
- Assert.assertEquals(false, m.isActive());
- Assert.assertEquals(s1, m.getEmail());
- Assert.assertEquals(s2, m.getFirstName());
- Assert.assertEquals(s3, m.getHrid());
- Assert.assertEquals(s4, m.getJobTitle());
- Assert.assertEquals(s5, m.getLastName());
- Assert.assertEquals(s6, m.getLoginId());
- Assert.assertEquals(s7, m.getManagerId());
- Assert.assertEquals(s8, m.getMiddleInitial());
- Assert.assertEquals(s9, m.getOrgCode());
- Assert.assertEquals(l1, m.getOrgId());
- Assert.assertEquals(s10, m.getOrgManagerUserId());
- Assert.assertEquals(s1 + s1, m.getOrgUserId());
- Assert.assertEquals(s2 + s2, m.getPhone());
- // this is weak
- Assert.assertEquals(roles, m.getRoles());
- Assert.assertTrue(m.equals(m));
- Assert.assertFalse(m.equals(null));
- Assert.assertFalse(m.equals(new EcompUser()));
- Assert.assertNotNull(m.hashCode());
- logger.info(m.toString());
- }
+ @Test
+ public void testEcompUser() {
+ EcompUser m = new EcompUser();
+ EcompUser m1 = new EcompUser();
+ m1.setLoginId(s6);
+ m.setActive(false);
+ m.setEmail(s1);
+ m.setFirstName(s2);
+ m.setHrid(s3);
+ m.setJobTitle(s4);
+ m.setLastName(s5);
+ m.setLoginId(s6);
+ m.setManagerId(s7);
+ m.setMiddleInitial(s8);
+ m.setOrgCode(s9);
+ m.setOrgId(l1);
+ m.setOrgManagerUserId(s10);
+ // Start over at 1, but double
+ m.setOrgUserId(s1 + s1);
+ m.setPhone(s2 + s2);
+ EcompRole r = new EcompRole();
+ HashSet<EcompRole> roles = new HashSet<>();
+ roles.add(r);
+ m.setRoles(roles);
+ Assert.assertEquals(false, m.isActive());
+ Assert.assertEquals(s1, m.getEmail());
+ Assert.assertEquals(s2, m.getFirstName());
+ Assert.assertEquals(s3, m.getHrid());
+ Assert.assertEquals(s4, m.getJobTitle());
+ Assert.assertEquals(s5, m.getLastName());
+ Assert.assertEquals(s6, m.getLoginId());
+ Assert.assertEquals(s7, m.getManagerId());
+ Assert.assertEquals(s8, m.getMiddleInitial());
+ Assert.assertEquals(s9, m.getOrgCode());
+ Assert.assertEquals(l1, m.getOrgId());
+ Assert.assertEquals(s10, m.getOrgManagerUserId());
+ Assert.assertEquals(s1 + s1, m.getOrgUserId());
+ Assert.assertEquals(s2 + s2, m.getPhone());
+ // this is weak
+ Assert.assertEquals(roles, m.getRoles());
+ Assert.assertTrue(m.equals(m));
+ Assert.assertFalse(m.equals(null));
+ Assert.assertFalse(m.equals(new EcompUser()));
+ Assert.assertNotNull(m.hashCode());
+ Assert.assertEquals(0, m.compareTo(m1));
+ logger.info(m.toString());
+ }
- @Test
- public void testPortalTimeoutVO() {
- PortalTimeoutVO m = new PortalTimeoutVO();
- m.setjSessionId(s1);
- m.setSessionTimOutMilliSec(l1);
- Assert.assertEquals(s1, m.getjSessionId());
- Assert.assertEquals(l1, m.getSessionTimOutMilliSec());
- Assert.assertTrue(m.equals(m));
- Assert.assertFalse(m.equals(null));
- Assert.assertFalse(m.equals(new PortalTimeoutVO()));
- }
+ @Test
+ public void testPortalTimeoutVO() {
+ PortalTimeoutVO m = new PortalTimeoutVO();
+ PortalTimeoutVO m1 = new PortalTimeoutVO();
+ m1.setSessionTimOutMilliSec(l1);
+ m.setjSessionId(s1);
+ m.setSessionTimOutMilliSec(l1);
+ Assert.assertEquals(s1, m.getjSessionId());
+ Assert.assertEquals(l1, m.getSessionTimOutMilliSec());
+ Assert.assertTrue(m.equals(m));
+ Assert.assertFalse(m.equals(null));
+ Assert.assertFalse(m.equals(new PortalTimeoutVO()));
+ Assert.assertEquals(0, m.compareTo(m1));
+ }
- @Test
- public void testSharedContext() {
- SharedContext m = new SharedContext();
- m.setAuditTrail(s1);
- m.setAuditUserId(s2);
- m.setCkey(s3);
- m.setContext_id(s4);
- m.setCreate_time(l1);
- m.setCreated(s5);
- m.setCreatedId(s6);
- m.setCvalue(s7);
- m.setId(l2);
- m.setModified(s8);
- m.setModifiedId(s9);
- m.setResponse(s10);
- m.setRowNum(s1 + s1);
- Assert.assertEquals(s1, m.getAuditTrail());
- Assert.assertEquals(s2, m.getAuditUserId());
- Assert.assertEquals(s3, m.getCkey());
- Assert.assertEquals(s4, m.getContext_id());
- Assert.assertEquals(l1, m.getCreate_time());
- Assert.assertEquals(s5, m.getCreated());
- Assert.assertEquals(s6, m.getCreatedId());
- Assert.assertEquals(s7, m.getCvalue());
- Assert.assertEquals(l2, m.getId());
- Assert.assertEquals(s8, m.getModified());
- Assert.assertEquals(s9, m.getModifiedId());
- Assert.assertEquals(s10, m.getResponse());
- Assert.assertEquals(s1 + s1, m.getRowNum());
- Assert.assertTrue(m.equals(m));
- Assert.assertFalse(m.equals(null));
- Assert.assertFalse(m.equals(new SharedContext()));
- }
+ @Test
+ public void testSharedContext() {
+ SharedContext m = new SharedContext();
+ m.setAuditTrail(s1);
+ m.setAuditUserId(s2);
+ m.setCkey(s3);
+ m.setContext_id(s4);
+ m.setCreate_time(l1);
+ m.setCreated(s5);
+ m.setCreatedId(s6);
+ m.setCvalue(s7);
+ m.setId(l2);
+ m.setModified(s8);
+ m.setModifiedId(s9);
+ m.setResponse(s10);
+ m.setRowNum(s1 + s1);
+ Assert.assertEquals(s1, m.getAuditTrail());
+ Assert.assertEquals(s2, m.getAuditUserId());
+ Assert.assertEquals(s3, m.getCkey());
+ Assert.assertEquals(s4, m.getContext_id());
+ Assert.assertEquals(l1, m.getCreate_time());
+ Assert.assertEquals(s5, m.getCreated());
+ Assert.assertEquals(s6, m.getCreatedId());
+ Assert.assertEquals(s7, m.getCvalue());
+ Assert.assertEquals(l2, m.getId());
+ Assert.assertEquals(s8, m.getModified());
+ Assert.assertEquals(s9, m.getModifiedId());
+ Assert.assertEquals(s10, m.getResponse());
+ Assert.assertEquals(s1 + s1, m.getRowNum());
+ Assert.assertTrue(m.equals(m));
+ Assert.assertFalse(m.equals(null));
+ Assert.assertFalse(m.equals(new SharedContext()));
+ Assert.assertTrue(m.toString() instanceof String);
+ Assert.assertTrue((Integer) m.hashCode() instanceof Integer);
+ }
}