summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-fw/src
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-09-27 18:31:51 +0530
committerSandeep J <sandeejh@in.ibm.com>2018-09-27 18:31:59 +0530
commitcb9d34b572153c4a498841ae03fa4bf8aeab54cd (patch)
treefd8ef16ad22dd9b2d26e6678a7a864c69cb45d62 /ecomp-sdk/epsdk-fw/src
parentd6bd65c16c632f018434d55ac46feca84247b145 (diff)
added test cases to DomainTest.java
to increase code coverage Issue-ID: PORTAL-273 Change-Id: I1b9e5cf0b4e63c25562ac2e6370a3013625c49d4 Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'ecomp-sdk/epsdk-fw/src')
-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);
+ }
}