summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-BE-common/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-portal-BE-common/src/test/java')
-rw-r--r--ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/BEPropertyTest.java60
-rw-r--r--ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPRoleTest.java118
-rw-r--r--ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequestTest.java200
-rw-r--r--ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserTest.java213
-rw-r--r--ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/utils/MusicCookieCsrfTokenRepositoryTest.java71
5 files changed, 445 insertions, 217 deletions
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/BEPropertyTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/BEPropertyTest.java
index 102e6aeb..516393a3 100644
--- a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/BEPropertyTest.java
+++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/BEPropertyTest.java
@@ -4,6 +4,8 @@
* ===================================================================
* Copyright (C) 2018 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");
@@ -45,25 +47,41 @@ import org.junit.Test;
public class BEPropertyTest {
-
- private static final String TEST="test";
-
- @Test
- public void test() {
- BEProperty property=new BEProperty(TEST, TEST);
- BEProperty beProperty=new BEProperty(TEST, TEST);
- BEProperty be=property;
-
- beProperty.setKey(property.getKey());
- beProperty.setValue(property.getValue());
-
- assertEquals(property.hashCode(), beProperty.hashCode());
- assertTrue(beProperty.equals(property));
- assertTrue(be.equals(property));
- assertFalse(be.equals(null));
- be.setValue(null);
- assertTrue(be.equals(property));
- be.setKey(null);
- assertTrue(be.equals(property));
- }
+
+ private static final String TEST="test";
+
+ @Test
+ public void test() {
+ BEProperty property=new BEProperty(TEST, TEST);
+ BEProperty beProperty=new BEProperty(TEST, TEST);
+ BEProperty be=property;
+
+ beProperty.setKey(property.getKey());
+ beProperty.setValue(property.getValue());
+
+ assertEquals(property.hashCode(), beProperty.hashCode());
+ assertTrue(beProperty.equals(property));
+ assertTrue(be.equals(property));
+ assertFalse(be.equals(null));
+ be.setValue(null);
+ assertTrue(be.equals(property));
+ be.setKey(null);
+ assertTrue(be.equals(property));
+
+ assertFalse(property.equals(this));
+
+ property.setKey(null);
+ beProperty.setKey("notnull");
+ assertFalse(property.equals(beProperty));
+ assertFalse(beProperty.equals(property));
+
+ property.setKey("notnull");
+ beProperty.setKey("notnull");
+ property.setValue(null);
+ beProperty.setValue("notnull");
+ assertFalse(property.equals(beProperty));
+ assertFalse(beProperty.equals(property));
+
+
+ }
}
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPRoleTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPRoleTest.java
index d081b801..f99c80bc 100644
--- a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPRoleTest.java
+++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPRoleTest.java
@@ -4,6 +4,8 @@
* ===================================================================
* Copyright (C) 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");
@@ -51,58 +53,68 @@ import org.onap.portalsdk.core.restful.domain.EcompRoleFunction;
public class EPRoleTest {
-
- @Test
- public void testEpRole() {
- EPRole role=new EPRole();
- role.setActive(true);
- role.setAppId(1l);
- role.setAppRoleId(2l);
- role.setId(3l);
- role.setName("TEST_ADMIN");
- SortedSet<EPRole> childRoles = new TreeSet<EPRole>();
- EPRole child=new EPRole();
- child.setActive(true);
- child.setAppId(1l);
- child.setAppRoleId(3l);
- child.setId(6l);
- child.setName("TEST_USER");
- childRoles.add(child);
- role.setChildRoles(childRoles);
- SortedSet<EPRole> parentRoles = new TreeSet<EPRole>();
- EPRole parent=new EPRole();
- parent.setActive(true);
- parent.setAppId(1l);
- parent.setAppRoleId(3l);
- parent.setId(6l);
- parent.setName("TEST_USER");
- parentRoles.add(parent);
- role.setParentRoles(parentRoles);
-
- SortedSet<RoleFunction> rolefunction = new TreeSet<RoleFunction>();
- RoleFunction function=new RoleFunction();
- function.setAction("Test");;
- function.setCode("code");
- rolefunction.add(function);
- role.setRoleFunctions(rolefunction);
- role.setPriority(5);
- role.setAppRoleId(3l);
- assertEquals(3l, role.getAppRoleId().longValue());
- assertNotNull(role.getChildRoles());
- assertNotNull(role.getParentRoles());
- assertNotNull(role.getRoleFunctions());
- role.compareTo(role);
- assertEquals(1l, role.getAppId().longValue());
- assertEquals("TEST_ADMIN",role.getName());
- role.removeChildRole(6l);
- role.removeParentRole(6l);
- assertEquals(role.toString(), "[Id = 3, name = TEST_ADMIN]");
- role.removeRoleFunction("code");
- role.addChildRole(child);
- role.addParentRole(parent);
- role.addRoleFunction(function);
-
- }
-
+
+ @Test
+ public void testEpRole() {
+ EPRole role=new EPRole();
+ role.setActive(true);
+ role.setAppId(1l);
+ role.setAppRoleId(2l);
+ role.setId(3l);
+ role.setName("TEST_ADMIN");
+ SortedSet<EPRole> childRoles = new TreeSet<EPRole>();
+ EPRole child=new EPRole();
+ child.setActive(true);
+ child.setAppId(1l);
+ child.setAppRoleId(3l);
+ child.setId(6l);
+ child.setName("TEST_USER");
+ childRoles.add(child);
+ role.setChildRoles(childRoles);
+ SortedSet<EPRole> parentRoles = new TreeSet<EPRole>();
+ EPRole parent=new EPRole();
+ parent.setActive(true);
+ parent.setAppId(1l);
+ parent.setAppRoleId(3l);
+ parent.setId(6l);
+ parent.setName("TEST_USER");
+ parentRoles.add(parent);
+ role.setParentRoles(parentRoles);
+
+ SortedSet<RoleFunction> rolefunction = new TreeSet<RoleFunction>();
+ RoleFunction function=new RoleFunction();
+ function.setAction("Test");;
+ function.setCode("code");
+ rolefunction.add(function);
+ role.setRoleFunctions(rolefunction);
+ role.setPriority(5);
+ role.setAppRoleId(3l);
+ assertEquals(3l, role.getAppRoleId().longValue());
+ assertNotNull(role.getChildRoles());
+ assertNotNull(role.getParentRoles());
+ assertNotNull(role.getRoleFunctions());
+ role.compareTo(role);
+ assertEquals(1l, role.getAppId().longValue());
+ assertEquals("TEST_ADMIN",role.getName());
+ role.removeChildRole(6l);
+ role.removeParentRole(6l);
+ assertEquals(role.toString(), "[Id = 3, name = TEST_ADMIN]");
+ role.removeRoleFunction("code");
+ role.addChildRole(child);
+ role.addParentRole(parent);
+ role.addRoleFunction(function);
+
+ parent.setAppId(null);
+ child.setAppId((long) 1234);
+ assertEquals(parent.compareTo(child), -1);
+
+ child.setAppId(null);
+ parent.setAppId((long) 1234);
+ assertEquals(parent.compareTo(child), 1);
+
+
+
+ }
+
}
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequestTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequestTest.java
index 96089cd7..d40bd420 100644
--- a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequestTest.java
+++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserAppRolesRequestTest.java
@@ -4,6 +4,8 @@
* ===================================================================
* Copyright (C) 2018 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");
@@ -50,45 +52,163 @@ import java.util.Set;
import org.junit.Test;
public class EPUserAppRolesRequestTest {
-
- private static final String TEST="test";
- Date date=new Date();
-
-
- @Test
- public void testEpUserAppRoles() {
- EPUserAppRolesRequest request=new EPUserAppRolesRequest();
- request=buildEPUserAppRolesRequest(request);
- EPUserAppRolesRequest request1=new EPUserAppRolesRequest();
- request1=buildEPUserAppRolesRequest(request1);
-
- assertEquals(request.getRequestStatus(), "test");
- request.getAppId();
- request.getUserId();
- assertEquals(request.getCreated(),date);
- assertEquals(request.getCreatedDate(),date);
- assertEquals(request.getUpdatedDate(),date);
- assertNotNull(request.getEpRequestIdDetail());
- assertEquals(request.hashCode(), request1.hashCode());
- assertTrue(request.equals(request1));
- assertNotNull(request.toString());
-
-
- }
- private EPUserAppRolesRequest buildEPUserAppRolesRequest(EPUserAppRolesRequest request) {
- request.setUserId(1l);
- request.setAppId(1l);
- request.setCreated(date);
- request.setCreatedDate(date);
- request.setUpdatedDate(date);
- request.setRequestStatus(TEST);
- Set<EPUserAppRolesRequestDetail> epRequestIdDetail=new HashSet<>();
- EPUserAppRolesRequestDetail detail=new EPUserAppRolesRequestDetail();
- detail.setId(1l);
- epRequestIdDetail.add(detail);
- request.setEpRequestIdDetail(epRequestIdDetail);
-
- return request;
- }
+
+ private static final String TEST="test";
+ Date date=new Date();
+
+
+ @Test
+ public void testEpUserAppRoles() {
+ EPUserAppRolesRequest request=new EPUserAppRolesRequest();
+ request=buildEPUserAppRolesRequest(request);
+ EPUserAppRolesRequest request1=new EPUserAppRolesRequest();
+ request1=buildEPUserAppRolesRequest(request1);
+
+ assertEquals(request.getRequestStatus(), "test");
+ request.getAppId();
+ request.getUserId();
+ assertEquals(request.getCreated(),date);
+ assertEquals(request.getCreatedDate(),date);
+ assertEquals(request.getUpdatedDate(),date);
+ assertNotNull(request.getEpRequestIdDetail());
+ assertEquals(request.hashCode(), request1.hashCode());
+ assertTrue(request.equals(request1));
+ assertNotNull(request.toString());
+
+ request.setAppId(null);
+ request1.setAppId((long) 12345);
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 54321);
+ request1.setAppId((long) 12345);
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(null);
+ request1.setCreatedDate(new Date());
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ Date requstDate = new Date();
+ requstDate.setYear(2000);
+ request.setCreatedDate(requstDate);
+ request1.setCreatedDate(new Date());
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(new Date());
+ request1.setCreatedDate(new Date());
+ request.setEpRequestIdDetail(null);
+ request1.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(new Date());
+ request1.setCreatedDate(new Date());
+ HashSet<EPUserAppRolesRequestDetail> details = new HashSet<EPUserAppRolesRequestDetail>();
+ details.add(new EPUserAppRolesRequestDetail());
+ request.setEpRequestIdDetail(details);
+ request1.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ assertFalse(request.equals(request1));
+
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(new Date());
+ request1.setCreatedDate(new Date());
+ request.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request1.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request.setRequestStatus(null);
+ request1.setRequestStatus("notnull");
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(new Date());
+ request1.setCreatedDate(new Date());
+ request.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request1.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request.setRequestStatus("status");
+ request1.setRequestStatus("notnull");
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(new Date());
+ request1.setCreatedDate(new Date());
+ request.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request1.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request.setRequestStatus("notnull");
+ request1.setRequestStatus("notnull");
+ request.setUpdatedDate(null);
+ request1.setUpdatedDate(new Date());
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(new Date());
+ request1.setCreatedDate(new Date());
+ request.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request1.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request.setRequestStatus("notnull");
+ request1.setRequestStatus("notnull");
+ Date date = new Date();
+ date.setYear(2000);
+ request.setUpdatedDate(date);
+ request1.setUpdatedDate(new Date());
+ assertFalse(request.equals(request1));
+
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(new Date());
+ request1.setCreatedDate(new Date());
+ request.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request1.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request.setRequestStatus("notnull");
+ request1.setRequestStatus("notnull");
+ request.setUpdatedDate(new Date());
+ request1.setUpdatedDate(new Date());
+ request.setUserId(null);
+ request1.setUserId((long) 12345);
+ assertFalse(request.equals(request1));
+
+ request.setAppId((long) 12345);
+ request1.setAppId((long) 12345);
+ request.setCreatedDate(new Date());
+ request1.setCreatedDate(new Date());
+ request.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request1.setEpRequestIdDetail(new HashSet<EPUserAppRolesRequestDetail>());
+ request.setRequestStatus("notnull");
+ request1.setRequestStatus("notnull");
+ request.setUpdatedDate(new Date());
+ request1.setUpdatedDate(new Date());
+ request.setUserId((long) 54321);
+ request1.setUserId((long) 12345);
+ assertFalse(request.equals(request1));
+
+ assertFalse(request.equals(this));
+ assertFalse(request.equals(null));
+
+ }
+ private EPUserAppRolesRequest buildEPUserAppRolesRequest(EPUserAppRolesRequest request) {
+ request.setUserId(1l);
+ request.setAppId(1l);
+ request.setCreated(date);
+ request.setCreatedDate(date);
+ request.setUpdatedDate(date);
+ request.setRequestStatus(TEST);
+ Set<EPUserAppRolesRequestDetail> epRequestIdDetail=new HashSet<>();
+ EPUserAppRolesRequestDetail detail=new EPUserAppRolesRequestDetail();
+ detail.setId(1l);
+ epRequestIdDetail.add(detail);
+ request.setEpRequestIdDetail(epRequestIdDetail);
+
+ return request;
+ }
}
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserTest.java
index bc4c6f38..c856b5a3 100644
--- a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserTest.java
+++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPUserTest.java
@@ -4,6 +4,8 @@
* ===================================================================
* Copyright (C) 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");
@@ -37,7 +39,7 @@
*/
package org.onap.portalapp.portal.domain;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
import java.util.Date;
@@ -46,106 +48,111 @@ import org.onap.portalapp.portal.domain.EPUser;
public class EPUserTest {
- public EPUser mockEPUser(){
-
- EPUser epUser = new EPUser();
-
- epUser.setId((long)1);
- epUser.setManagerId((long) 1234);
- epUser.setFirstName("test");
- epUser.setLastName("test");
- epUser.setMiddleInitial("test");
- epUser.setPhone("test");
- epUser.setFax("test");
- epUser.setCellular("test");
- epUser.setEmail("test");
- epUser.setAddressId((long) 123);
- epUser.setAlertMethodCd("test");
- epUser.setHrid("test");
- epUser.setOrgUserId("test");
- epUser.setOrgCode("test");
- epUser.setAddress1("test");
- epUser.setAddress2("test");
- epUser.setCity("test");
- epUser.setState("test");
- epUser.setZipCode("test");
- epUser.setCountry("test");
- epUser.setOrgManagerUserId("test");
- epUser.setLocationClli("test");
- epUser.setBusinessCountryCode("test");
- epUser.setBusinessCountryName("test");
- epUser.setBusinessUnit("test");
- epUser.setBusinessUnitName("test");
- epUser.setDepartment("test");
- epUser.setDepartmentName("test");
- epUser.setCompanyCode("test");
- epUser.setCompany("test");
- epUser.setZipCodeSuffix("test");
- epUser.setJobTitle("test");
- epUser.setCommandChain("test");
- epUser.setSiloStatus("test");
- epUser.setCostCenter("test");
- epUser.setFinancialLocCode("test");
- epUser.setLoginId("test");
- epUser.setLoginPwd("test");
- epUser.setLastLoginDate(new Date());
- epUser.setActive(false);
- epUser.setInternal(false);
- epUser.setSelectedProfileId((long) 12345);
- epUser.setTimeZoneId((long) 12345);
- epUser.setOnline(false);
- epUser.setChatId("test");
- return epUser;
-
- }
-
- @Test
- public void userTest(){
- EPUser user = mockEPUser();
-
- assertEquals(user.getId(), new Long(1));
- assertEquals(user.getManagerId(), new Long(1234));
- assertEquals(user.getFirstName(), "test");
- assertEquals(user.getLastName(), "test");
- assertEquals(user.getMiddleInitial(), "test");
- assertEquals(user.getPhone(), "test");
- assertEquals(user.getFax(), "test");
- assertEquals(user.getCellular(), "test");
- assertEquals(user.getEmail(), "test");
- assertEquals(user.getAddressId(), new Long(123) );
- assertEquals(user.getAlertMethodCd(), "test");
- assertEquals(user.getHrid(), "test");
- assertEquals(user.getOrgUserId(), "test");
- assertEquals(user.getOrgCode(), "test");
- assertEquals(user.getAddress1(), "test");
- assertEquals(user.getAddress2(), "test");
- assertEquals(user.getState(), "test");
- assertEquals(user.getZipCode(), "test");
- assertEquals(user.getCountry(), "test");
- assertEquals(user.getOrgManagerUserId(), "test");
- assertEquals(user.getLocationClli(), "test");
- assertEquals(user.getBusinessCountryCode(), "test");
- assertEquals(user.getBusinessCountryName(), "test");
- assertEquals(user.getBusinessUnit(), "test");
- assertEquals(user.getBusinessUnitName(), "test");
- assertEquals(user.getDepartment(), "test");
- assertEquals(user.getDepartmentName(), "test");
- assertEquals(user.getCompanyCode(), "test");
- assertEquals(user.getCompany(), "test");
- assertEquals(user.getZipCodeSuffix(), "test");
- assertEquals(user.getJobTitle(), "test");
- assertEquals(user.getCommandChain(), "test");
- assertEquals(user.getSiloStatus(), "test");
- assertEquals(user.getFinancialLocCode(), "test");
- assertEquals(user.getLoginId(), "test");
- assertEquals(user.getLoginPwd(), "test");
- assertEquals(user.getActive(), false);
- assertEquals(user.getInternal(), false);
- assertEquals(user.getSelectedProfileId(), new Long (12345));
- assertEquals(user.getTimeZoneId(), new Long (12345));
- assertEquals(user.getChatId(), "test");
-
- //assertEquals(user.toString(), "EPUser [orgId=null, managerId=1234, firstName=test, middleInitial=test, lastName=test, phone=test, fax=test, cellular=test, email=test, addressId=123, alertMethodCd=test, hrid=test, orgUserId=test, orgCode=test, address1=test, address2=test, city=test, state=test, zipCode=test, country=test, orgManagerUserId=test, locationClli=test, businessCountryCode=test, businessCountryName=test, businessUnit=test, businessUnitName=test, department=test, departmentName=test, companyCode=test, company=test, zipCodeSuffix=test, jobTitle=test, commandChain=test, siloStatus=test, costCenter=test, financialLocCode=test, loginId=test, loginPwd=test, lastLoginDate=Tue Sep 05 11:04:49 EDT 2017, active=false, internal=false, selectedProfileId=12345, timeZoneId=12345, online=false, chatId=test, isGuest=false, userApps=[], pseudoRoles=[]]");
- }
-
+ public EPUser mockEPUser(){
+
+ EPUser epUser = new EPUser();
+
+ epUser.setId((long)1);
+ epUser.setManagerId((long) 1234);
+ epUser.setFirstName("test");
+ epUser.setLastName("test");
+ epUser.setMiddleInitial("test");
+ epUser.setPhone("test");
+ epUser.setFax("test");
+ epUser.setCellular("test");
+ epUser.setEmail("test");
+ epUser.setAddressId((long) 123);
+ epUser.setAlertMethodCd("test");
+ epUser.setHrid("test");
+ epUser.setOrgUserId("test");
+ epUser.setOrgCode("test");
+ epUser.setAddress1("test");
+ epUser.setAddress2("test");
+ epUser.setCity("test");
+ epUser.setState("test");
+ epUser.setZipCode("test");
+ epUser.setCountry("test");
+ epUser.setOrgManagerUserId("test");
+ epUser.setLocationClli("test");
+ epUser.setBusinessCountryCode("test");
+ epUser.setBusinessCountryName("test");
+ epUser.setBusinessUnit("test");
+ epUser.setBusinessUnitName("test");
+ epUser.setDepartment("test");
+ epUser.setDepartmentName("test");
+ epUser.setCompanyCode("test");
+ epUser.setCompany("test");
+ epUser.setZipCodeSuffix("test");
+ epUser.setJobTitle("test");
+ epUser.setCommandChain("test");
+ epUser.setSiloStatus("test");
+ epUser.setCostCenter("test");
+ epUser.setFinancialLocCode("test");
+ epUser.setLoginId("test");
+ epUser.setLoginPwd("test");
+ epUser.setLastLoginDate(new Date());
+ epUser.setActive(false);
+ epUser.setInternal(false);
+ epUser.setSelectedProfileId((long) 12345);
+ epUser.setTimeZoneId((long) 12345);
+ epUser.setOnline(false);
+ epUser.setChatId("test");
+ return epUser;
+
+ }
+
+ @Test
+ public void userTest(){
+ EPUser user = mockEPUser();
+
+ assertEquals(user.getId(), new Long(1));
+ assertEquals(user.getManagerId(), new Long(1234));
+ assertEquals(user.getFirstName(), "test");
+ assertEquals(user.getLastName(), "test");
+ assertEquals(user.getMiddleInitial(), "test");
+ assertEquals(user.getPhone(), "test");
+ assertEquals(user.getFax(), "test");
+ assertEquals(user.getCellular(), "test");
+ assertEquals(user.getEmail(), "test");
+ assertEquals(user.getAddressId(), new Long(123) );
+ assertEquals(user.getAlertMethodCd(), "test");
+ assertEquals(user.getHrid(), "test");
+ assertEquals(user.getOrgUserId(), "test");
+ assertEquals(user.getOrgCode(), "test");
+ assertEquals(user.getAddress1(), "test");
+ assertEquals(user.getAddress2(), "test");
+ assertEquals(user.getState(), "test");
+ assertEquals(user.getZipCode(), "test");
+ assertEquals(user.getCountry(), "test");
+ assertEquals(user.getOrgManagerUserId(), "test");
+ assertEquals(user.getLocationClli(), "test");
+ assertEquals(user.getBusinessCountryCode(), "test");
+ assertEquals(user.getBusinessCountryName(), "test");
+ assertEquals(user.getBusinessUnit(), "test");
+ assertEquals(user.getBusinessUnitName(), "test");
+ assertEquals(user.getDepartment(), "test");
+ assertEquals(user.getDepartmentName(), "test");
+ assertEquals(user.getCompanyCode(), "test");
+ assertEquals(user.getCompany(), "test");
+ assertEquals(user.getZipCodeSuffix(), "test");
+ assertEquals(user.getJobTitle(), "test");
+ assertEquals(user.getCommandChain(), "test");
+ assertEquals(user.getSiloStatus(), "test");
+ assertEquals(user.getFinancialLocCode(), "test");
+ assertEquals(user.getLoginId(), "test");
+ assertEquals(user.getLoginPwd(), "test");
+ assertEquals(user.getActive(), false);
+ assertEquals(user.getInternal(), false);
+ assertEquals(user.getSelectedProfileId(), new Long (12345));
+ assertEquals(user.getTimeZoneId(), new Long (12345));
+ assertEquals(user.getChatId(), "test");
+
+ EPUser another = mockEPUser();
+ assertTrue(user.compareTo(another) == 0);
+ another.setLastName("otherlastname");
+ assertTrue(user.compareTo(another) == 5);
+
+ //assertEquals(user.toString(), "EPUser [orgId=null, managerId=1234, firstName=test, middleInitial=test, lastName=test, phone=test, fax=test, cellular=test, email=test, addressId=123, alertMethodCd=test, hrid=test, orgUserId=test, orgCode=test, address1=test, address2=test, city=test, state=test, zipCode=test, country=test, orgManagerUserId=test, locationClli=test, businessCountryCode=test, businessCountryName=test, businessUnit=test, businessUnitName=test, department=test, departmentName=test, companyCode=test, company=test, zipCodeSuffix=test, jobTitle=test, commandChain=test, siloStatus=test, costCenter=test, financialLocCode=test, loginId=test, loginPwd=test, lastLoginDate=Tue Sep 05 11:04:49 EDT 2017, active=false, internal=false, selectedProfileId=12345, timeZoneId=12345, online=false, chatId=test, isGuest=false, userApps=[], pseudoRoles=[]]");
+ }
+
}
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/utils/MusicCookieCsrfTokenRepositoryTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/utils/MusicCookieCsrfTokenRepositoryTest.java
new file mode 100644
index 00000000..896c10a3
--- /dev/null
+++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/utils/MusicCookieCsrfTokenRepositoryTest.java
@@ -0,0 +1,71 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright © 2018 IBM Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ *
+ */
+package org.onap.portalapp.portal.utils;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
+import org.springframework.security.web.csrf.CsrfToken;
+
+public class MusicCookieCsrfTokenRepositoryTest {
+
+ MusicCookieCsrfTokenRepository repo;
+
+ CookieCsrfTokenRepository cookieRepo;
+
+ @Before
+ public void setup() {
+ cookieRepo = new CookieCsrfTokenRepository();
+ repo = new MusicCookieCsrfTokenRepository(cookieRepo);
+ }
+
+ @Test
+ public void generateTokenTest(){
+ HttpServletRequest requestMock = Mockito.mock(HttpServletRequest.class);
+ CsrfToken expected = cookieRepo.generateToken(requestMock);
+
+ CsrfToken actual = repo.generateToken(requestMock);
+
+ Assert.assertEquals(expected.getHeaderName(), actual.getHeaderName());
+ Assert.assertEquals(expected.getParameterName(), actual.getParameterName());
+ }
+}