diff options
Diffstat (limited to 'ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain')
36 files changed, 1458 insertions, 0 deletions
diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserAppTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserAppTest.java new file mode 100644 index 00000000..ed13c2df --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserAppTest.java @@ -0,0 +1,36 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.AdminUserApp; + +public class AdminUserAppTest { + + public AdminUserApp mockAdminUserApp(){ + + AdminUserApp adminUserApp = new AdminUserApp(); + + adminUserApp.setUserId((long)1); + adminUserApp.setFirstName("test"); + adminUserApp.setLastName("test"); + adminUserApp.setOrgUserId("test"); + adminUserApp.setAppId((long)1); + adminUserApp.setAppName("test"); + + return adminUserApp; + } + + @Test + public void adminUserAppTest(){ + AdminUserApp adminUserApp = mockAdminUserApp(); + + assertEquals(adminUserApp.getUser_Id(), new Long(1)); + assertEquals(adminUserApp.getFirstName(), "test"); + assertEquals(adminUserApp.getLastName(), "test"); + assertEquals(adminUserApp.getOrgUserId(), "test"); + assertEquals(adminUserApp.getAppName(), "test"); + assertEquals(adminUserApp.getAppId(), new Long(1)); + + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserApplicationsTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserApplicationsTest.java new file mode 100644 index 00000000..6faf44a8 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserApplicationsTest.java @@ -0,0 +1,57 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import javax.persistence.Column; +import javax.persistence.Id; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.AdminUserApp; +import org.openecomp.portalapp.portal.domain.AdminUserApplications; + +public class AdminUserApplicationsTest { + + public AdminUserApplications mockAdminUserApplications(){ + + AdminUserApp adminUserApp = new AdminUserApp(); + + adminUserApp.setUserId((long)1); + adminUserApp.setFirstName("test"); + adminUserApp.setLastName("test"); + adminUserApp.setOrgUserId("test"); + adminUserApp.setAppId((long)1); + adminUserApp.setAppName("test"); + + AdminUserApplications adminUserApplications = new AdminUserApplications(adminUserApp); + + adminUserApplications.setUser_Id((long)1); + adminUserApplications.setFirstName("test"); + adminUserApplications.setLastName("test"); + adminUserApplications.setOrgUserId("test"); + return adminUserApplications; + } + + @Test + public void adminUserAppTest(){ + AdminUserApplications adminUserApplications = mockAdminUserApplications(); + AdminUserApp adminUserApp = new AdminUserApp(); + + adminUserApp.setUserId((long)1); + adminUserApp.setFirstName("test"); + adminUserApp.setLastName("test"); + adminUserApp.setOrgUserId("test"); + adminUserApp.setAppId((long)1); + adminUserApp.setAppName("test"); + AdminUserApplications adminUserApplications1 = new AdminUserApplications(adminUserApp); + + assertEquals(adminUserApplications.getUser_Id(), new Long(1)); + assertEquals(adminUserApplications.getFirstName(), "test"); + assertEquals(adminUserApplications.getLastName(), "test"); + assertEquals(adminUserApplications.getOrgUserId(), "test"); + + + assertEquals(adminUserApplications1.getApps().get(0).getAppId(),adminUserApp.getAppId()); + assertEquals(adminUserApplications1.getApps().get(0).getAppName(),adminUserApp.getAppName()); + + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AppContactUsTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AppContactUsTest.java new file mode 100644 index 00000000..f4368616 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AppContactUsTest.java @@ -0,0 +1,32 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.AppContactUs; + +public class AppContactUsTest { + + public AppContactUs mockAppContactUs(){ + AppContactUs appContactUs = new AppContactUs(); + appContactUs.setDescription("test"); + appContactUs.setContactEmail("test"); + appContactUs.setContactName("test"); + appContactUs.setUrl("test"); + appContactUs.setActiveYN("test"); + + return appContactUs; + } + + @Test + public void mockAppContactUsTest(){ + AppContactUs appContactUs = mockAppContactUs(); + + assertEquals(appContactUs.getDescription(), "test"); + assertEquals(appContactUs.getContactEmail(), "test"); + assertEquals(appContactUs.getContactName(), "test"); + assertEquals(appContactUs.getUrl(), "test"); + assertEquals(appContactUs.getActiveYN(), "test"); + + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/CentralRoleFunctionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/CentralRoleFunctionTest.java new file mode 100644 index 00000000..83bdc591 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/CentralRoleFunctionTest.java @@ -0,0 +1,31 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.CentralRoleFunction; + +public class CentralRoleFunctionTest { + + public CentralRoleFunction mockCentralRoleFunction(){ + + CentralRoleFunction centralRoleFunction = new CentralRoleFunction(); + + centralRoleFunction.setCode("test"); + centralRoleFunction.setName("test"); + centralRoleFunction.setAppId((long)1); + centralRoleFunction.setEditUrl("test"); + + return centralRoleFunction; + } + + @Test + public void centralRoleFunctionTest(){ + CentralRoleFunction centralRoleFunction = mockCentralRoleFunction(); + + assertEquals(centralRoleFunction.getAppId(), new Long(1)); + assertEquals(centralRoleFunction.getCode(), "test"); + assertEquals(centralRoleFunction.getName(), "test"); + assertEquals(centralRoleFunction.getEditUrl(), "test"); + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppRoleFunctionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppRoleFunctionTest.java new file mode 100644 index 00000000..a3f24631 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppRoleFunctionTest.java @@ -0,0 +1,27 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.EPAppRoleFunction; + +public class EPAppRoleFunctionTest { + + public EPAppRoleFunction mockEPAppRoleFunction(){ + EPAppRoleFunction epAppRoleFunction = new EPAppRoleFunction(); + epAppRoleFunction.setRoleId((long)1); + epAppRoleFunction.setAppId((long)1); + epAppRoleFunction.setCode("test"); + + return epAppRoleFunction; + } + + @Test + public void epAppRoleFunctionTest(){ + EPAppRoleFunction epAppRoleFunction = mockEPAppRoleFunction(); + + assertEquals(epAppRoleFunction.getRoleId(), new Long(1)); + assertEquals(epAppRoleFunction.getAppId(), new Long(1)); + assertEquals(epAppRoleFunction.getCode(), "test"); + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppTest.java new file mode 100644 index 00000000..9a60e7d7 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppTest.java @@ -0,0 +1,61 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.EPApp; + +public class EPAppTest { + + public EPApp mockEPApp(){ + EPApp epApp = new EPApp(); + + epApp.setName("test"); + epApp.setImageUrl("test"); + epApp.setDescription("test"); + epApp.setNotes("test"); + epApp.setUrl("test"); + epApp.setAlternateUrl("test"); + epApp.setAppRestEndpoint("test"); + epApp.setMlAppName("test"); + epApp.setMlAppAdminId("test"); + epApp.setMotsId((long)1); + epApp.setUsername("test"); + epApp.setAppPassword("test"); + epApp.setOpen(false); + epApp.setEnabled(false); + epApp.setUebTopicName("test"); + epApp.setUebSecret("test"); + epApp.setAppType(1); + epApp.setCentralAuth(false); + epApp.setNameSpace("test"); + + return epApp; + } + + @Test + public void epAppTest(){ + EPApp epApp = mockEPApp(); + + assertEquals(epApp.getName(), "test"); + assertEquals(epApp.getImageUrl(), "test"); + assertEquals(epApp.getDescription(), "test"); + assertEquals(epApp.getNotes(), "test"); + assertEquals(epApp.getUrl(), "test"); + assertEquals(epApp.getAlternateUrl(), "test"); + assertEquals(epApp.getAppRestEndpoint(), "test"); + assertEquals(epApp.getMlAppName(), "test"); + assertEquals(epApp.getMlAppAdminId(), "test"); + assertEquals(epApp.getMotsId(), new Long(1)); + assertEquals(epApp.getUsername(), "test"); + assertEquals(epApp.getAppPassword(), "test"); + assertEquals(epApp.getOpen(), false); + assertEquals(epApp.getEnabled(), false); + assertEquals(epApp.getUebTopicName(), "test"); + assertEquals(epApp.getUebSecret(), "test"); + assertEquals(epApp.getAppType(), Integer.valueOf(1)); + assertEquals(epApp.getCentralAuth(), false); + assertEquals(epApp.getNameSpace(), "test"); + + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointAccountTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointAccountTest.java new file mode 100644 index 00000000..07206244 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointAccountTest.java @@ -0,0 +1,29 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.EPEndpointAccount; + +public class EPEndpointAccountTest { + + public EPEndpointAccount mockEPEndpointAccount(){ + EPEndpointAccount epEndpointAccount = new EPEndpointAccount(); + + epEndpointAccount.setEp_id((long)1); + epEndpointAccount.setAccount_id((long)1); + epEndpointAccount.setId((long)1); + + return epEndpointAccount; + } + + @Test + public void epEndpointAccount(){ + EPEndpointAccount epEndpointAccount = mockEPEndpointAccount(); + assertEquals(epEndpointAccount.getEp_id(), new Long(1)); + assertEquals(epEndpointAccount.getAccount_id(), new Long(1)); + assertEquals(epEndpointAccount.getId(), new Long(1)); + + assertEquals(epEndpointAccount.toString(), "EPEndpointAccount [id=1, ep_id=1, account_id=1]"); + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointTest.java new file mode 100644 index 00000000..8fbee988 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointTest.java @@ -0,0 +1,27 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.EPEndpoint; + +public class EPEndpointTest { + + public EPEndpoint mockEPEndpoint(){ + EPEndpoint epEndpoint = new EPEndpoint(); + + epEndpoint.setId((long)1); + epEndpoint.setName("test"); + + return epEndpoint; + } + + @Test + public void epEndpointTest(){ + EPEndpoint epEndpoint = mockEPEndpoint(); + + assertEquals(epEndpoint.getId(), new Long(1)); + assertEquals(epEndpoint.getName(), "test"); + assertEquals("EPEndpoint [id=1, name=test]", epEndpoint.toString()); + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPRoleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPRoleTest.java new file mode 100644 index 00000000..05453bfa --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPRoleTest.java @@ -0,0 +1,36 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.EPRole; + +public class EPRoleTest { + + public EPRole mockEPRole(){ + EPRole epRole = new EPRole(); + + epRole.setName("test"); + epRole.setActive(false); + epRole.setPriority(1); + epRole.setAppId((long)1); + epRole.setAppRoleId((long)1); + + return epRole; + } + + @Test + public void epRoleTest(){ + EPRole epRole = mockEPRole(); + + assertEquals(epRole.getName(), "test"); + assertEquals(epRole.getActive(), false); + assertEquals(epRole.getPriority().toString(),"1"); + assertEquals(epRole.getAppId(), new Long(1)); + assertEquals(epRole.getAppRoleId(), new Long(1)); + + assertEquals(epRole.toString(), "[Id = null, name = test]"); + + + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppCatalogRolesTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppCatalogRolesTest.java new file mode 100644 index 00000000..a21eec76 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppCatalogRolesTest.java @@ -0,0 +1,32 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.EPUserAppCatalogRoles; + +public class EPUserAppCatalogRolesTest { + + public EPUserAppCatalogRoles mockEPUserAppCatalogRoles(){ + EPUserAppCatalogRoles epUserAppCatalogRoles = new EPUserAppCatalogRoles(); + + epUserAppCatalogRoles.setRequestedRoleId((long)1); + epUserAppCatalogRoles.setRolename("test"); + epUserAppCatalogRoles.setRequestStatus("status"); + epUserAppCatalogRoles.setAppId((long)1); + + return epUserAppCatalogRoles; + } + + @Test + public void epUserAppCatalogRolesTest(){ + EPUserAppCatalogRoles epUserAppCatalogRoles = mockEPUserAppCatalogRoles(); + + assertEquals(epUserAppCatalogRoles.getRequestedRoleId(), new Long(1)); + assertEquals(epUserAppCatalogRoles.getRolename(), "test"); + assertEquals(epUserAppCatalogRoles.getRequestStatus(), "status"); + assertEquals(epUserAppCatalogRoles.getAppId(), new Long(1)); + + assertEquals("EPUserAppCatalogRoles [requestedRoleId=1, rolename=test, requestStatus=status, appId=1]", epUserAppCatalogRoles.toString()); + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesRequestDetailTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesRequestDetailTest.java new file mode 100644 index 00000000..c9147bbe --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesRequestDetailTest.java @@ -0,0 +1,54 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import java.util.Date; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.EPUserAppRolesRequest; +import org.openecomp.portalapp.portal.domain.EPUserAppRolesRequestDetail; + +public class EPUserAppRolesRequestDetailTest { + + public EPUserAppRolesRequestDetail mockEPUserAppRolesRequestDetail(){ + + EPUserAppRolesRequest epUserAppRolesRequest = new EPUserAppRolesRequest(); + epUserAppRolesRequest.setUserId((long)1); + epUserAppRolesRequest.setAppId((long)1); + epUserAppRolesRequest.setCreated(new Date()); + epUserAppRolesRequest.setUpdatedDate(new Date()); + epUserAppRolesRequest.setRequestStatus("test"); + + EPUserAppRolesRequestDetail epUserAppRolesRequestDetail = new EPUserAppRolesRequestDetail(); + epUserAppRolesRequestDetail.setReqRoleId((long)1); + epUserAppRolesRequestDetail.setReqType("test"); + epUserAppRolesRequestDetail.setEpRequestIdData(epUserAppRolesRequest); + + return epUserAppRolesRequestDetail; + } + + @Test + public void epUserAppRolesRequestDetailTest(){ + + EPUserAppRolesRequest epUserAppRolesRequest = new EPUserAppRolesRequest(); + epUserAppRolesRequest.setUserId((long)1); + epUserAppRolesRequest.setAppId((long)1); + epUserAppRolesRequest.setCreated(new Date()); + epUserAppRolesRequest.setUpdatedDate(new Date()); + epUserAppRolesRequest.setRequestStatus("test"); + + EPUserAppRolesRequestDetail epUserAppRolesRequestDetail = mockEPUserAppRolesRequestDetail(); + + EPUserAppRolesRequestDetail epUserAppRolesRequestDetail1 = new EPUserAppRolesRequestDetail(); + epUserAppRolesRequestDetail1.setReqRoleId((long)1); + epUserAppRolesRequestDetail1.setReqType("test"); + epUserAppRolesRequestDetail1.setEpRequestIdData(epUserAppRolesRequest); + + assertEquals(epUserAppRolesRequestDetail.getReqRoleId(), new Long(1)); + assertEquals(epUserAppRolesRequestDetail.getReqType(), "test"); + assertEquals(epUserAppRolesRequestDetail.getEpRequestIdData(), epUserAppRolesRequest); + assertEquals(epUserAppRolesRequestDetail.hashCode(), epUserAppRolesRequestDetail1.hashCode()); + + } + +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesTest.java new file mode 100644 index 00000000..540c63e9 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesTest.java @@ -0,0 +1,28 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.EPUserAppRoles; + +public class EPUserAppRolesTest { + + public EPUserAppRoles mockEPUserAppRoles(){ + EPUserAppRoles epUserAppRoles = new EPUserAppRoles(); + + epUserAppRoles.setRoleId((long)1); + epUserAppRoles.setAppId((long)1); + + return epUserAppRoles; + } + + @Test + public void epUserAppRolesTest(){ + EPUserAppRoles epUserAppRoles = mockEPUserAppRoles(); + + assertEquals(epUserAppRoles.getRoleId(), new Long(1)); + assertEquals(epUserAppRoles.getAppId(), new Long(1)); + assertEquals("EpUserAppRoles [roleId=1, appId=1]", epUserAppRoles.toString()); + } +} + diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppTest.java new file mode 100644 index 00000000..0c450ebb --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppTest.java @@ -0,0 +1,85 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.EPApp; +import org.openecomp.portalapp.portal.domain.EPRole; +import org.openecomp.portalapp.portal.domain.EPUserApp; + +public class EPUserAppTest { + + public EPUserApp mockEPUserApp(){ + + EPApp epApp = new EPApp(); + epApp.setName("test"); + epApp.setImageUrl("test"); + epApp.setDescription("test"); + epApp.setNotes("test"); + epApp.setUrl("test"); + epApp.setAlternateUrl("test"); + epApp.setAppRestEndpoint("test"); + epApp.setMlAppName("test"); + epApp.setMlAppAdminId("test"); + epApp.setMotsId((long)1); + epApp.setUsername("test"); + epApp.setAppPassword("test"); + + + //Role + EPRole epRole = new EPRole(); + epRole.setName("test"); + epRole.setActive(false); + epRole.setPriority(1); + epRole.setAppId((long)1); + epRole.setAppRoleId((long)1); + + EPUserApp user = new EPUserApp(); + user.setUserId((long)1); + user.setApp(epApp); + user.setRole(epRole); + user.setPriority((short)32767); + + + return user; + } + + @Test + public void userTest(){ + EPUserApp user = mockEPUserApp(); + + EPApp epApp = new EPApp(); + epApp.setName("test"); + epApp.setImageUrl("test"); + epApp.setDescription("test"); + epApp.setNotes("test"); + epApp.setUrl("test"); + epApp.setAlternateUrl("test"); + epApp.setAppRestEndpoint("test"); + epApp.setMlAppName("test"); + epApp.setMlAppAdminId("test"); + epApp.setMotsId((long)1); + epApp.setUsername("test"); + epApp.setAppPassword("test"); + user.setApp(epApp); + + //Role + EPRole epRole = new EPRole(); + epRole.setName("test"); + epRole.setActive(false); + epRole.setPriority(1); + epRole.setAppId((long)1); + epRole.setAppRoleId((long)1); + + + assertEquals(user.getUserId(),Long.valueOf(1)); + assertEquals(user.getApp(), epApp); + assertEquals(user.getPriority().getClass(), Short.class); + + assertEquals(user.toString(), "[u: 1; a: null, r: null; appRoleId: 1]"); + + assertEquals(user.hashCode(), user.hashCode()); + + + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsManualSortPreferenceTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsManualSortPreferenceTest.java new file mode 100644 index 00000000..afad6f63 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsManualSortPreferenceTest.java @@ -0,0 +1,29 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.EPUserAppsManualSortPreference; + +public class EPUserAppsManualSortPreferenceTest { + + public EPUserAppsManualSortPreference mockEPUserAppsManualSortPreference(){ + + EPUserAppsManualSortPreference epUserAppsManualSortPreference = new EPUserAppsManualSortPreference(); + epUserAppsManualSortPreference.setUserId(1); + epUserAppsManualSortPreference.setAppId((long)1); + epUserAppsManualSortPreference.setAppManualSortOrder(1); + + return epUserAppsManualSortPreference; + } + + @Test + public void epUserAppsManualSortPreferenceTest(){ + + EPUserAppsManualSortPreference epUserAppsManualSortPreference = mockEPUserAppsManualSortPreference(); + + assertEquals(epUserAppsManualSortPreference.getUserId(), 1); + assertEquals(epUserAppsManualSortPreference.getAppId(), new Long(1)); + assertEquals(epUserAppsManualSortPreference.getAppManualSortOrder(), 1); + + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsSortPreferenceTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsSortPreferenceTest.java new file mode 100644 index 00000000..545c16d5 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsSortPreferenceTest.java @@ -0,0 +1,43 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import java.util.Date; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.EPUserAppsSortPreference; + +public class EPUserAppsSortPreferenceTest { + + public EPUserAppsSortPreference mockEPUserAppsSortPreferenceTest(){ + + EPUserAppsSortPreference epUserAppsSortPreference = new EPUserAppsSortPreference(); + epUserAppsSortPreference.setUserId(1); + epUserAppsSortPreference.setSortPref("test"); + epUserAppsSortPreference.setId((long)1); + epUserAppsSortPreference.setCreated(new Date()); + epUserAppsSortPreference.setModified(new Date()); + epUserAppsSortPreference.setModifiedId((long)1); + epUserAppsSortPreference.setRowNum((long)1); + epUserAppsSortPreference.setAuditTrail(null); + + return epUserAppsSortPreference; + } + + @Test + public void epUserAppsSortPreferenceTest() { + EPUserAppsSortPreference epUserAppsSortPreference = mockEPUserAppsSortPreferenceTest(); + + assertEquals(epUserAppsSortPreference.getUserId(), 1); + assertEquals(epUserAppsSortPreference.getSortPref(), "test"); + assertEquals(epUserAppsSortPreference.getId(), new Long(1)); + assertEquals(epUserAppsSortPreference.getCreated(), new Date()); + assertEquals(epUserAppsSortPreference.getModified(), new Date()); + assertEquals(epUserAppsSortPreference.getModifiedId(), new Long(1)); + assertEquals(epUserAppsSortPreference.getRowNum(), new Long(1)); + assertEquals(epUserAppsSortPreference.getAuditTrail(), null); + + + } + +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserNotificationTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserNotificationTest.java new file mode 100644 index 00000000..64313e52 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserNotificationTest.java @@ -0,0 +1,34 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import java.util.Date; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.EPUserNotification; + +public class EPUserNotificationTest { + + public EPUserNotification mockEPUserNotification(){ + + EPUserNotification epUserNotification = new EPUserNotification(); + + epUserNotification.setUserId((long)1); + epUserNotification.setNotificationId((long)1); + epUserNotification.setViewed("test"); + epUserNotification.setUpdateTime(new Date()); + + return epUserNotification; + } + + @Test + public void epUserNotificationTest(){ + EPUserNotification epUserNotification = mockEPUserNotification(); + + assertEquals(epUserNotification.getUserId(), new Long(1)); + assertEquals(epUserNotification.getNotificationId(), new Long(1)); + assertEquals(epUserNotification.getViewed(), "test"); + // assertEquals(epUserNotification.getUpdateTime(), new Date()); + + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserTest.java new file mode 100644 index 00000000..54e6193d --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserTest.java @@ -0,0 +1,114 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import java.util.Date; + +import org.junit.Test; +import org.openecomp.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=[]]"); + } + +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPWidgetsManualSortPreferenceTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPWidgetsManualSortPreferenceTest.java new file mode 100644 index 00000000..69aa3db0 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPWidgetsManualSortPreferenceTest.java @@ -0,0 +1,36 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.EPWidgetsManualSortPreference; + +public class EPWidgetsManualSortPreferenceTest { + + public EPWidgetsManualSortPreference mockEPWidgetsManualSortPreference(){ + EPWidgetsManualSortPreference epWidgetsManualSortPreference = new EPWidgetsManualSortPreference(); + + epWidgetsManualSortPreference.setUserId(1); + epWidgetsManualSortPreference.setWidgetId((long)1); + epWidgetsManualSortPreference.setWidgetRow(1); + epWidgetsManualSortPreference.setWidgetCol(1); + epWidgetsManualSortPreference.setWidgetWidth(1); + epWidgetsManualSortPreference.setWidgetHeight(1); + + return epWidgetsManualSortPreference; + } + + @Test + public void epWidgetsManualSortPreferenceTest(){ + EPWidgetsManualSortPreference epWidgetsManualSortPreference = mockEPWidgetsManualSortPreference(); + + assertEquals(epWidgetsManualSortPreference.getWidgetId(), new Long(1)); + assertEquals(epWidgetsManualSortPreference.getUserId(), 1); + assertEquals(epWidgetsManualSortPreference.getWidgetRow(), 1); + assertEquals(epWidgetsManualSortPreference.getWidgetCol(), 1); + assertEquals(epWidgetsManualSortPreference.getWidgetHeight(), 1); + assertEquals(epWidgetsManualSortPreference.getWidgetWidth(), 1); + + + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleIdTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleIdTest.java new file mode 100644 index 00000000..ca2bdfb3 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleIdTest.java @@ -0,0 +1,33 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.EcompAppRoleId; + +public class EcompAppRoleIdTest { + + public EcompAppRoleId mockEcompAppRoleId(){ + + EcompAppRoleId ecompAppRoleId = new EcompAppRoleId(); + + ecompAppRoleId.setAppId((long)1); + ecompAppRoleId.setAppName("test"); + ecompAppRoleId.setRoleId(1); + ecompAppRoleId.setRoleName("test"); + + return ecompAppRoleId; + } + + @Test + public void ecompAppRoleIdTest(){ + + EcompAppRoleId ecompAppRoleId = mockEcompAppRoleId(); + + assertEquals(ecompAppRoleId.getAppId(), new Long(1)); + assertEquals(ecompAppRoleId.getAppName(), "test"); + assertEquals(ecompAppRoleId.getRoleId().toString(), "1"); + assertEquals(ecompAppRoleId.getRoleName(), "test"); + } + +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleTest.java new file mode 100644 index 00000000..4ba244b7 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleTest.java @@ -0,0 +1,31 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.EcompAppRole; + +public class EcompAppRoleTest { + + public EcompAppRole mockEcompAppRole(){ + EcompAppRole ecompAppRole = new EcompAppRole(); + + ecompAppRole.setAppId((long)1); + ecompAppRole.setAppName("test"); + ecompAppRole.setRoleId(1); + ecompAppRole.setRoleName("test"); + + return ecompAppRole; + } + + @Test + public void ecompAppRoleTest(){ + EcompAppRole ecompAppRole = mockEcompAppRole(); + + assertEquals(ecompAppRole.getAppId(), new Long(1)); + assertEquals(ecompAppRole.getAppName(), "test"); + assertEquals(ecompAppRole.getRoleId().toString(), "1"); + assertEquals(ecompAppRole.getRoleName(), "test"); + + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalRoleDetailsTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalRoleDetailsTest.java new file mode 100644 index 00000000..e007102c --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalRoleDetailsTest.java @@ -0,0 +1,59 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.EPAppRoleFunction; +import org.openecomp.portalapp.portal.domain.ExternalRoleDetails; + +public class ExternalRoleDetailsTest { + + public ExternalRoleDetails mockExternalRoleDetails(){ + + List<EPAppRoleFunction> epAppRoleFunctionList = new ArrayList<EPAppRoleFunction>(); + + EPAppRoleFunction epAppRoleFunction = new EPAppRoleFunction(); + epAppRoleFunction.setRoleId((long)1); + epAppRoleFunction.setAppId((long)1); + epAppRoleFunction.setCode("test"); + + epAppRoleFunctionList.add(epAppRoleFunction); + + ExternalRoleDetails externalRoleDetails = new ExternalRoleDetails(); + + externalRoleDetails.setName("test"); + externalRoleDetails.setActive(false); + externalRoleDetails.setPriority(1); + externalRoleDetails.setAppId((long)1); + externalRoleDetails.setAppRoleId((long)1); + externalRoleDetails.setPerms(epAppRoleFunctionList); + + return externalRoleDetails; + } + + @Test + public void externalRoleDetailsTest(){ + + List<EPAppRoleFunction> epAppRoleFunctionList = new ArrayList<EPAppRoleFunction>(); + + EPAppRoleFunction epAppRoleFunction = new EPAppRoleFunction(); + epAppRoleFunction.setRoleId((long)1); + epAppRoleFunction.setAppId((long)1); + epAppRoleFunction.setCode("test"); + + epAppRoleFunctionList.add(epAppRoleFunction); + + ExternalRoleDetails externalRoleDetails = mockExternalRoleDetails(); + + assertEquals(externalRoleDetails.getAppId(), new Long(1)); + assertEquals(externalRoleDetails.getAppRoleId(), new Long(1)); + assertEquals(externalRoleDetails.getPriority().toString(), "1"); + assertEquals(externalRoleDetails.getName(), "test"); + assertEquals(externalRoleDetails.getPriority().toString(), "1"); + assertEquals(externalRoleDetails.getPerms().size(), epAppRoleFunctionList.size()); + + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemAccessTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemAccessTest.java new file mode 100644 index 00000000..ea884578 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemAccessTest.java @@ -0,0 +1,27 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.ExternalSystemAccess; + +public class ExternalSystemAccessTest { + + public ExternalSystemAccess mockExternalSystemAccess(){ + ExternalSystemAccess externalSystemAccess = new ExternalSystemAccess("test", false); + + externalSystemAccess.setKey("test"); + externalSystemAccess.setAccessValue(false); + + return externalSystemAccess; + } + + @Test + public void externalSystemAccessTest(){ + ExternalSystemAccess externalSystemAccess = mockExternalSystemAccess(); + + assertEquals(externalSystemAccess.getKey(), "test"); + assertEquals(externalSystemAccess.getAccessValue(), false); + } +} + diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemRoleApprovalTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemRoleApprovalTest.java new file mode 100644 index 00000000..2c47ed5a --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemRoleApprovalTest.java @@ -0,0 +1,23 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.externalsystemapproval.model.ExternalSystemRoleApproval; + +public class ExternalSystemRoleApprovalTest { + + public ExternalSystemRoleApproval mockExternalSystemRoleApproval(){ + ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval(); + externalSystemRoleApproval.setRoleName("test"); + + return externalSystemRoleApproval; + } + + @Test + public void externalSystemRoleApprovalTest(){ + ExternalSystemRoleApproval externalSystemRoleApproval = mockExternalSystemRoleApproval(); + + assertEquals(externalSystemRoleApproval.getRoleName(), "test"); + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/FunctionalMenuItemWithAppIDTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/FunctionalMenuItemWithAppIDTest.java new file mode 100644 index 00000000..abec873b --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/FunctionalMenuItemWithAppIDTest.java @@ -0,0 +1,28 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.FunctionalMenuItemWithAppID; + +public class FunctionalMenuItemWithAppIDTest { + + public FunctionalMenuItemWithAppID mockFunctionalMenuItemWithAppID(){ + FunctionalMenuItemWithAppID functionalMenuItemWithAppID = new FunctionalMenuItemWithAppID(); + + functionalMenuItemWithAppID.setRestrictedApp(false); + functionalMenuItemWithAppID.setUrl("test"); + + + return functionalMenuItemWithAppID; + } + + @Test + public void functionalMenuItemWithAppIDTest(){ + FunctionalMenuItemWithAppID functionalMenuItemWithAppID = mockFunctionalMenuItemWithAppID(); + + assertEquals(functionalMenuItemWithAppID.toString(), "FunctionalMenuItem [menuId=null, column=null, text=null, parentMenuId=null, url=test, active_yn=null, appid=null, roles=null, restrictedApp=false]"); + + } + +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/GetAccessResultIdTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/GetAccessResultIdTest.java new file mode 100644 index 00000000..90a65eb8 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/GetAccessResultIdTest.java @@ -0,0 +1,29 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.GetAccessResultId; + +public class GetAccessResultIdTest { + + public GetAccessResultId mockGetAccessResultId(){ + + GetAccessResultId getAccessResultIdObj = new GetAccessResultId(); + getAccessResultIdObj.setEcompFunction("test"); + getAccessResultIdObj.setAppName("test"); + getAccessResultIdObj.setRoleName("test"); + + return getAccessResultIdObj; + } + + @Test + public void getAccessResultIdObjTest(){ + GetAccessResultId getAccessResultIdObj = mockGetAccessResultId(); + + assertEquals(getAccessResultIdObj.getEcompFunction(), "test"); + assertEquals(getAccessResultIdObj.getAppName(), "test"); + assertEquals(getAccessResultIdObj.getRoleName(), "test"); + + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceDataTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceDataTest.java new file mode 100644 index 00000000..d7e4ca29 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceDataTest.java @@ -0,0 +1,57 @@ +package org.openecomp.portalapp.portal.test.domain; + +import java.util.ArrayList; +import java.util.List; +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.MicroserviceData; +import org.openecomp.portalapp.portal.domain.MicroserviceParameter; + +public class MicroserviceDataTest { + + public MicroserviceData mockMicroserviceData(){ + + MicroserviceData microserviceData= new MicroserviceData(); + + List<MicroserviceParameter> parameterList = new ArrayList<MicroserviceParameter>(); + + MicroserviceParameter microserviceParameter = new MicroserviceParameter(); + microserviceParameter.setId((long)1); + microserviceParameter.setServiceId((long)1); + microserviceParameter.setPara_key("test"); + microserviceParameter.setPara_value("test"); + parameterList.add(microserviceParameter); + + microserviceData.setId((long)1); + microserviceData.setName("test"); + microserviceData.setActive("test"); + microserviceData.setDesc("test"); + microserviceData.setAppId((long)1); + microserviceData.setUrl("test"); + microserviceData.setSecurityType("test"); + microserviceData.setUsername("test"); + microserviceData.setPassword("test"); + + + return microserviceData; + } + + @Test + public void microserviceDataTest(){ + MicroserviceData microserviceData= mockMicroserviceData(); + + assertEquals(microserviceData.getId(), new Long(1)); + assertEquals(microserviceData.getName(), "test"); + assertEquals(microserviceData.getActive(), "test"); + assertEquals(microserviceData.getDesc(), "test"); + // assertEquals(microserviceData.getAppId(), new long(1)); + assertEquals(microserviceData.getUrl(), "test"); + assertEquals(microserviceData.getSecurityType(), "test"); + assertEquals(microserviceData.getUsername(), "test"); + assertEquals(microserviceData.getPassword(), "test"); + + assertEquals(microserviceData.toString(), "MicroserviceData [id=1, name=test, desc=test, appId=1, " + + "url=test, securityType=test, username=test, password=test, parameterList=null]"); + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceParameterTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceParameterTest.java new file mode 100644 index 00000000..e15f2267 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceParameterTest.java @@ -0,0 +1,31 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.MicroserviceParameter; + +public class MicroserviceParameterTest { + + public MicroserviceParameter mockMicroserviceParameter(){ + MicroserviceParameter microserviceParameter = new MicroserviceParameter(); + + microserviceParameter.setId((long)1); + microserviceParameter.setServiceId((long)1); + microserviceParameter.setPara_key("test"); + microserviceParameter.setPara_value("test"); + + return microserviceParameter; + } + + @Test + public void microserviceParameterTest(){ + MicroserviceParameter microserviceParameter = mockMicroserviceParameter(); + assertEquals(microserviceParameter.getId(), new Long(1)); + assertEquals(microserviceParameter.getServiceId(),(long)1); + assertEquals(microserviceParameter.getPara_key(), "test"); + assertEquals(microserviceParameter.getPara_value(), "test"); + + assertEquals(microserviceParameter.toString(), "MicroserviceParameter [id=1, serviceId=1, para_key=test, para_value=test]"); + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserAppSelectionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserAppSelectionTest.java new file mode 100644 index 00000000..7f4bdc1b --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserAppSelectionTest.java @@ -0,0 +1,35 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.PersUserAppSelection; + +public class PersUserAppSelectionTest { + + public PersUserAppSelection mockPersUserAppSelection(){ + + PersUserAppSelection persUserAppSelection = new PersUserAppSelection(); + persUserAppSelection.setUserId((long)1); + persUserAppSelection.setAppId((long)1); + persUserAppSelection.setStatusCode("test"); + + return persUserAppSelection; + } + + @Test + public void persUserAppSelectionTest(){ + + PersUserAppSelection persUserAppSelection1 = new PersUserAppSelection((long)1, (long)1, (long)1,"test"); + + PersUserAppSelection persUserAppSelection = mockPersUserAppSelection(); + + assertEquals(persUserAppSelection.getUserId(), new Long(1)); + assertEquals(persUserAppSelection.getAppId(), new Long(1)); + assertEquals(persUserAppSelection.getStatusCode(), "test"); + assertEquals(persUserAppSelection1.hashCode(), new PersUserAppSelection((long)1, (long)1, (long)1,"test").hashCode()); + assertEquals(persUserAppSelection1, new PersUserAppSelection((long)1, (long)1, (long)1,"test")); + assertTrue(persUserAppSelection1.equals(new PersUserAppSelection((long)1, (long)1, (long)1,"test"))); + } + +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserWidgetSelectionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserWidgetSelectionTest.java new file mode 100644 index 00000000..55e1bd64 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserWidgetSelectionTest.java @@ -0,0 +1,36 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.PersUserWidgetSelection; + +public class PersUserWidgetSelectionTest { + + public PersUserWidgetSelection mockPersUserWidgetSelection(){ + + PersUserWidgetSelection persUserWidgetSelection = new PersUserWidgetSelection(); + + persUserWidgetSelection.setUserId((long)1); + persUserWidgetSelection.setWidgetId((long)1); + persUserWidgetSelection.setStatusCode("test"); + + return persUserWidgetSelection; + } + + @Test + public void persUserWidgetSelectionTest(){ + PersUserWidgetSelection persUserWidgetSelection = mockPersUserWidgetSelection(); + + PersUserWidgetSelection persUserWidgetSelection1 = new PersUserWidgetSelection((long)1, (long)1, (long)1, "test"); + + assertEquals(persUserWidgetSelection.getUserId(), new Long(1)); + assertEquals(persUserWidgetSelection.getWidgetId(), new Long(1)); + assertEquals(persUserWidgetSelection.getStatusCode(), "test"); + assertEquals(persUserWidgetSelection1, new PersUserWidgetSelection((long)1, (long)1, (long)1, "test")); + assertTrue(persUserWidgetSelection1.equals(new PersUserWidgetSelection((long)1, (long)1, (long)1,"test"))); + assertEquals(persUserWidgetSelection.hashCode(), persUserWidgetSelection1.hashCode()); + } + +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ResultTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ResultTest.java new file mode 100644 index 00000000..6763cc0b --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ResultTest.java @@ -0,0 +1,29 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.model.Result; + +public class ResultTest { + + public Result mockResult(){ + + Result result= new Result("test"); + + result.setResult("test"); + return result; + } + + @Test + public void resultTest(){ + + Result result = mockResult(); + result.setResult("test"); + + assertEquals(result.getResult(), "test"); + + } + + +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/SharedContextTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/SharedContextTest.java new file mode 100644 index 00000000..239080d2 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/SharedContextTest.java @@ -0,0 +1,36 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import java.util.Date; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.SharedContext; + +public class SharedContextTest { + + public SharedContext mockSharedContext(){ + + SharedContext sharedContext = new SharedContext(); + sharedContext.setId((long)1); + sharedContext.setCreate_time(new Date()); + sharedContext.setContext_id("test"); + sharedContext.setCkey("test"); + sharedContext.setCvalue("test"); + + return sharedContext; + } + + @Test + public void sharedContextTest(){ + SharedContext sharedContext = mockSharedContext(); + + assertEquals(sharedContext.getId(), new Long(1)); + // assertEquals(sharedContext.getCreate_time(), new Date()); + assertEquals(sharedContext.getContext_id(), "test"); + assertEquals(sharedContext.getCkey(), "test"); + assertEquals(sharedContext.getCvalue(), "test"); + + + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/UserIdRoleIdTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/UserIdRoleIdTest.java new file mode 100644 index 00000000..169d8798 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/UserIdRoleIdTest.java @@ -0,0 +1,29 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.UserIdRoleId; + +public class UserIdRoleIdTest { + + public UserIdRoleId mockUserIdRoleId(){ + UserIdRoleId userIdRoleId = new UserIdRoleId(); + userIdRoleId.setUser_Id("test"); + userIdRoleId.setRoleId("test"); + userIdRoleId.setOrgUserId("test"); + userIdRoleId.setAppId("test"); + + return userIdRoleId; + } + + @Test + public void userIdRoleIdTest(){ + UserIdRoleId userIdRoleId = mockUserIdRoleId(); + + assertEquals(userIdRoleId.getUser_Id(), "test"); + assertEquals(userIdRoleId.getRoleId(), "test"); + assertEquals(userIdRoleId.getOrgUserId(), "test"); + assertEquals(userIdRoleId.getAppId(), "test"); + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogParameterTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogParameterTest.java new file mode 100644 index 00000000..fe525d7b --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogParameterTest.java @@ -0,0 +1,33 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.WidgetCatalogParameter; + +public class WidgetCatalogParameterTest { + + public WidgetCatalogParameter mockWidgetCatalogParameter(){ + WidgetCatalogParameter widgetCatalogParameter = new WidgetCatalogParameter(); + + widgetCatalogParameter.setId((long)1); + widgetCatalogParameter.setWidgetId((long)1); + widgetCatalogParameter.setUserId((long)1); + widgetCatalogParameter.setParamId((long)1); + widgetCatalogParameter.setUser_value("test"); + + return widgetCatalogParameter; + } + + @Test + public void widgetCatalogParameterTest(){ + WidgetCatalogParameter widgetCatalogParameter = mockWidgetCatalogParameter(); + + assertEquals(widgetCatalogParameter.getId(), new Long(1)); + assertEquals(widgetCatalogParameter.getWidgetId(), new Long(1)); + assertEquals(widgetCatalogParameter.getUserId(), new Long(1)); + assertEquals(widgetCatalogParameter.getParamId(), new Long(1)); + assertEquals(widgetCatalogParameter.getUser_value(), "test"); + assertEquals(widgetCatalogParameter.toString(), "WidgetCatalogParameter [id=1, widgetId=1, userId=1, paramId=1, user_value=test]"); + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogTest.java new file mode 100644 index 00000000..3b7aa764 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogTest.java @@ -0,0 +1,84 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; + +import java.util.HashSet; +import java.util.Set; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.App; +import org.openecomp.portalapp.portal.domain.RoleApp; +import org.openecomp.portalapp.portal.domain.WidgetCatalog; + +public class WidgetCatalogTest { + + public WidgetCatalog mockWidgetCatalog() { + + WidgetCatalog widgetCatalog = new WidgetCatalog(); + + Set<RoleApp> roleAppSet = new HashSet<RoleApp>(); + // App + App app = new App(); + app.setAppId((long) 1); + app.setAppName("test"); + + // RoleApp + RoleApp roleApp = new RoleApp(); + roleApp.setRoleId((long) 1); + roleApp.setRoleName("test"); + roleApp.setApp(app); + roleApp.setWidgets(null); + + roleAppSet.add(roleApp); + + widgetCatalog.setId((long) 1); + widgetCatalog.setName("test"); + widgetCatalog.setDesc("test"); + widgetCatalog.setFileLocation("test"); + widgetCatalog.setAllowAllUser("test"); + widgetCatalog.setServiceId((long) 1); + widgetCatalog.setSortOrder("test"); + widgetCatalog.setStatusCode("test"); + + widgetCatalog.setWidgetRoles(roleAppSet); + + return widgetCatalog; + + } + + @Test + public void widgetCatalogTest() { + + // App + App app = new App(); + app.setAppId((long) 1); + app.setAppName("test"); + + Set<RoleApp> roleAppSet = new HashSet<RoleApp>(); + // RoleApp + RoleApp roleApp = new RoleApp(); + roleApp.setRoleId((long) 1); + roleApp.setRoleName("test"); + roleApp.setApp(app); + roleApp.setWidgets(null); + + roleAppSet.add(roleApp); + + WidgetCatalog widgetCatalog = mockWidgetCatalog(); + + + assertEquals(widgetCatalog.getId(), (long)1); + assertEquals(widgetCatalog.getName(), "test"); + assertEquals(widgetCatalog.getDesc(), "test"); + assertEquals(widgetCatalog.getFileLocation(), "test"); + assertEquals(widgetCatalog.getAllowAllUser(), "test"); + assertEquals(widgetCatalog.getServiceId(), new Long (1)); + assertEquals(widgetCatalog.getSortOrder(), "test"); + assertEquals(widgetCatalog.getStatusCode(), "test"); + assertEquals(widgetCatalog.getWidgetRoles().size(),1); + + assertEquals("WidgetCatalog [id=1, name=test, desc=test, fileLocation=test, allowAllUser=test]", widgetCatalog.toString()); + } + +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetParameterResultTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetParameterResultTest.java new file mode 100644 index 00000000..75b3d606 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetParameterResultTest.java @@ -0,0 +1,33 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.WidgetParameterResult; + +public class WidgetParameterResultTest { + + public WidgetParameterResult mockWidgetParameterResult(){ + + WidgetParameterResult widgetParameterResult = new WidgetParameterResult(); + widgetParameterResult.setParam_id((long)1); + widgetParameterResult.setParam_key("test"); + widgetParameterResult.setUser_value("test"); + widgetParameterResult.setDefault_value("test"); + + return widgetParameterResult; + } + + @Test + public void widgetParameterResultTest(){ + + WidgetParameterResult widgetParameterResult = mockWidgetParameterResult(); + + assertEquals(widgetParameterResult.getParam_key(), "test"); + assertEquals(widgetParameterResult.getParam_id(), new Long(1)); + assertEquals(widgetParameterResult.getUser_value(), "test"); + assertEquals(widgetParameterResult.getDefault_value(), "test"); + + assertEquals("WidgetParameterResult [param_id=1, param_key=test, user_value=test, default_value=test]", widgetParameterResult.toString()); + } +} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetTest.java new file mode 100644 index 00000000..a7597982 --- /dev/null +++ b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetTest.java @@ -0,0 +1,34 @@ +package org.openecomp.portalapp.portal.test.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.openecomp.portalapp.portal.domain.Widget; + +public class WidgetTest { + + public Widget mockWidget(){ + + Widget widget = new Widget(); + widget.setName("test"); + widget.setWidth(100); + widget.setHeight(100); + widget.setUrl("test"); + widget.setAppId((long)1); + + return widget; + } + + @Test + public void widgetTest(){ + Widget widget = mockWidget(); + + assertEquals(widget.getName(), "test"); + assertTrue(widget.getWidth() == 100); + assertTrue(widget.getHeight() == 100); + assertEquals(widget.getUrl(), "test"); + assertEquals(widget.getAppId(), new Long(1)); + + + } +} |