summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-core/src
diff options
context:
space:
mode:
authorHima Elisetty <hbindu@research.att.com>2018-02-07 17:12:02 -0500
committerHima Elisetty <hbindu@research.att.com>2018-02-07 17:12:02 -0500
commit558eb8fc1392428dbabc4d6016713bff99d6425f (patch)
tree7ff7952210e824aaf4697e6792527debc125c7a5 /ecomp-sdk/epsdk-core/src
parent0127650b2fd9b2846aabf8f955bb7e2cfb983f22 (diff)
Added Junits
Issue-ID: PORTAL-136, PORTAL-188 Includes FW mode central changes Change-Id: Iba6c0d48ed768e32d1fe4700d0044eb7f3fdc482 Signed-off-by: Hima Elisetty <hbindu@research.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-core/src')
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/LoginBeanTest.java88
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/PostDroolsBeanTest.java65
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/PostSearchBeanTest.java193
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/UserRowBeanTest.java76
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/support/SearchResultTest.java76
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AppTest.java123
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AuditLogTest.java73
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/BroadcastMessageTest.java101
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/FnMenuTest.java98
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LoginBeanTest.java83
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LookupTest.java73
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuCountryTest.java77
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuStateTest.java65
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuTimeZoneTest.java68
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuDataTest.java72
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuTest.java84
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/ProfileTest.java70
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleFunctionTest.java69
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleTest.java111
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleKeyTest.java77
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleTest.java75
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppIdTest.java87
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppTest.java89
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserTest.java216
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/sessionmgt/TimeoutVOTest.java82
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/AppServiceImplTest.java97
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/AuditServiceImplTest.java60
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/BroadcastServiceImplTest.java182
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/DataAccessServiceImplTest.java350
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ElementLinkServiceTest.java204
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ElementMapServiceTest.java481
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FnMenuServiceImplTest.java181
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImplTest.java77
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceImplTest.java79
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LdapServiceImplTest.java156
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LocalAccessConditionTest.java78
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LoginServiceCentralizedImplTest.java200
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LoginServiceImplTest.java185
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/PostSearchServiceImplTest.java188
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ProfileServiceCentralizedImplTest.java89
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ProfileServiceImplTest.java99
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RestApiRequestBuilderTest.java292
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccessTest.java165
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceImplTest.java256
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UrlAccessImplTest.java97
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UserProfileServiceImplTest.java91
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/AttributeTest.java79
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/CollaborateListTest.java60
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ContainerTest.java193
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainTest.java143
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainVOTest.java107
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementDetailsTest.java64
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementTest.java77
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/FusionCommandTest.java65
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/LayoutTest.java336
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/NameValueIdTest.java82
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/PositionTest.java68
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/SizeTest.java69
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/sdkapp/core/onboarding/client/AppContextManagerTest.java64
59 files changed, 7305 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/LoginBeanTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/LoginBeanTest.java
new file mode 100644
index 00000000..11fbe61a
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/LoginBeanTest.java
@@ -0,0 +1,88 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.command;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class LoginBeanTest {
+
+
+ public LoginBean mockLoginBean()
+ {
+ LoginBean mockLoginBean = new LoginBean();
+ mockLoginBean.setLoginId("test12");
+ mockLoginBean.setLoginPwd("testPwd");
+ mockLoginBean.setHrid(null);
+ mockLoginBean.setUserid("test12");
+ mockLoginBean.setSiteAccess("testSiteAccess");
+ mockLoginBean.setLoginErrorMessage("error");
+ mockLoginBean.setUser(null);
+ mockLoginBean.setBusinessDirectMenu(null);
+ mockLoginBean.setMenu(null);
+ return mockLoginBean;
+ }
+
+ @Test
+ public void loginBeanTest()
+ {
+ LoginBean mockLoginBean = mockLoginBean();
+ LoginBean loginBean = new LoginBean();
+ loginBean.setLoginId("test12");
+ loginBean.setLoginPwd("testPwd");
+ loginBean.setHrid(null);
+ loginBean.setUserid("test12");
+ loginBean.setSiteAccess("testSiteAccess");
+ loginBean.setLoginErrorMessage("error");
+ loginBean.setUser(null);
+ loginBean.setBusinessDirectMenu(null);
+ loginBean.setMenu(null);
+
+ assertEquals(loginBean.getLoginId(),mockLoginBean.getLoginId());
+ assertEquals(loginBean.getLoginPwd(),mockLoginBean.getLoginPwd());
+ assertEquals(loginBean.getHrid(),mockLoginBean.getHrid());
+ assertEquals(loginBean.getSiteAccess(),mockLoginBean.getSiteAccess());
+ assertEquals(loginBean.getUserid(),mockLoginBean.getUserid());
+ assertEquals(loginBean.getLoginErrorMessage(),mockLoginBean.getLoginErrorMessage());
+ assertEquals(loginBean.getUser(),mockLoginBean.getUser());
+ assertEquals(loginBean.getBusinessDirectMenu(),mockLoginBean.getBusinessDirectMenu());
+ assertEquals(loginBean.getMenu(),mockLoginBean.getMenu());
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/PostDroolsBeanTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/PostDroolsBeanTest.java
new file mode 100644
index 00000000..58e946ae
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/PostDroolsBeanTest.java
@@ -0,0 +1,65 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.command;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class PostDroolsBeanTest {
+
+ public PostDroolsBean mockPostDroolsBean() {
+ PostDroolsBean mockpostDroolsBean = new PostDroolsBean();
+ mockpostDroolsBean.setDroolsFile("testFile");
+ mockpostDroolsBean.setClassName("testClass");
+ mockpostDroolsBean.setSelectedRules("testRules");
+ return mockpostDroolsBean;
+ }
+
+ @Test
+ public void postDroolsBeanTest() {
+ PostDroolsBean mockpostDroolsBean = mockPostDroolsBean();
+ PostDroolsBean postDroolsBean = new PostDroolsBean();
+ postDroolsBean.setDroolsFile("testFile");
+ postDroolsBean.setClassName("testClass");
+ postDroolsBean.setSelectedRules("testRules");
+ assertEquals(postDroolsBean.getDroolsFile(), mockpostDroolsBean.getDroolsFile());
+ assertEquals(postDroolsBean.getClassName(), mockpostDroolsBean.getClassName());
+ assertEquals(postDroolsBean.getSelectedRules(), mockpostDroolsBean.getSelectedRules());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/PostSearchBeanTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/PostSearchBeanTest.java
new file mode 100644
index 00000000..b5bc3477
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/PostSearchBeanTest.java
@@ -0,0 +1,193 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.command;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class PostSearchBeanTest {
+
+
+ public PostSearchBean mockPostSearchBean()
+ {
+ PostSearchBean postSearchBean= new PostSearchBean();
+// postSearchBean.setUser(null);
+// postSearchBean.setUserOrig(null);
+ postSearchBean.setSelected(new String[] {"testSelected"});
+ postSearchBean.setPostHrid(new String[] {"testPostHrid"});
+ postSearchBean.setPostOrgUserId(new String[] {"testPostOrgUserId"});
+ postSearchBean.setPostFirstName(new String[] {"testPostFirstName"});
+ postSearchBean.setPostLastName(new String[] {"testPostLastName"});
+ postSearchBean.setPostOrgCode(new String[] {"testPostOrgCode"});
+ postSearchBean.setPostPhone(new String[] {"testPostPhone"});
+ postSearchBean.setPostEmail(new String[] {"testPostEmail"});
+ postSearchBean.setPostAddress1(new String[] {"testPostAddress1"});
+ postSearchBean.setPostAddress2(new String[] {"testPostAddress2"});
+ postSearchBean.setPostCity(new String[] {"testPostCity"});
+ postSearchBean.setPostState(new String[] {"testPostState"});
+ postSearchBean.setPostZipCode(new String[] {"testPostZipCode"});
+ postSearchBean.setPostLocationClli(new String[] {"testPostLocationClli"});
+ postSearchBean.setPostBusinessCountryCode(new String[] {"testPostBusinessCountryCode"});
+ postSearchBean.setPostBusinessCountryName(new String[] {"testPostBusinessCountryName"});
+ postSearchBean.setPostDepartment(new String[] {"testPostDepartment"});
+ postSearchBean.setPostDepartmentName(new String[] {"testPostDepartmentName"});
+ postSearchBean.setPostBusinessUnit(new String[] {"testPostBusinessUnit"});
+ postSearchBean.setPostBusinessUnitName(new String[] {"testPostBusinessUnitName"});
+ postSearchBean.setPostJobTitle(new String[] {"testPostJobTitle"});
+ postSearchBean.setPostOrgManagerUserId(new String[] {"testPostOrgManagerUserId"});
+ postSearchBean.setPostCommandChain(new String[] {"testPostCommandChain"});
+ postSearchBean.setPostCompanyCode(new String[] {"testPostCompanyCode"});
+ postSearchBean.setPostCompany(new String[] {"testPostCompany"});
+ postSearchBean.setPostCostCenter(new String[] {"testPostCostCenter"});
+ postSearchBean.setPostSiloStatus(new String[] {"testPostSiloStatus"});
+ postSearchBean.setPostFinancialLocCode(new String[] {"testPostFinancialLocCode"});
+ postSearchBean.setFirstName("testFirstName");
+ postSearchBean.setLastName("testLastName");
+ postSearchBean.setHrid("testHrid");
+ postSearchBean.setOrgUserId("testOrgUserID");
+ postSearchBean.setOrgCode("testOrgCode");
+ postSearchBean.setEmail("testEmail");
+ postSearchBean.setOrgManagerUserId("testOrgManagerUserId");
+ postSearchBean.setFirstNameOrig("testFirstNameOrig");
+ postSearchBean.setLastNameOrig("testLastNameOrig");
+ postSearchBean.setHridOrig("testHridOrig");
+ postSearchBean.setOrgUserIdOrig("testOrgUserIdOrig");
+ postSearchBean.setOrgCodeOrig("testOrgCodeOrig");
+ postSearchBean.setEmailOrig("testEmailOrig");
+ postSearchBean.setOrgManagerUserIdOrig("testOrgManagerUserIdOrig");
+
+ return postSearchBean;
+ }
+
+ @Test
+ public void postSearchBeanTest()
+ {
+
+ PostSearchBean mockPostSearchBean= mockPostSearchBean();
+ PostSearchBean postSearchBean= new PostSearchBean();
+// postSearchBean.setUser(null);
+// postSearchBean.setUserOrig(null);
+ postSearchBean.setSelected(new String[] {"testSelected"});
+ postSearchBean.setPostHrid(new String[] {"testPostHrid"});
+ postSearchBean.setPostOrgUserId(new String[] {"testPostOrgUserId"});
+ postSearchBean.setPostFirstName(new String[] {"testPostFirstName"});
+ postSearchBean.setPostLastName(new String[] {"testPostLastName"});
+ postSearchBean.setPostOrgCode(new String[] {"testPostOrgCode"});
+ postSearchBean.setPostPhone(new String[] {"testPostPhone"});
+ postSearchBean.setPostEmail(new String[] {"testPostEmail"});
+ postSearchBean.setPostAddress1(new String[] {"testPostAddress1"});
+ postSearchBean.setPostAddress2(new String[] {"testPostAddress2"});
+ postSearchBean.setPostCity(new String[] {"testPostCity"});
+ postSearchBean.setPostState(new String[] {"testPostState"});
+ postSearchBean.setPostZipCode(new String[] {"testPostZipCode"});
+ postSearchBean.setPostLocationClli(new String[] {"testPostLocationClli"});
+ postSearchBean.setPostBusinessCountryCode(new String[] {"testPostBusinessCountryCode"});
+ postSearchBean.setPostBusinessCountryName(new String[] {"testPostBusinessCountryName"});
+ postSearchBean.setPostDepartment(new String[] {"testPostDepartment"});
+ postSearchBean.setPostDepartmentName(new String[] {"testPostDepartmentName"});
+ postSearchBean.setPostBusinessUnit(new String[] {"testPostBusinessUnit"});
+ postSearchBean.setPostBusinessUnitName(new String[] {"testPostBusinessUnitName"});
+ postSearchBean.setPostJobTitle(new String[] {"testPostJobTitle"});
+ postSearchBean.setPostOrgManagerUserId(new String[] {"testPostOrgManagerUserId"});
+ postSearchBean.setPostCommandChain(new String[] {"testPostCommandChain"});
+ postSearchBean.setPostCompanyCode(new String[] {"testPostCompanyCode"});
+ postSearchBean.setPostCompany(new String[] {"testPostCompany"});
+ postSearchBean.setPostCostCenter(new String[] {"testPostCostCenter"});
+ postSearchBean.setPostSiloStatus(new String[] {"testPostSiloStatus"});
+ postSearchBean.setPostFinancialLocCode(new String[] {"testPostFinancialLocCode"});
+ postSearchBean.setFirstName("testFirstName");
+ postSearchBean.setLastName("testLastName");
+ postSearchBean.setHrid("testHrid");
+ postSearchBean.setOrgUserId("testOrgUserID");
+ postSearchBean.setOrgCode("testOrgCode");
+ postSearchBean.setEmail("testEmail");
+ postSearchBean.setOrgManagerUserId("testOrgManagerUserId");
+ postSearchBean.setFirstNameOrig("testFirstNameOrig");
+ postSearchBean.setLastNameOrig("testLastNameOrig");
+ postSearchBean.setHridOrig("testHridOrig");
+ postSearchBean.setOrgUserIdOrig("testOrgUserIdOrig");
+ postSearchBean.setOrgCodeOrig("testOrgCodeOrig");
+ postSearchBean.setEmailOrig("testEmailOrig");
+ postSearchBean.setOrgManagerUserIdOrig("testOrgManagerUserIdOrig");
+ assertNull(postSearchBean.getUser().getCity());
+ assertNull(postSearchBean.getUserOrig().getCity());
+ assertEquals(postSearchBean.getSelected().length, mockPostSearchBean.getSelected().length);
+ assertEquals(postSearchBean.getPostHrid().length, mockPostSearchBean.getPostHrid().length);
+ assertEquals(postSearchBean.getPostOrgUserId().length, mockPostSearchBean.getPostOrgUserId().length);
+ assertEquals(postSearchBean.getPostFirstName().length,mockPostSearchBean.getPostFirstName().length);
+ assertEquals(postSearchBean.getPostLastName().length,mockPostSearchBean.getPostLastName().length);
+ assertEquals(postSearchBean.getPostOrgCode().length,mockPostSearchBean.getPostOrgCode().length);
+ assertEquals(postSearchBean.getPostPhone().length,mockPostSearchBean.getPostPhone().length);
+ assertEquals(postSearchBean.getPostEmail().length,mockPostSearchBean.getPostEmail().length);
+ assertEquals(postSearchBean.getPostAddress1().length,mockPostSearchBean.getPostAddress1().length);
+ assertEquals(postSearchBean.getPostAddress2().length,mockPostSearchBean.getPostAddress2().length);
+ assertEquals(postSearchBean.getPostCity().length,mockPostSearchBean.getPostCity().length);
+ assertEquals(postSearchBean.getPostState().length,mockPostSearchBean.getPostState().length);
+ assertEquals(postSearchBean.getPostZipCode().length,mockPostSearchBean.getPostZipCode().length);
+ assertEquals(postSearchBean.getPostLocationClli().length,mockPostSearchBean.getPostLocationClli().length);
+ assertEquals(postSearchBean.getPostBusinessCountryCode().length,mockPostSearchBean.getPostBusinessCountryCode().length);
+ assertEquals(postSearchBean.getPostBusinessCountryName().length,mockPostSearchBean.getPostBusinessCountryName().length);
+ assertEquals(postSearchBean.getPostDepartment().length,mockPostSearchBean.getPostDepartment().length);
+ assertEquals(postSearchBean.getPostDepartmentName().length,mockPostSearchBean.getPostDepartmentName().length);
+ assertEquals(postSearchBean.getPostBusinessUnit().length,mockPostSearchBean.getPostBusinessUnit().length);
+ assertEquals(postSearchBean.getPostBusinessUnitName().length,mockPostSearchBean.getPostBusinessUnitName().length);
+ assertEquals(postSearchBean.getPostJobTitle().length,mockPostSearchBean.getPostJobTitle().length);
+ assertEquals(postSearchBean.getPostOrgManagerUserId().length,mockPostSearchBean.getPostOrgManagerUserId().length);
+ assertEquals(postSearchBean.getPostCommandChain().length,mockPostSearchBean.getPostCommandChain().length);
+ assertEquals(postSearchBean.getPostCompanyCode().length,mockPostSearchBean.getPostCompanyCode().length);
+ assertEquals(postSearchBean.getPostCompany().length,mockPostSearchBean.getPostCompany().length);
+ assertEquals(postSearchBean.getPostCostCenter().length,mockPostSearchBean.getPostCostCenter().length);
+ assertEquals(postSearchBean.getPostSiloStatus().length,mockPostSearchBean.getPostSiloStatus().length);
+ assertEquals(postSearchBean.getPostFinancialLocCode().length,mockPostSearchBean.getPostFinancialLocCode().length);
+ assertEquals(postSearchBean.getFirstName(),mockPostSearchBean.getFirstName());
+ assertEquals(postSearchBean.getLastName(),mockPostSearchBean.getLastName());
+ assertEquals(postSearchBean.getHrid(),mockPostSearchBean.getHrid());
+ assertEquals(postSearchBean.getOrgCode(),mockPostSearchBean.getOrgCode());
+ assertEquals(postSearchBean.getEmail(),mockPostSearchBean.getEmail());
+ assertEquals(postSearchBean.getOrgManagerUserId(),mockPostSearchBean.getOrgManagerUserId());
+ assertEquals(postSearchBean.getFirstNameOrig(),mockPostSearchBean.getFirstNameOrig());
+ assertEquals(postSearchBean.getLastNameOrig(),mockPostSearchBean.getLastNameOrig());
+ assertEquals(postSearchBean.getHridOrig(),mockPostSearchBean.getHridOrig());
+ assertEquals(postSearchBean.getOrgUserIdOrig(),mockPostSearchBean.getOrgUserIdOrig());
+ assertEquals(postSearchBean.getOrgCodeOrig(),mockPostSearchBean.getOrgCodeOrig());
+ assertEquals(postSearchBean.getEmailOrig(),mockPostSearchBean.getEmailOrig());
+ assertEquals(postSearchBean.getOrgManagerUserIdOrig(),mockPostSearchBean.getOrgManagerUserIdOrig());
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/UserRowBeanTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/UserRowBeanTest.java
new file mode 100644
index 00000000..78c139e0
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/UserRowBeanTest.java
@@ -0,0 +1,76 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.command;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class UserRowBeanTest {
+
+ public UserRowBean mockUserRowBean()
+ {
+ UserRowBean userRowBean = new UserRowBean();
+ userRowBean.setSessionId("testSessionId");
+ userRowBean.setLastAccess("testLastAccess");
+ userRowBean.setRemaining("testRemaining");
+ userRowBean.setLoginTime("testLoginTime");
+ userRowBean.setLastLoginTime("testLastLoginTime");
+ return userRowBean;
+ }
+
+ @Test
+ public void userRowBeanTest()
+ {
+ UserRowBean mockUserRowBean = mockUserRowBean();
+ UserRowBean userRowBean = new UserRowBean();
+ userRowBean.setSessionId("testSessionId");
+ userRowBean.setLastAccess("testLastAccess");
+ userRowBean.setRemaining("testRemaining");
+ userRowBean.setLoginTime("testLoginTime");
+ userRowBean.setLastLoginTime("testLastLoginTime");
+
+ assertEquals(userRowBean.getSessionId(),mockUserRowBean.getSessionId());
+ assertEquals(userRowBean.getLastAccess(),mockUserRowBean.getLastAccess());
+ assertEquals(userRowBean.getRemaining(),mockUserRowBean.getRemaining());
+ assertEquals(userRowBean.getLoginTime(),mockUserRowBean.getLoginTime());
+ assertEquals(userRowBean.getLastLoginTime(),mockUserRowBean.getLastLoginTime());
+
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/support/SearchResultTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/support/SearchResultTest.java
new file mode 100644
index 00000000..5f49cf09
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/support/SearchResultTest.java
@@ -0,0 +1,76 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.command.support;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class SearchResultTest {
+
+ public SearchResult mockSearchResult(){
+
+ SearchResult SearchResult = new SearchResult();
+
+ SearchResult.setAccessType("test");
+ SearchResult.setDataSize(1);
+ SearchResult.setPageNo(1);
+ SearchResult.setPageSize(1);
+
+ return SearchResult;
+ }
+
+ @Test
+ public void searchResultTest(){
+ SearchResult searchResult1 = mockSearchResult();
+
+ SearchResult SearchResult = new SearchResult();
+
+ SearchResult.setAccessType("test");
+ SearchResult.setDataSize(1);
+ SearchResult.setPageNo(1);
+ SearchResult.setPageSize(1);
+
+ assertEquals(SearchResult.getAccessType(), searchResult1.getAccessType());
+ assertEquals(SearchResult.getDataSize(), searchResult1.getDataSize());
+ assertEquals(SearchResult.getPageNo(), searchResult1.getPageNo());
+ assertEquals(SearchResult.getPageSize(), searchResult1.getPageSize());
+ assertEquals(SearchResult.getSize(), searchResult1.getSize());
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AppTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AppTest.java
new file mode 100644
index 00000000..8deaf877
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AppTest.java
@@ -0,0 +1,123 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class AppTest {
+
+ public App mockApp() {
+ App app = new App();
+ app.setName("testApp");
+ app.setImageUrl("testmageUrl");
+ app.setDescription("testdescription");
+ app.setNotes("testNotes");
+ app.setUrl("testUrl");
+ app.setAlternateUrl("testAlternateUrl");
+ app.setRestEndpoint("testRestEndpoint");
+ app.setMlAppName("testMlAppName");
+ app.setMlAppAdminId("testMlAppAdminId");
+ app.setMotsId("testMotsId");
+ app.setAppPassword("testAppPassword");
+ app.setOpen("testOpen");
+ app.setEnabled("testEnabled");
+ app.setThumbnail(null);
+ app.setUsername("testUsername");
+ app.setUebKey("testUebKey");
+ app.setUebSecret("testUebSecret");
+ app.setUebTopicName("testuebTopicName");
+ return app;
+ }
+
+ @Test
+ public void appTest()
+ {
+ App mockApp = mockApp();
+ App app = new App();
+ app.setName("testApp");
+ app.setImageUrl("testmageUrl");
+ app.setDescription("testdescription");
+ app.setNotes("testNotes");
+ app.setUrl("testUrl");
+ app.setAlternateUrl("testAlternateUrl");
+ app.setRestEndpoint("testRestEndpoint");
+ app.setMlAppName("testMlAppName");
+ app.setMlAppAdminId("testMlAppAdminId");
+ app.setMotsId("testMotsId");
+ app.setAppPassword("testAppPassword");
+ app.setOpen("testOpen");
+ app.setEnabled("testEnabled");
+ app.setThumbnail(null);
+ app.setUsername("testUsername");
+ app.setUebKey("testUebKey");
+ app.setUebSecret("testUebSecret");
+ app.setUebTopicName("testuebTopicName");
+
+ assertEquals(app.getName(), mockApp.getName());
+ assertEquals(app.getImageUrl(), mockApp.getImageUrl());
+ assertEquals(app.getDescription(), mockApp.getDescription());
+ assertEquals(app.getNotes(), mockApp.getNotes());
+ assertEquals(app.getUrl(), mockApp.getUrl());
+ assertEquals(app.getAlternateUrl(), mockApp.getAlternateUrl());
+ assertEquals(app.getRestEndpoint(), mockApp.getRestEndpoint());
+ assertEquals(app.getMlAppName(), mockApp.getMlAppName());
+ assertEquals(app.getMlAppAdminId(), mockApp.getMlAppAdminId());
+ assertEquals(app.getMotsId(), mockApp.getMotsId());
+ assertEquals(app.getOpen(), mockApp.getOpen());
+ assertEquals(app.getEnabled(), mockApp.getEnabled());
+ assertEquals(app.getThumbnail(), mockApp.getThumbnail());
+ assertEquals(app.getUsername(), mockApp.getUsername());
+ assertEquals(app.getUebKey(), mockApp.getUebKey());
+ assertEquals(app.getUebSecret(), mockApp.getUebSecret());
+ assertEquals(app.getUebTopicName(), mockApp.getUebTopicName());
+ assertEquals(app.getAppPassword(), mockApp.getAppPassword());
+
+ }
+
+ @Test
+ public void compareToTest()
+ {
+ App app = new App();
+ app.setId((long) 1);
+ int result = app.compareTo(app);
+ assertEquals(result, 0);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AuditLogTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AuditLogTest.java
new file mode 100644
index 00000000..8b43053e
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AuditLogTest.java
@@ -0,0 +1,73 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class AuditLogTest {
+
+ public AuditLog mockAuditLog()
+ {
+ AuditLog auditLog = new AuditLog();
+ auditLog.setActivityCode("activityCode");
+ auditLog.setAffectedRecordId("affectedRecordId");
+ auditLog.setComments("comments");
+ auditLog.setAuditDate(null);
+ auditLog.setUserId((long) 1);
+ return auditLog;
+ }
+
+ @Test
+ public void auditLogTest()
+ {
+ AuditLog mockAuditLog = mockAuditLog();
+ AuditLog auditLog = new AuditLog();
+ auditLog.setActivityCode("activityCode");
+ auditLog.setAffectedRecordId("affectedRecordId");
+ auditLog.setComments("comments");
+ auditLog.setAuditDate(null);
+ auditLog.setUserId((long) 1);
+ assertEquals(auditLog.getActivityCode(), mockAuditLog.getActivityCode());
+ assertEquals(auditLog.getAffectedRecordId(), mockAuditLog.getAffectedRecordId());
+ assertEquals(auditLog.getComments(), mockAuditLog.getComments());
+ assertEquals(auditLog.getAuditDate(), mockAuditLog.getAuditDate());
+ assertEquals(auditLog.getUserId(), mockAuditLog.getUserId());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/BroadcastMessageTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/BroadcastMessageTest.java
new file mode 100644
index 00000000..6174a413
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/BroadcastMessageTest.java
@@ -0,0 +1,101 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class BroadcastMessageTest {
+
+ public BroadcastMessage mockBroadcastMessage() {
+ BroadcastMessage broadcastMessage = new BroadcastMessage();
+ broadcastMessage.setMessageText("messageText");
+ broadcastMessage.setLocationId(1);
+ broadcastMessage.setStartDate(null);
+ broadcastMessage.setEndDate(null);
+ broadcastMessage.setSortOrder(1);
+ broadcastMessage.setActive(false);
+ broadcastMessage.setSiteCd("siteCd");
+ return broadcastMessage;
+ }
+
+ @Test
+ public void broadcastMessageTest() {
+ BroadcastMessage mockBroadcastMessage = mockBroadcastMessage();
+ BroadcastMessage broadcastMessage = new BroadcastMessage();
+ broadcastMessage.setMessageText("messageText");
+ broadcastMessage.setLocationId(1);
+ broadcastMessage.setStartDate(null);
+ broadcastMessage.setEndDate(null);
+ broadcastMessage.setSortOrder(1);
+ broadcastMessage.setActive(false);
+ broadcastMessage.setSiteCd("siteCd");
+ assertEquals(broadcastMessage.getMessageText(), mockBroadcastMessage.getMessageText());
+ assertEquals(broadcastMessage.getLocationId(), mockBroadcastMessage.getLocationId());
+ assertEquals(broadcastMessage.getStartDate(), mockBroadcastMessage.getStartDate());
+ assertEquals(broadcastMessage.getEndDate(), mockBroadcastMessage.getEndDate());
+ assertEquals(broadcastMessage.getSortOrder(), mockBroadcastMessage.getSortOrder());
+ assertEquals(broadcastMessage.getActive(), mockBroadcastMessage.getActive());
+ assertEquals(broadcastMessage.getSiteCd(), mockBroadcastMessage.getSiteCd());
+ }
+
+ @Test
+ public void compareToTest()
+ {
+ BroadcastMessage broadcastMessage = new BroadcastMessage();
+ broadcastMessage.setLocationId(1);
+ broadcastMessage.setSortOrder(1);
+ broadcastMessage.setId((long) 2);
+ int result = broadcastMessage.compareTo(broadcastMessage);
+ assertEquals(result, 0);
+ }
+
+ @Test
+ public void compareToDiffTest()
+ {
+ BroadcastMessage broadcastMessage = new BroadcastMessage();
+ BroadcastMessage broadcastMessage1 = new BroadcastMessage();
+ broadcastMessage.setLocationId(0);
+ broadcastMessage1.setLocationId(1);
+ broadcastMessage.setSortOrder(1);
+ broadcastMessage.setId((long) 2);
+ int result = broadcastMessage1.compareTo(broadcastMessage);
+ assertEquals(result, 1);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/FnMenuTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/FnMenuTest.java
new file mode 100644
index 00000000..0c57a2d4
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/FnMenuTest.java
@@ -0,0 +1,98 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class FnMenuTest {
+
+ public FnMenu mockFnMenuTest() {
+ FnMenu fnMenu = new FnMenu();
+ fnMenu.setMenuId(1);
+ fnMenu.setLabel("label");
+ fnMenu.setParentId(1);
+ fnMenu.setAction("action");
+ fnMenu.setFunctionCd("functionCd");
+ fnMenu.setSortOrder(1);
+ fnMenu.setServlet("servlet");
+ fnMenu.setQueryString("queryString");
+ fnMenu.setExternalUrl("externalUrl");
+ fnMenu.setTarget("target");
+ fnMenu.setActive("active");
+ fnMenu.setSeparator("separator");
+ fnMenu.setImageSrc("imageSrc");
+ fnMenu.setMenuSetCode("menuSetCode");
+ return fnMenu;
+ }
+
+ @Test
+ public void fnMenuTest() {
+ FnMenu mockFnMenu = mockFnMenuTest();
+ FnMenu fnMenu = new FnMenu();
+ fnMenu.setMenuId(1);
+ fnMenu.setLabel("label");
+ fnMenu.setParentId(1);
+ fnMenu.setAction("action");
+ fnMenu.setFunctionCd("functionCd");
+ fnMenu.setSortOrder(1);
+ fnMenu.setServlet("servlet");
+ fnMenu.setQueryString("queryString");
+ fnMenu.setExternalUrl("externalUrl");
+ fnMenu.setTarget("target");
+ fnMenu.setActive("active");
+ fnMenu.setSeparator("separator");
+ fnMenu.setImageSrc("imageSrc");
+ fnMenu.setMenuSetCode("menuSetCode");
+ assertEquals(fnMenu.getMenuId(), mockFnMenu.getMenuId());
+ assertEquals(fnMenu.getLabel(), mockFnMenu.getLabel());
+ assertEquals(fnMenu.getParentId(), mockFnMenu.getParentId());
+ assertEquals(fnMenu.getAction(), mockFnMenu.getAction());
+ assertEquals(fnMenu.getSortOrder(), mockFnMenu.getSortOrder());
+ assertEquals(fnMenu.getServlet(), mockFnMenu.getServlet());
+ assertEquals(fnMenu.getQueryString(), mockFnMenu.getQueryString());
+ assertEquals(fnMenu.getExternalUrl(), mockFnMenu.getExternalUrl());
+ assertEquals(fnMenu.getTarget(), mockFnMenu.getTarget());
+ assertEquals(fnMenu.getActive(), mockFnMenu.getActive());
+ assertEquals(fnMenu.getSeparator(), mockFnMenu.getSeparator());
+ assertEquals(fnMenu.getImageSrc(), mockFnMenu.getImageSrc());
+ assertEquals(fnMenu.getMenuSetCode(), mockFnMenu.getMenuSetCode());
+ assertEquals(fnMenu.getFunctionCd(), mockFnMenu.getFunctionCd());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LoginBeanTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LoginBeanTest.java
new file mode 100644
index 00000000..7d4fbef2
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LoginBeanTest.java
@@ -0,0 +1,83 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class LoginBeanTest {
+
+ public LoginBean mockLoginBean() {
+ LoginBean loginBean = new LoginBean();
+ loginBean.setLoginId("loginId");
+ loginBean.setLoginPwd("loginPwd");
+ loginBean.setHrid("hrid");
+ loginBean.setOrgUserId("orgUserId");
+ loginBean.setSiteAccess("siteAccess");
+ loginBean.setLoginErrorMessage("loginErrorMessage");
+ loginBean.setUser(null);
+ loginBean.setMenu(null);
+ loginBean.setBusinessDirectMenu(null);
+ return loginBean;
+ }
+
+ @Test
+ public void loginBeanTest() {
+ LoginBean mockLoginBean = mockLoginBean();
+ LoginBean loginBean = new LoginBean();
+ loginBean.setLoginId("loginId");
+ loginBean.setLoginPwd("loginPwd");
+ loginBean.setHrid("hrid");
+ loginBean.setOrgUserId("orgUserId");
+ loginBean.setSiteAccess("siteAccess");
+ loginBean.setLoginErrorMessage("loginErrorMessage");
+ loginBean.setUser(null);
+ loginBean.setMenu(null);
+ loginBean.setBusinessDirectMenu(null);
+ assertEquals(loginBean.getLoginId(), mockLoginBean.getLoginId());
+ assertEquals(loginBean.getLoginPwd(), mockLoginBean.getLoginPwd());
+ assertEquals(loginBean.getHrid(), mockLoginBean.getHrid());
+ assertEquals(loginBean.getOrgUserId(), mockLoginBean.getOrgUserId());
+ assertEquals(loginBean.getSiteAccess(), mockLoginBean.getSiteAccess());
+ assertEquals(loginBean.getLoginErrorMessage(), mockLoginBean.getLoginErrorMessage());
+ assertEquals(loginBean.getUser(), mockLoginBean.getUser());
+ assertEquals(loginBean.getMenu(), mockLoginBean.getMenu());
+ assertEquals(loginBean.getBusinessDirectMenu(), mockLoginBean.getBusinessDirectMenu());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LookupTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LookupTest.java
new file mode 100644
index 00000000..9dcd43f7
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LookupTest.java
@@ -0,0 +1,73 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.NameValueId;
+
+public class LookupTest {
+
+ public Lookup mockLookUp() {
+ Lookup lookup = new Lookup();
+ NameValueId nameValueId = new NameValueId();
+ nameValueId.setLab("label");
+ nameValueId.setVal("value");
+ lookup.setLabel(nameValueId.getLab());
+ lookup.setValue(nameValueId.getVal());
+ lookup.setNameValueId(nameValueId);
+ return lookup;
+ }
+
+ @Test
+ public void lookupTest() {
+ Lookup lookup = mockLookUp();
+ Lookup lookup1 = new Lookup("label", "value");
+ assertEquals(lookup.getLabel(), "label");
+ assertEquals(lookup.getValue(), "value");
+ assertEquals(lookup, lookup1);
+ assertNotNull(lookup.hashCode());
+ assertTrue(lookup.equals(lookup1));
+ Lookup lookup2 = null;
+ assertFalse(lookup.equals(lookup2));
+ NameValueId nameValueId = new NameValueId();
+ assertFalse(lookup.equals(nameValueId));
+ assertEquals(lookup.getNameValueId().getLab(), lookup1.getNameValueId().getLab());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuCountryTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuCountryTest.java
new file mode 100644
index 00000000..a5afc07d
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuCountryTest.java
@@ -0,0 +1,77 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class LuCountryTest {
+
+ public LuCountry mockLuCountry() {
+ LuCountry luCountry = new LuCountry();
+ luCountry.setAbbr("abbr");
+ luCountry.setCountry("country");
+ luCountry.setFullName("fullName");
+ luCountry.setWebphoneCountryLabel("webphoneCountryLabel");
+ return luCountry;
+ }
+
+ @Test
+ public void luCountryTest() {
+ LuCountry mockluCountry = mockLuCountry();
+ LuCountry luCountry = new LuCountry();
+ luCountry.setAbbr("abbr");
+ luCountry.setCountry("country");
+ luCountry.setFullName("fullName");
+ luCountry.setWebphoneCountryLabel("webphoneCountryLabel");
+ assertEquals(luCountry.getAbbr(), mockluCountry.getAbbr());
+ assertEquals(luCountry.getCountry(), mockluCountry.getCountry());
+ assertEquals(luCountry.getFullName(), mockluCountry.getFullName());
+ assertEquals(luCountry.getWebphoneCountryLabel(), mockluCountry.getWebphoneCountryLabel());
+ }
+
+ @Test
+ public void compareToTest()
+ {
+ LuCountry mockluCountry = mockLuCountry();
+ LuCountry luCountry = new LuCountry();
+ luCountry.setCountry("test");
+ assertEquals(mockluCountry.compareTo(luCountry),-17);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuStateTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuStateTest.java
new file mode 100644
index 00000000..902d9cee
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuStateTest.java
@@ -0,0 +1,65 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class LuStateTest {
+
+ public LuState mockLuState() {
+ LuState luState = new LuState();
+ luState.setAbbr("abbr");
+ luState.setState("state");
+ return luState;
+ }
+
+ @Test
+ public void luStateTest() {
+ LuState mockluState = mockLuState();
+ LuState luState = new LuState();
+ luState.setAbbr("abbr");
+ luState.setState("state");
+ assertEquals(mockluState.getAbbr(), luState.getAbbr());
+ assertEquals(mockluState.getState(), luState.getState());
+ LuState luState1 = new LuState();
+ luState1.setState("stateTest");
+ assertEquals(luState.compareTo(luState1), -4);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuTimeZoneTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuTimeZoneTest.java
new file mode 100644
index 00000000..cf5f9369
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuTimeZoneTest.java
@@ -0,0 +1,68 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class LuTimeZoneTest {
+
+ public LuTimeZone mockLuTimeZone() {
+ LuTimeZone luTimeZone = new LuTimeZone();
+ luTimeZone.setName("name");
+ luTimeZone.setTimezoneId((long) 1);
+ luTimeZone.setValue("value");
+ return luTimeZone;
+ }
+
+ @Test
+ public void luTimeZone()
+ {
+ LuTimeZone luTimeZone = mockLuTimeZone();
+ LuTimeZone luTimeZone1 = mockLuTimeZone();
+ assertEquals(luTimeZone.getName(), luTimeZone1.getName());
+ assertEquals(luTimeZone.getValue(), luTimeZone1.getValue());
+ assertEquals(luTimeZone.getTimezoneId(), luTimeZone1.getTimezoneId());
+ assertEquals(luTimeZone.getId(), null);
+ luTimeZone.setId((long) 1);
+ luTimeZone1.setId((long) 2);
+ assertTrue(luTimeZone.compareTo(luTimeZone1) == -1);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuDataTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuDataTest.java
new file mode 100644
index 00000000..2b16c9ef
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuDataTest.java
@@ -0,0 +1,72 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class MenuDataTest {
+
+ public MenuData mockMenuTest() {
+ MenuData menuData = new MenuData();
+ menuData.setParentMenu(null);
+ menuData.setChildMenus(null);
+ return menuData;
+ }
+
+ @Test
+ public void menuDataTest() {
+ MenuData menuData = mockMenuTest();
+ assertNull(menuData.getParentMenu());
+ assertNull(menuData.getChildMenus());
+ assertEquals(menuData.getActiveAsString(), "false");
+ assertEquals(menuData.getParentIdAsString(), "null");
+ assertEquals(menuData.getSeparatorAsString(), "false");
+ MenuData menuData1 = mockMenuTest();
+ menuData1.setSortOrder(null);
+ assertTrue(menuData1.compareTo(menuData) == 1);
+ menuData1.setSortOrder((short) 1);
+ menuData.setSortOrder(null);
+ assertTrue(menuData1.compareTo(menuData) == 1);
+ menuData.setSortOrder((short) 1);
+ assertTrue(menuData1.compareTo(menuData) == 1);
+ menuData.setSortOrder((short) 2);
+ assertTrue(menuData1.compareTo(menuData) == -1);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuTest.java
new file mode 100644
index 00000000..ece93c87
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuTest.java
@@ -0,0 +1,84 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class MenuTest {
+
+ public Menu mockMenu() {
+ Menu menu = new Menu();
+ menu.setMenuLevel("menuLevel");
+ menu.setLabel("label");
+ menu.setParentId((long) 1);
+ menu.setAction("action");
+ menu.setFunctionCd("functionCd");
+ menu.setSortOrder((short) 1);
+ menu.setServlet("servlet");
+ menu.setQueryString("queryString");
+ menu.setExternalUrl("externalUrl");
+ menu.setTarget("target");
+ menu.setActive(false);
+ menu.setMenuSetCode("menuSetCode");
+ menu.setSeparator(false);
+ menu.setImageSrc("imageSrc");
+ return menu;
+ }
+
+ @Test
+ public void menuTest() {
+ Menu menu = mockMenu();
+ Menu menu1 = mockMenu();
+ assertEquals(menu.getMenuLevel(), menu1.getMenuLevel());
+ assertEquals(menu.getLabel(), menu1.getLabel());
+ assertEquals(menu.getParentId(), menu1.getParentId());
+ assertEquals(menu.getAction(), menu1.getAction());
+ assertEquals(menu.getFunctionCd(), menu1.getFunctionCd());
+ assertEquals(menu.getSortOrder(), menu1.getSortOrder());
+ assertEquals(menu.getServlet(), menu1.getServlet());
+ assertEquals(menu.getQueryString(), menu1.getQueryString());
+ assertEquals(menu.getExternalUrl(), menu1.getExternalUrl());
+ assertEquals(menu.getTarget(), menu1.getTarget());
+ assertEquals(menu.isActive(), menu1.isActive());
+ assertEquals(menu.getMenuSetCode(), menu1.getMenuSetCode());
+ assertEquals(menu.isSeparator(), menu1.isSeparator());
+ assertEquals(menu.getImageSrc(), menu1.getImageSrc());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/ProfileTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/ProfileTest.java
new file mode 100644
index 00000000..aab449a4
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/ProfileTest.java
@@ -0,0 +1,70 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ProfileTest {
+
+ public Profile mockProfile() {
+ Profile profile = new Profile();
+ profile.setId((long) 1);
+ profile.setFirst_name("first_name");
+ profile.setLast_name("last_name");
+ profile.setEmail("email");
+ profile.setOrgManagerUserId("orgManagerUserId");
+ profile.setActive_yn("active_yn");
+ profile.setOrgUserId("orgUserId");
+ return profile;
+ }
+
+ @Test
+ public void profileTest() {
+ Profile profile = mockProfile();
+ Profile profile1 = mockProfile();
+ assertEquals(profile.getId(), profile1.getId());
+ assertEquals(profile.getFirst_name(), profile1.getFirst_name());
+ assertEquals(profile.getLast_name(), profile1.getLast_name());
+ assertEquals(profile.getEmail(), profile1.getEmail());
+ assertEquals(profile.getOrgManagerUserId(), profile1.getOrgManagerUserId());
+ assertEquals(profile.getActive_yn(), profile1.getActive_yn());
+ assertEquals(profile.getOrgUserId(), profile1.getOrgUserId());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleFunctionTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleFunctionTest.java
new file mode 100644
index 00000000..82f62fa2
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleFunctionTest.java
@@ -0,0 +1,69 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class RoleFunctionTest {
+
+ public RoleFunction mockRoleFunction() {
+ RoleFunction roleFunction = new RoleFunction();
+ roleFunction.setCode("code");
+ roleFunction.setName("name");
+ return roleFunction;
+ }
+
+ @Test
+ public void rolefunctionTest() {
+ RoleFunction roleFunction = mockRoleFunction();
+ RoleFunction roleFunction1 = mockRoleFunction();
+ assertEquals(roleFunction.getCode(), roleFunction1.getCode());
+ assertEquals(roleFunction.getName(), roleFunction1.getName());
+ assertEquals(roleFunction.getEditUrl(), roleFunction1.getEditUrl());
+ roleFunction1.setName(null);
+ assertTrue(roleFunction.compareTo(roleFunction1) == 1);
+ RoleFunction roleFunction2 = mockRoleFunction();
+ roleFunction2.setName(null);
+ RoleFunction roleFunction3 = mockRoleFunction();
+ assertTrue(roleFunction2.compareTo(roleFunction3) == 1);
+ assertTrue(roleFunction.compareTo(roleFunction3) == 0);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleTest.java
new file mode 100644
index 00000000..df952a07
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleTest.java
@@ -0,0 +1,111 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.junit.Test;
+
+public class RoleTest {
+
+ public Role mockRole() {
+ Role role = new Role();
+ role.setName("test");
+ role.setActive(false);
+ role.setPriority(1);
+ Set roleFunctions = new TreeSet<>();
+ RoleFunction roleFunction = new RoleFunction();
+ roleFunction.setCode("code");
+ roleFunction.setName("name");
+ roleFunctions.add(roleFunction);
+ role.setRoleFunctions(roleFunctions);
+ Set roles = new TreeSet<>();
+ Role newrole = new Role();
+ role.setChildRoles(roles);
+ role.setParentRoles(roles);
+ return role;
+ }
+
+ @Test
+ public void roleTest() {
+ Role role = mockRole();
+ Role role1 = mockRole();
+ assertEquals(role.getName(), role1.getName());
+ assertEquals(role.getActive(), role1.getActive());
+ assertEquals(role.getRoleFunctions().size(), role1.getRoleFunctions().size());
+ assertEquals(role.getParentRoles(), role1.getParentRoles());
+ assertEquals(role.getChildRoles(), role1.getChildRoles());
+ assertEquals(role.getPriority(), role1.getPriority());
+ RoleFunction roleFunction = new RoleFunction();
+ roleFunction.setCode("code1");
+ roleFunction.setName("name1");
+ role.addRoleFunction(roleFunction);
+ Role parentrole = new Role();
+ parentrole.setId((long) 1);
+ role.addParentRole(parentrole);
+ Role childrole = new Role();
+ childrole.setId((long) 2);
+ role.addChildRole(childrole);
+ assertEquals(role.getToggleActiveAltText(), "Click to Activate Role");
+ assertEquals(role.getToggleActiveImage(), "/static/fusion/images/inactive.png");
+ role.removeChildRole((long) 2);
+ role.removeParentRole((long) 1);
+ role.removeRoleFunction("code1");
+ role.setActive(true);
+ assertEquals(role.getToggleActiveImage(), "/static/fusion/images/active.png");
+ assertEquals(role.getToggleActiveAltText(), "Click to Deactivate Role");
+ assertEquals(role.getEditUrl(),"/role.htm?role_id=null");
+ }
+
+ @Test
+ public void compareToTest() {
+ Role role = mockRole();
+ role.setName(null);
+ Role role1 = mockRole();
+ assertTrue(role.compareTo(role1) == 1);
+ role.setName("test");
+ role1.setName(null);
+ assertTrue(role.compareTo(role1) == 1);
+ role1.setName("test");
+ assertTrue(role.compareTo(role1) == 0);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleKeyTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleKeyTest.java
new file mode 100644
index 00000000..c9864e0b
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleKeyTest.java
@@ -0,0 +1,77 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class UrlsAccessibleKeyTest {
+
+ public UrlsAccessibleKey mockUrlsAccessibleKey() {
+ UrlsAccessibleKey urlsAccessibleKey = new UrlsAccessibleKey();
+ urlsAccessibleKey.setUrl("url");
+ urlsAccessibleKey.setFunctionCd("functionCd");
+ return urlsAccessibleKey;
+ }
+
+ @Test
+ public void urlsAccessibleKeyTest() {
+ UrlsAccessibleKey mockurlsAccessibleKey = mockUrlsAccessibleKey();
+ UrlsAccessibleKey urlsAccessibleKey = new UrlsAccessibleKey("url", "functionCd");
+ assertEquals(urlsAccessibleKey.getUrl(), mockurlsAccessibleKey.getUrl());
+ assertEquals(urlsAccessibleKey.getFunctionCd(), mockurlsAccessibleKey.getFunctionCd());
+ }
+
+ @Test
+ public void equalsandHashCodetest() {
+ UrlsAccessibleKey mockurlsAccessibleKey = mockUrlsAccessibleKey();
+ UrlsAccessibleKey mockurlsAccessibleKey1 = mockUrlsAccessibleKey();
+ UrlsAccessibleKey urlsAccessibleKey = mockurlsAccessibleKey;
+ assertTrue(mockurlsAccessibleKey.equals(urlsAccessibleKey));
+ assertFalse(mockurlsAccessibleKey.equals(null));
+ User user = new User();
+ assertFalse(mockurlsAccessibleKey.equals(user));
+ assertTrue(mockurlsAccessibleKey.equals(mockurlsAccessibleKey1));
+ UrlsAccessibleKey mockurlsAccessibleKey2 = new UrlsAccessibleKey("test", "test");
+ assertFalse(mockurlsAccessibleKey2.equals(mockurlsAccessibleKey1));
+ UrlsAccessibleKey mockurlsAccessibleKey3 = new UrlsAccessibleKey("url", "test");
+ assertFalse(mockurlsAccessibleKey3.equals(mockurlsAccessibleKey1));
+ assertNotNull(mockurlsAccessibleKey2.hashCode());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleTest.java
new file mode 100644
index 00000000..f02e1c22
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleTest.java
@@ -0,0 +1,75 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class UrlsAccessibleTest {
+
+ public UrlsAccessible mockUrlsAccessible() {
+ UrlsAccessible urlsAccessible = new UrlsAccessible();
+ UrlsAccessibleKey urlsAccessibleKey = new UrlsAccessibleKey();
+ urlsAccessibleKey.setUrl("url");
+ urlsAccessibleKey.setFunctionCd("functionCd");
+ urlsAccessible.setUrlsAccessibleKey(urlsAccessibleKey);
+ return urlsAccessible;
+ }
+
+ @Test
+ public void urlsAccessibleTest() {
+ UrlsAccessible urlsAccessible = mockUrlsAccessible();
+ UrlsAccessible urlsAccessible1 = new UrlsAccessible("url", "functionCd");
+ assertEquals(urlsAccessible.getUrlsAccessibleKey(), urlsAccessible1.getUrlsAccessibleKey());
+ assertEquals(urlsAccessible.getUrl(), urlsAccessible1.getUrl());
+ assertEquals(urlsAccessible.getFunctionCd(), urlsAccessible1.getFunctionCd());
+ assertNotNull(urlsAccessible.hashCode());
+ }
+
+ @Test
+ public void equlasTest() {
+ UrlsAccessible urlsAccessible = mockUrlsAccessible();
+ UrlsAccessible urlsAccessible1 = mockUrlsAccessible();
+ User user = new User();
+ assertFalse(urlsAccessible.equals(null));
+ assertFalse(urlsAccessible.equals(user));
+ assertTrue(urlsAccessible.equals(urlsAccessible1));
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppIdTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppIdTest.java
new file mode 100644
index 00000000..5a057f9f
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppIdTest.java
@@ -0,0 +1,87 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class UserAppIdTest {
+
+
+ public UserAppId mockUserAppId() {
+ UserAppId userAppId = new UserAppId();
+ Role role = new Role();
+ role.setId((long) 1);
+ App app = new App();
+ app.setId((long) 1);
+ userAppId.setUserId((long) 1);
+ userAppId.setApp(app);
+ userAppId.setRole(role);
+ return userAppId;
+ }
+
+ @Test
+ public void userAppIdTest() {
+ UserAppId userAppId = mockUserAppId();
+ UserAppId userAppId1 = mockUserAppId();
+ User user = new User();
+ assertEquals(userAppId.getUserId(), userAppId1.getUserId());
+ assertEquals(userAppId.getApp().getId(), userAppId1.getApp().getId());
+ assertEquals(userAppId.getRole().getId(), userAppId1.getRole().getId());
+ assertTrue(userAppId.equals(userAppId1));
+ assertFalse(userAppId1.equals(user));
+ assertFalse(userAppId1.equals(null));
+ UserAppId userAppId2 = userAppId1;
+ assertTrue(userAppId2.equals(userAppId1));
+ }
+
+ @Test
+ public void hashCodeTest() {
+ UserAppId userAppId = mockUserAppId();
+ assertNotNull(userAppId.hashCode());
+ userAppId.setUserId(null);
+ userAppId.getApp().setId(null);
+ userAppId.getRole().setId(null);
+ assertNotNull(userAppId.hashCode());
+
+
+ }
+
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppTest.java
new file mode 100644
index 00000000..76704354
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppTest.java
@@ -0,0 +1,89 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class UserAppTest {
+
+ public UserApp mockUserApp() {
+ UserApp userapp = new UserApp();
+ Role role = new Role();
+ role.setId((long) 1);
+ userapp.setRole(role);
+ App app = new App();
+ app.setId((long) 1);
+ userapp.setApp(app);
+ userapp.setUserId((long) 1);
+ userapp.setPriority(null);
+ return userapp;
+ }
+
+ @Test
+ public void userAppTest() {
+ UserApp userapp1 = mockUserApp();
+ UserApp userapp2 = mockUserApp();
+ userapp2.setUserId((long) 2);
+ assertNull(userapp1.getPriority());
+ assertEquals(userapp2.compareTo(userapp1), 1);
+ assertNotNull(userapp1.hashCode());
+ userapp2.setUserId((long) 1);
+ assertTrue(userapp1.equals(userapp2));
+ User user = new User();
+ assertFalse(userapp2.equals(user));
+ assertFalse(user.equals(null));
+ UserApp userapp3 = userapp2;
+ assertTrue(userapp3.equals(userapp2));
+ }
+
+
+ @Test
+ public void hashCodeTest() {
+ UserApp userapp1 = mockUserApp();
+ assertNotNull(userapp1.hashCode());
+ userapp1.setUserId(null);
+ userapp1.getApp().setId(null);
+ userapp1.getRole().setId(null);
+ userapp1.setPriority(null);
+ assertNotNull(userapp1.hashCode());
+
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserTest.java
new file mode 100644
index 00000000..7dee9529
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserTest.java
@@ -0,0 +1,216 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain;
+
+import static org.junit.Assert.*;
+
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.junit.Test;
+
+public class UserTest {
+
+ public User mockUser()
+ {
+ User user = new User();
+ user.setOrgId((long) 1);
+ user.setManagerId((long) 12);
+ user.setFirstName("firstName");
+ user.setMiddleInitial("middleInitial");
+ user.setLastName("lastName");
+ user.setPhone("phone");
+ user.setFax("fax");
+ user.setCellular("cellular");
+ user.setEmail("email");
+ user.setAddressId((long) 1);
+ user.setAlertMethodCd("alertMethodCd");
+ user.setHrid("hrid");
+ user.setOrgUserId("orgUserId");
+ user.setOrgCode("orgCode");
+ user.setAddress1("address1");
+ user.setAddress2("address2");
+ user.setCity("city");
+ user.setState("state");
+ user.setZipCode("zipCode");
+ user.setCountry("country");
+ user.setOrgManagerUserId("orgManagerUserId");
+ user.setLocationClli("locationClli");
+ user.setBusinessCountryCode("businessCountryCode");
+ user.setBusinessCountryName("businessCountryName");
+ user.setBusinessUnit("businessUnit");
+ user.setBusinessUnitName("businessUnitName");
+ user.setDepartment("department");
+ user.setDepartmentName("departmentName");
+ user.setCompanyCode("companyCode");
+ user.setCompany("company");
+ user.setZipCodeSuffix("zipCodeSuffix");
+ user.setJobTitle("jobTitle");
+ user.setCommandChain("commandChain");
+ user.setSiloStatus("siloStatus");
+ user.setCostCenter("costCenter");
+ user.setFinancialLocCode("financialLocCode");
+ user.setLoginId("loginId");
+ user.setLoginPwd("loginPwd");
+ user.setLastLoginDate(null);
+ user.setActive(false);
+ user.setInternal(false);
+ user.setSelectedProfileId((long) 1);
+ user.setTimeZoneId((long) 1);
+ user.setChatId("chatId");
+ user.setUserApps(null);
+ user.setPseudoRoles(null);
+ user.setOnline(false);
+ return user;
+ }
+
+ @Test
+ public void userTest()
+ {
+ User mockUser = mockUser();
+ User user = mockUser();
+ assertEquals(user.getOrgId(), mockUser.getOrgId());
+ assertEquals(user.getManagerId(), mockUser.getManagerId());
+ assertEquals(user.getFirstName(), mockUser.getFirstName());
+ assertEquals(user.getMiddleInitial(), mockUser.getMiddleInitial());
+ assertEquals(user.getLastName(), mockUser.getLastName());
+ assertEquals(user.getPhone(), mockUser.getPhone());
+ assertEquals(user.getFax(), mockUser.getFax());
+ assertEquals(user.getCellular(), mockUser.getCellular());
+ assertEquals(user.getEmail(), mockUser.getEmail());
+ assertEquals(user.getAddressId(), mockUser.getAddressId());
+ assertEquals(user.getAlertMethodCd(), mockUser.getAlertMethodCd());
+ assertEquals(user.getHrid(), mockUser.getHrid());
+ assertEquals(user.getOrgUserId(), mockUser.getOrgUserId());
+ assertEquals(user.getOrgCode(), mockUser.getOrgCode());
+ assertEquals(user.getAddress1(), mockUser.getAddress1());
+ assertEquals(user.getAddress2(), mockUser.getAddress2());
+ assertEquals(user.getCity(), mockUser.getCity());
+ assertEquals(user.getState(), mockUser.getState());
+ assertEquals(user.getZipCode(), mockUser.getZipCode());
+ assertEquals(user.getCountry(), mockUser.getCountry());
+ assertEquals(user.getOrgManagerUserId(), mockUser.getOrgManagerUserId());
+ assertEquals(user.getLocationClli(), mockUser.getLocationClli());
+ assertEquals(user.getBusinessCountryCode(), mockUser.getBusinessCountryCode());
+ assertEquals(user.getBusinessCountryName(), mockUser.getBusinessCountryName());
+ assertEquals(user.getBusinessUnit(), mockUser.getBusinessUnit());
+ assertEquals(user.getBusinessUnitName(), mockUser.getBusinessUnitName());
+ assertEquals(user.getDepartment(), mockUser.getDepartment());
+ assertEquals(user.getDepartmentName(), mockUser.getDepartmentName());
+ assertEquals(user.getCompanyCode(), mockUser.getCompanyCode());
+ assertEquals(user.getCompany(), mockUser.getCompany());
+ assertEquals(user.getZipCodeSuffix(), mockUser.getZipCodeSuffix());
+ assertEquals(user.getJobTitle(), mockUser.getJobTitle());
+ assertEquals(user.getCommandChain(), mockUser.getCommandChain());
+ assertEquals(user.getSiloStatus(), mockUser.getSiloStatus());
+ assertEquals(user.getCostCenter(), mockUser.getCostCenter());
+ assertEquals(user.getFinancialLocCode(), mockUser.getFinancialLocCode());
+ assertEquals(user.getLoginId(), mockUser.getLoginId());
+ assertEquals(user.getLoginPwd(), mockUser.getLoginPwd());
+ assertEquals(user.getLastLoginDate(), mockUser.getLastLoginDate());
+ assertEquals(user.getActive(), mockUser.getActive());
+ assertEquals(user.getInternal(), mockUser.getInternal());
+ assertEquals(user.getSelectedProfileId(), mockUser.getSelectedProfileId());
+ assertEquals(user.getTimeZoneId(), mockUser.getTimeZoneId());
+ assertEquals(user.getChatId(), mockUser.getChatId());
+ assertEquals(user.getUserApps(), mockUser.getUserApps());
+ assertEquals(user.getPseudoRoles(), mockUser.getPseudoRoles());
+ assertEquals(user.getFullName(), mockUser.getFullName());
+ assertFalse(user.isOnline());
+
+
+ }
+
+ @Test
+ public void addAppRolesIfRolesNullTest()
+ {
+ User user = mockUser();
+ Set userApps = new TreeSet();
+ UserApp userapp = new UserApp();
+ userApps.add(userapp);
+ user.setUserApps(userApps);
+ user.setUserApps(userApps);
+ App app = new App();
+ user.addAppRoles(app, null);
+ }
+
+ @Test
+ public void addAppRolesTest()
+ {
+ User user = mockUser();
+ App app = new App();
+
+ SortedSet<Role> roles = new TreeSet<>();
+ Role role = new Role();
+ role.setId((long) 1);
+ role.setName("test");
+ roles.add(role);
+ user.addAppRoles(app, roles);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void addandRemoveRoleTest()
+ {
+ User user = mockUser();
+ Set userApps = new TreeSet();
+ UserApp userapp = new UserApp();
+ SortedSet<Role> roles = new TreeSet();
+ Role role = new Role();
+ role.setId((long) 1);
+ roles.add(role);
+ userapp.setRole(role);
+ userApps.add(userapp);
+ user.setUserApps(userApps);
+ user.removeRole((long) 1);
+ user.addRole(role);
+ user.setRoles(roles);
+ UserApp userapplication = user.getDefaultUserApp();
+ assertTrue(userapplication.getRole().getId() == 1);
+ }
+
+ @Test
+ public void comapreToTest() {
+
+ User user1 = mockUser();
+ User user = mockUser();
+ user.setFirstName("test");
+ assertEquals(user.compareTo(user1), 14);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/sessionmgt/TimeoutVOTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/sessionmgt/TimeoutVOTest.java
new file mode 100644
index 00000000..30dfa083
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/sessionmgt/TimeoutVOTest.java
@@ -0,0 +1,82 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.domain.sessionmgt;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.DomainVo;
+
+public class TimeoutVOTest {
+
+ public TimeoutVO mockTimeoutVO(){
+ TimeoutVO timeoutVO = new TimeoutVO("test", (long) 1);
+ timeoutVO.setjSessionId("test");
+ timeoutVO.setSessionTimOutMilliSec((long)1);
+
+ return timeoutVO;
+ }
+
+ @Test
+ public void timeoutVOTest(){
+ TimeoutVO timeoutVO1 = mockTimeoutVO();
+
+ TimeoutVO timeoutVO = new TimeoutVO("test", (long) 1);
+ timeoutVO.setjSessionId("test");
+ timeoutVO.setSessionTimOutMilliSec((long)1);
+
+ assertEquals(timeoutVO.getjSessionId(), timeoutVO1.getjSessionId());
+ assertEquals(timeoutVO.getSessionTimOutMilliSec(), timeoutVO1.getSessionTimOutMilliSec());
+
+ }
+
+ @Test
+ public void equalsTest(){
+ TimeoutVO timeoutVO1 = mockTimeoutVO();
+ TimeoutVO timeoutVO2 = mockTimeoutVO();
+ assertEquals(true, timeoutVO1.equals(timeoutVO2));
+ }
+
+ @Test
+ public void compareTest(){
+ TimeoutVO timeoutVO1 = mockTimeoutVO();
+ TimeoutVO timeoutVO2 = mockTimeoutVO();
+ assertEquals(0, timeoutVO1.compareTo(timeoutVO2));
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/AppServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/AppServiceImplTest.java
new file mode 100644
index 00000000..c16e9493
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/AppServiceImplTest.java
@@ -0,0 +1,97 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.portalsdk.core.domain.App;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AppServiceImplTest {
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @InjectMocks
+ private AppServiceImpl appServiceImpl;
+
+ @Test
+ public void getAppsTest() {
+ App app = new App();
+ List<App> appList = new ArrayList<>();
+ appList.add(app);
+ when(dataAccessService.getList(App.class, null)).thenReturn(appList);
+ List<App> list = appServiceImpl.getApps();
+ Assert.assertTrue(list.size() > 0);
+ }
+
+ @Test
+ public void getAppTest() {
+ Long appId = 1l;
+ when(dataAccessService.getDomainObject(App.class, appId, null)).thenReturn(new App());
+ App app = appServiceImpl.getApp(appId);
+ Assert.assertNotNull(app);
+ }
+
+ @Test
+ public void getDefaultAppTest() {
+ Long appId = 1l;
+ when(dataAccessService.getDomainObject(App.class, appId, null)).thenReturn(new App());
+ App app = appServiceImpl.getDefaultApp();
+ Assert.assertNotNull(app);
+ }
+
+ @Test
+ public void getDefaultAppNameTest() {
+ Long appId = 1l;
+ App app = new App();
+ app.setName("Default App");
+ when(dataAccessService.getDomainObject(App.class, appId, null)).thenReturn(app);
+ String defaultAppname = appServiceImpl.getDefaultAppName();
+ Assert.assertEquals(app.getName(), defaultAppname);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/AuditServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/AuditServiceImplTest.java
new file mode 100644
index 00000000..ade19911
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/AuditServiceImplTest.java
@@ -0,0 +1,60 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AuditServiceImplTest {
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @InjectMocks
+ private AuditServiceImpl auditServiceImpl;
+
+ @Test
+ public void logActivityTest(){
+ auditServiceImpl.logActivity(null, null);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/BroadcastServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/BroadcastServiceImplTest.java
new file mode 100644
index 00000000..83ae5a42
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/BroadcastServiceImplTest.java
@@ -0,0 +1,182 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.portalsdk.core.domain.BroadcastMessage;
+import org.onap.portalsdk.core.domain.Lookup;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.portalsdk.core.web.support.AppUtils;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.test.util.ReflectionTestUtils;
+
+@RunWith(MockitoJUnitRunner.class)
+public class BroadcastServiceImplTest {
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @InjectMocks
+ private BroadcastServiceImpl broadcastServiceImpl;
+
+ @Test
+ public void getBcModelTest(){
+ Lookup lookup = new Lookup();
+ lookup.setValue("123");
+ List<Lookup> lookupList = new ArrayList<>();
+ lookupList.add(lookup);
+
+ BroadcastMessage broadcastMessage = new BroadcastMessage();
+ broadcastMessage.setActive(false);
+ ReflectionTestUtils.invokeSetterMethod(new AppUtils(), "dataAccessService", dataAccessService);
+
+ List<BroadcastMessage> messagesList = new ArrayList<>();
+ BroadcastMessage message1 = new BroadcastMessage();
+ message1.setLocationId(123);
+ message1.setSortOrder(1);
+ message1.setId(1L);
+ BroadcastMessage message2 = new BroadcastMessage();
+ message2.setLocationId(456);
+ message2.setSortOrder(2);
+ message2.setId(2L);
+ messagesList.add(message1);
+ messagesList.add(message2);
+ Mockito.when(dataAccessService.getList(BroadcastMessage.class,null)).thenReturn(messagesList);
+ Mockito.when(dataAccessService.getDomainObject(BroadcastMessage.class, 5L, null)).thenReturn(broadcastMessage);
+
+ Mockito.when(dataAccessService.getLookupList("fn_lu_message_location", "message_location_id",
+ "message_location_descr", "", "message_location_id",null)).thenReturn(lookupList);
+ System.setProperty(SystemProperties.CLUSTERED,"true");
+
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.addParameter("message_id", "5");
+ request.addParameter("task", "toggleActive");
+ Map bcModel = broadcastServiceImpl.getBcModel(request);
+ Assert.assertTrue(bcModel.size() > 0);
+ }
+
+ @Test
+ public void displayMessagesTest(){
+ Lookup lookup = new Lookup();
+ lookup.setValue("123");
+ List<Lookup> lookupList = new ArrayList<>();
+ lookupList.add(lookup);
+
+ List<BroadcastMessage> messagesList = new ArrayList<>();
+ BroadcastMessage message1 = new BroadcastMessage();
+ message1.setLocationId(123);
+ message1.setSortOrder(1);
+ message1.setId(1L);
+ message1.setMessageText("Hello1");
+ BroadcastMessage message2 = new BroadcastMessage();
+ message2.setLocationId(456);
+ message2.setSortOrder(2);
+ message2.setId(2L);
+ message2.setMessageText("Hello2");
+ messagesList.add(message1);
+ messagesList.add(message2);
+
+ ReflectionTestUtils.invokeSetterMethod(new AppUtils(), "dataAccessService", dataAccessService);
+
+ Mockito.when(dataAccessService.executeNamedQuery(Matchers.anyString(), Matchers.anyMap(), Matchers.anyMap())).thenReturn(messagesList);
+ Mockito.when(dataAccessService.getLookupList("fn_lu_message_location", "message_location_id",
+ "message_location_descr", "", "message_location_id",null)).thenReturn(lookupList);
+ broadcastServiceImpl.loadMessages();
+ String message = broadcastServiceImpl.displayMessages("123");
+ Assert.assertTrue(message.contains(message1.getMessageText()));
+ }
+
+ @Test
+ public void hasServerMessagesTest(){
+
+ Lookup lookup = new Lookup();
+ lookup.setValue("123");
+ List<Lookup> lookupList = new ArrayList<>();
+ lookupList.add(lookup);
+
+ List<BroadcastMessage> messagesList = new ArrayList<>();
+ BroadcastMessage message1 = new BroadcastMessage();
+ message1.setLocationId(123);
+ message1.setSortOrder(1);
+ message1.setId(1L);
+ message1.setMessageText("Hello1");
+ BroadcastMessage message2 = new BroadcastMessage();
+ message2.setLocationId(456);
+ message2.setSortOrder(2);
+ message2.setId(2L);
+ message2.setMessageText("Hello2");
+ messagesList.add(message1);
+ messagesList.add(message2);
+
+ ReflectionTestUtils.invokeSetterMethod(new AppUtils(), "dataAccessService", dataAccessService);
+
+ Mockito.when(dataAccessService.executeNamedQuery(Matchers.anyString(), Matchers.anyMap(), Matchers.anyMap())).thenReturn(messagesList);
+ Mockito.when(dataAccessService.getLookupList("fn_lu_message_location", "message_location_id",
+ "message_location_descr", "", "message_location_id",null)).thenReturn(lookupList);
+ broadcastServiceImpl.loadMessages();
+ boolean messageExist = broadcastServiceImpl.hasServerMessages("123","123");
+ Assert.assertTrue(messageExist);
+ }
+
+ @Test
+ public void getBroadcastMessageTest(){
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.addParameter("message_id", "5");
+ request.addParameter("message_location_id", "123");
+ Mockito.when(dataAccessService.getDomainObject(BroadcastMessage.class, 5L, null)).thenReturn(new BroadcastMessage());
+ broadcastServiceImpl.getBroadcastMessage(request);
+ }
+
+ @Test
+ public void getBroadcastMessageWithoutLocIdTest(){
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.addParameter("message_id", "5");
+ Mockito.when(dataAccessService.getDomainObject(BroadcastMessage.class, 5L, null)).thenReturn(new BroadcastMessage());
+ broadcastServiceImpl.getBroadcastMessage(request);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/DataAccessServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/DataAccessServiceImplTest.java
new file mode 100644
index 00000000..7f179f66
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/DataAccessServiceImplTest.java
@@ -0,0 +1,350 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.hibernate.Criteria;
+import org.hibernate.Query;
+import org.hibernate.SQLQuery;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Restrictions;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.FusionObject.Parameters;
+import org.onap.portalsdk.core.domain.support.DomainVo;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ SystemProperties.class })
+public class DataAccessServiceImplTest {
+
+ @Mock
+ private SessionFactory sessionFactory;
+
+ @InjectMocks
+ private DataAccessServiceImpl dataAccessServiceImpl;
+
+ @Test
+ public void getDomainObjectTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Long id = 1L;
+ DomainVo domainVo = new DomainVo();
+ domainVo.setId(id);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.get(DomainVo.class, id)).thenReturn(domainVo);
+ DomainVo returnDomainVo = dataAccessServiceImpl.getDomainObject(DomainVo.class, id, null);
+ Assert.assertEquals(id, returnDomainVo.getId());
+ }
+
+ @Test
+ public void deleteDomainObjectTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ dataAccessServiceImpl.deleteDomainObject(new DomainVo(), new HashMap<>());
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteDomainObjectsTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createQuery(Mockito.anyString())).thenReturn(mockQuery);
+ String whereClause = "id = 1";
+ dataAccessServiceImpl.deleteDomainObjects(DomainVo.class, whereClause, new HashMap<>());
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void saveDomainObjectWithNewTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Map params = new HashMap();
+ params.put(Parameters.PARAM_USERID, 1);
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.APPLICATION_USER_ID)).thenReturn("123");
+ DomainVo domainVo = new DomainVo();
+ domainVo.setId(0L);
+ dataAccessServiceImpl.saveDomainObject(domainVo, params);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void saveDomainObjectWithUpdateTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Map params = new HashMap();
+ params.put(Parameters.PARAM_USERID, 1L);
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.APPLICATION_USER_ID)).thenReturn("123");
+ DomainVo domainVo = new DomainVo();
+ domainVo.setId(10L);
+ dataAccessServiceImpl.saveDomainObject(domainVo, params);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getListWithOnlyClassTest() {
+
+ DomainVo domainVo1 = new DomainVo();
+ domainVo1.setId(1L);
+ DomainVo domainVo2 = new DomainVo();
+ domainVo2.setId(1L);
+
+ List<DomainVo> domainVoList = new ArrayList<>();
+ domainVoList.add(domainVo1);
+ domainVoList.add(domainVo2);
+
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createQuery(Mockito.anyString())).thenReturn(mockQuery);
+ Mockito.when(mockQuery.list()).thenReturn(domainVoList);
+ List list = dataAccessServiceImpl.getList(DomainVo.class, new HashMap());
+ Assert.assertEquals(2, list.size());
+
+ }
+
+ @Test
+ public void getListWithOrderAndFilterTest() {
+
+ DomainVo domainVo1 = new DomainVo();
+ domainVo1.setId(1L);
+ DomainVo domainVo2 = new DomainVo();
+ domainVo2.setId(1L);
+
+ List<DomainVo> domainVoList = new ArrayList<>();
+ domainVoList.add(domainVo1);
+ domainVoList.add(domainVo2);
+
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createQuery(Mockito.anyString())).thenReturn(mockQuery);
+ Mockito.when(mockQuery.list()).thenReturn(domainVoList);
+ List list = dataAccessServiceImpl.getList(DomainVo.class, "", "", new HashMap());
+ Assert.assertEquals(2, list.size());
+
+ }
+
+ @Test
+ public void getListTest() {
+ String filterClause = " where id = '1' ";
+
+ DomainVo domainVo1 = new DomainVo();
+ domainVo1.setId(1L);
+ DomainVo domainVo2 = new DomainVo();
+ domainVo2.setId(1L);
+
+ List<DomainVo> domainVoList = new ArrayList<>();
+ domainVoList.add(domainVo1);
+ domainVoList.add(domainVo2);
+
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createQuery(Mockito.anyString())).thenReturn(mockQuery);
+ Mockito.when(mockQuery.list()).thenReturn(domainVoList);
+ List list = dataAccessServiceImpl.getList(DomainVo.class, filterClause, "id", new HashMap());
+ Assert.assertEquals(2, list.size());
+ }
+
+ @Test
+ public void getListGenericTest() {
+
+ List<Criterion> restrictionsList = new ArrayList<>();
+ List<Order> orderList = new ArrayList<>();
+ orderList.add(Order.asc("id"));
+ Criterion criterion1 = Restrictions.like("urlsAccessibleKey.url", "URL%");
+ restrictionsList.add(criterion1);
+ Session mockedSession = Mockito.mock(Session.class);
+ Criteria criteria = Mockito.mock(Criteria.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createCriteria(DomainVo.class)).thenReturn(criteria);
+ List list = dataAccessServiceImpl.getList(DomainVo.class, null, restrictionsList, orderList);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void getLookupListTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ SQLQuery mockSQLQuery = Mockito.mock(SQLQuery.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createSQLQuery(Mockito.anyString())).thenReturn(mockSQLQuery);
+ Mockito.when(mockSQLQuery.list()).thenReturn(new ArrayList());
+ List list = dataAccessServiceImpl.getLookupList("User ", "1", "id", "id", "", null);
+ Assert.assertNull(list);
+ }
+
+ @Test
+ public void executeSQLQueryWithoutRangeTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ SQLQuery mockSQLQuery = Mockito.mock(SQLQuery.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createSQLQuery(Mockito.anyString())).thenReturn(mockSQLQuery);
+ Mockito.when(mockSQLQuery.addEntity("org.onap.portalsdk.core.domain.support.domainvo", DomainVo.class))
+ .thenReturn(mockSQLQuery);
+ List list = dataAccessServiceImpl.executeSQLQuery("select * ", DomainVo.class, null);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void executeSQLQueryTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ SQLQuery mockSQLQuery = Mockito.mock(SQLQuery.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createSQLQuery(Mockito.anyString())).thenReturn(mockSQLQuery);
+ Mockito.when(mockSQLQuery.addEntity("org.onap.portalsdk.core.domain.support.domainvo", DomainVo.class))
+ .thenReturn(mockSQLQuery);
+ List list = dataAccessServiceImpl.executeSQLQuery("select * ", DomainVo.class, 1, 3, null);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void executeQueryWithoutRangeTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createQuery(Mockito.anyString())).thenReturn(mockQuery);
+ List list = dataAccessServiceImpl.executeQuery("select * ", null);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void executeQueryTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createQuery(Mockito.anyString())).thenReturn(mockQuery);
+ List list = dataAccessServiceImpl.executeQuery("select * ", 1, 3, null);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void executeNamedQueryWithoutRangeTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.getNamedQuery(Mockito.anyString())).thenReturn(mockQuery);
+ Map params = new HashMap();
+ params.put("map", new HashMap());
+ params.put("list", new ArrayList());
+ String[] args = { "abc" };
+ params.put("obj", args);
+
+ List list = dataAccessServiceImpl.executeNamedQuery("select * ", params, null);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void executeNamedQueryTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.getNamedQuery(Mockito.anyString())).thenReturn(mockQuery);
+ Map params = new HashMap();
+ params.put("map", new HashMap());
+ params.put("list", new ArrayList());
+ String[] args = { "abc" };
+ params.put("obj", args);
+
+ List list = dataAccessServiceImpl.executeNamedQuery("select * ", params, 1, 3, null);
+ Assert.assertNotNull(list);
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void executeNamedQueryWithOrderByTest() {
+ dataAccessServiceImpl.executeNamedQueryWithOrderBy(DomainVo.class, "", null, "", false, 0, 3, null);
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void executeNamedCountQueryTest() {
+ dataAccessServiceImpl.executeNamedCountQuery(DomainVo.class, "select * ", " ", null);
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void executeNamedQueryExceptionTest() {
+ dataAccessServiceImpl.executeNamedQuery(DomainVo.class, "select * ", "", null, 1, 3, null);
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void executeNamedQueryWithOrderByExceptionTest() {
+ dataAccessServiceImpl.executeNamedQueryWithOrderBy(DomainVo.class, "", "", null, "", false, 0, 3, null);
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void getListExceptionTest() {
+ dataAccessServiceImpl.getList(DomainVo.class, null, null, null, null);
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void executeUpdateQueryTest() {
+ dataAccessServiceImpl.executeUpdateQuery("", null);
+ }
+
+ @Test
+ public void executeNamedUpdateQueryTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.getNamedQuery(Mockito.anyString())).thenReturn(mockQuery);
+ Mockito.when(mockQuery.executeUpdate()).thenReturn(1);
+ int result = dataAccessServiceImpl.executeNamedUpdateQuery("", null, null);
+ Assert.assertEquals(1, result);
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void synchronizeTest() {
+ dataAccessServiceImpl.synchronize(null);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ElementLinkServiceTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ElementLinkServiceTest.java
new file mode 100644
index 00000000..87e668b8
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ElementLinkServiceTest.java
@@ -0,0 +1,204 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.io.FilenameUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.portalsdk.core.util.YamlUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ SystemProperties.class, FilenameUtils.class , YamlUtils.class})
+public class ElementLinkServiceTest {
+
+ @Test
+ public void buildElementLinkYamlTest() throws IOException{
+ String stepName = "firstStep";
+ String[] args = {"file", "custom", stepName};
+ String modleYaml = "myYaml.yaml";
+
+
+ Map<String, Object> callFlowBs = new HashMap<>();
+ List<Map<String, Object>> callSteps = new ArrayList<>();
+ Map<String, Object> callStep = new HashMap<>();
+
+ List<Map<String, Object>> subSteps = new ArrayList<>();
+ Map<String, Object> subStep = new HashMap<>();
+ subStep.put("source_tosca_id", "SOURCE");
+ subStep.put("destination_tosca_id", "DESTINATION");
+ subSteps.add(subStep);
+
+ callStep.put("name", stepName);
+ callStep.put("subSteps", subSteps);
+
+ callSteps.add(callStep);
+ callFlowBs.put("callSequenceSteps", callSteps);
+ callFlowBs.put("shortName", "test step");
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ PowerMockito.mockStatic(YamlUtils.class);
+ Mockito.when(SystemProperties.getProperty("customCallFlow_path")).thenReturn("xyzPath");
+ Mockito.when(YamlUtils.readYamlFile(Mockito.anyString(), Mockito.anyString())).thenReturn(callFlowBs);
+ Mockito.when(YamlUtils.returnYaml(Mockito.anyObject())).thenReturn(modleYaml);
+
+ ElementLinkService elementLinkService = new ElementLinkService();
+ String linkYaml = elementLinkService.buildElementLinkYaml(args);
+ Assert.assertEquals(modleYaml, linkYaml);
+ }
+
+ @Test
+ public void addActiveNodesTest(){
+ String step ="STEP1";
+ Map<String, Object> callStep = new HashMap<>();
+ List<String> activeIds = new ArrayList<>();
+ activeIds.add(step);
+ callStep.put("activeIds", activeIds);
+ ElementLinkService elementLinkService = new ElementLinkService();
+ List<String> steps = elementLinkService.addActiveNodes(callStep);
+ Assert.assertTrue(steps.contains(step));
+ }
+
+ @Test
+ public void addDisconnectLinksTest(){
+ Map<String, Object> callStep = new HashMap<>();
+ List<Map<String, Object>> disconnectLinks = new ArrayList<>();
+ Map<String, Object> disconLink = new HashMap<>();
+ disconLink.put("DummyStep", "DummyYaml");
+ disconnectLinks.add(disconLink);
+ callStep.put("disconnectLinks", disconnectLinks);
+
+ ElementLinkService elementLinkService = new ElementLinkService();
+ List<Map<String, Object>> returnDisconnectLinks = elementLinkService.addDisconnectLinks(callStep);
+ Assert.assertTrue(returnDisconnectLinks.size() > 0);
+ }
+
+ @Test
+ public void addLinkVerticesTest(){
+ Map<String, Object> callStep = new HashMap<>();
+ List<Map<String, Object>> vertices = new ArrayList<>();
+ Map<String, Object> vertices1 = new HashMap<>();
+ vertices1.put("x", 10);
+ vertices1.put("y", 20);
+ vertices1.put("D", "D");
+ vertices1.put("L", "L");
+
+ Map<String, Object> vertices2 = new HashMap<>();
+ vertices2.put("x", 30);
+ vertices2.put("y", 40);
+ vertices2.put("D", "D");
+ vertices2.put("L", "L");
+
+ vertices.add(vertices1);
+ vertices.add(vertices2);
+ callStep.put("vertices", vertices);
+ ElementLinkService elementLinkService = new ElementLinkService();
+ List<Map<String, Object>> returnVertices = elementLinkService.addLinkVertices(callStep);
+ Assert.assertTrue(returnVertices.size() > 0);
+ }
+
+ @Test
+ public void mainTest() throws Exception{
+ String[] args = {"file", "custom",};
+ String stepName = "Step_2";
+ Map<String, Object> callFlowBs = new HashMap<>();
+ List<Map<String, Object>> callSteps = new ArrayList<>();
+ Map<String, Object> callStep = new HashMap<>();
+
+ List<Map<String, Object>> subSteps = new ArrayList<>();
+ Map<String, Object> subStep = new HashMap<>();
+ subStep.put("source_tosca_id", "SOURCE");
+ subStep.put("destination_tosca_id", "DESTINATION");
+ subSteps.add(subStep);
+
+ callStep.put("name", stepName);
+ callStep.put("subSteps", subSteps);
+
+ callSteps.add(callStep);
+ callFlowBs.put("callSequenceSteps", callSteps);
+ callFlowBs.put("shortName", "teststep");
+
+ PowerMockito.mockStatic(YamlUtils.class);
+ Mockito.when(YamlUtils.readYamlFile(Mockito.anyString(), Mockito.anyString())).thenReturn(callFlowBs);
+ Mockito.when(YamlUtils.returnYaml(Mockito.anyObject())).thenReturn("modleYaml");
+ ElementLinkService.main(args);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void mainExceptionLogTest() throws Exception{
+ String[] args = {"file", "custom",};
+ String stepName = "Step_2";
+ Map<String, Object> callFlowBs = new HashMap<>();
+ List<Map<String, Object>> callSteps = new ArrayList<>();
+ Map<String, Object> callStep = new HashMap<>();
+
+ List<Map<String, Object>> subSteps = new ArrayList<>();
+ Map<String, Object> subStep = new HashMap<>();
+ subStep.put("source_tosca_id", "SOURCE");
+ subStep.put("destination_tosca_id", "DESTINATION");
+ subSteps.add(subStep);
+
+ callStep.put("name", stepName);
+ callStep.put("subSteps", subSteps);
+
+ callSteps.add(callStep);
+ callFlowBs.put("callSequenceSteps", callSteps);
+ callFlowBs.put("shortName", "teststep");
+ callStep.put("activeIds", "activeIds");
+ callStep.put("disconnectLinks", "disconnectLinks");
+
+ PowerMockito.mockStatic(YamlUtils.class);
+ Mockito.when(YamlUtils.readYamlFile(Mockito.anyString(), Mockito.anyString())).thenReturn(callFlowBs);
+ Mockito.when(YamlUtils.returnYaml(Mockito.anyObject())).thenReturn("modleYaml");
+ ElementLinkService.main(args);
+ Assert.assertTrue(true);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ElementMapServiceTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ElementMapServiceTest.java
new file mode 100644
index 00000000..18771c63
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ElementMapServiceTest.java
@@ -0,0 +1,481 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.io.FilenameUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.support.Container;
+import org.onap.portalsdk.core.domain.support.Domain;
+import org.onap.portalsdk.core.domain.support.Element;
+import org.onap.portalsdk.core.domain.support.ElementDetails;
+import org.onap.portalsdk.core.domain.support.Layout;
+import org.onap.portalsdk.core.domain.support.Position;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.portalsdk.core.util.YamlUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ SystemProperties.class, FilenameUtils.class , YamlUtils.class})
+public class ElementMapServiceTest {
+
+ @Test
+ public void buildElementMapYamlTest() throws IOException{
+ String rootDir = "rootDir";
+ String networkToscaYml ="networksca";
+ String networkLayoutYml ="networkLayoutYml";
+ String[] args = {"", "", rootDir, networkToscaYml, networkLayoutYml, "layout"};
+
+ Map<String, Object> toscaYaml = new HashMap<>();
+ Map<String, Object> networkMapLayoutYaml = new HashMap<>();
+
+ List<Object> toscaNetEleList = new ArrayList<>();
+ networkMapLayoutYaml.put("toscaNetworkMapElementStyleList", toscaNetEleList);
+ Map<String, String> elementDetails = new HashMap<>();
+ elementDetails.put("tosca_id", "TO_SCA_ID");
+ elementDetails.put("id", "ID");
+ elementDetails.put("row", "ROW");
+ elementDetails.put("column", "COLUMN");
+ elementDetails.put("icon", "ICON");
+
+ toscaNetEleList.add(elementDetails);
+
+ List<Object> containerStyleList = new ArrayList<>();
+
+ Map<String, String> containerDetails = new HashMap<>();
+ containerDetails.put("logical_group_name", "/TO_SCA_ID");
+ containerDetails.put("id", "ID");
+ containerDetails.put("domain", "DOMAIN");
+ containerDetails.put("row", "ROW");
+ containerDetails.put("column", "COLUMN");
+ containerStyleList.add(containerDetails);
+ networkMapLayoutYaml.put("containerStyleList", containerStyleList);
+
+ List<Object> domainList = new ArrayList<>();
+
+ Map<String, String> domainDetails = new HashMap<>();
+ domainDetails.put("name", "/TO_SCA_ID");
+ domainDetails.put("id", "ID");
+ domainDetails.put("row", "ROW");
+ domainDetails.put("column", "COLUMN");
+ domainList.add(domainDetails);
+ networkMapLayoutYaml.put("domainList", domainList);
+
+
+ PowerMockito.mockStatic(YamlUtils.class);
+
+ Map<String, Object> topologyMap = new HashMap<>();
+ toscaYaml.put("topology_template", topologyMap);
+
+ Map<String, Object> nodeTemplateMap = new HashMap<>();
+ topologyMap.put("node_templates", nodeTemplateMap);
+
+ Mockito.when(YamlUtils.readYamlFile(rootDir, networkToscaYml+".yml")).thenReturn(toscaYaml);
+ Mockito.when(YamlUtils.readYamlFile(rootDir, networkLayoutYml+".yml")).thenReturn(networkMapLayoutYaml);
+
+ ElementMapService elementMapService = new ElementMapService();
+ elementMapService.buildElementMapYaml(args);
+ }
+
+
+ @Test
+ public void convertToYAMLTest() throws Exception {
+ ElementMapService elementMapService = new ElementMapService();
+
+ String contextRealPath = "element_map_icon_path";
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ Domain domain = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ domain.setP(position);
+ domainRowCol.put("00", domain);
+ domainRowCol.put("01", domain);
+ domainRowCol.put("10", domain);
+ layout.setDomainRowCol(domainRowCol);
+
+ Map<String, Element> elementRowcol = new HashMap<>();
+ Element element = new Element("12", "ue6");
+ element.setP(position);
+ element.setBorderType("V");
+ Element element2 = new Element("22", "ue6");
+ element2.setP(position);
+ element2.setBorderType("U");
+ elementRowcol.put("12", element);
+ elementRowcol.put("22", element2);
+
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ container00.setElements(elementRowcol);
+
+ container00.setP(position);
+
+ Map<String, Container> innerContainer = new HashMap<>();
+ Container container01 = new Container("test","test",1,1,10,10,10,10,10,10);
+ Map<String, Element> elementRowcolInner = new HashMap<>();
+ Element elementInner = new Element("12", "dashed");
+ elementInner.setP(position);
+ elementInner.setBorderType("V");
+
+ Element elementInner2 = new Element("22", "test");
+ elementInner2.setP(position);
+ elementInner2.setBorderType("U");
+
+ elementRowcolInner.put("12", elementInner);
+ elementRowcolInner.put("22", elementInner2);
+
+ container01.setP(position);
+ container01.setElements(elementRowcolInner);
+ innerContainer.put("01", container01);
+
+ container00.setInnerContainer(innerContainer);
+ containerRowCol.put("00", container00);
+
+ domain.setContainers(containerRowCol);
+
+ List<Domain> domainList = new ArrayList<>();
+ domainList.add(domain);
+ layout.setCollapsedDomainsNewList(domainList);
+
+ Method method = elementMapService.getClass().getDeclaredMethod("convertToYAML", String.class, Layout.class );
+ method.setAccessible(true);
+ String output = (String) method.invoke(elementMapService, contextRealPath,layout);
+ Assert.assertNotNull(output);
+ }
+
+ @Test
+ public void computeRowsTest() throws Exception {
+ Set<String> rows = new HashSet<>();
+ rows.add("2");
+ ElementMapService elementMapService = new ElementMapService();
+ Method method = elementMapService.getClass().getDeclaredMethod("computeRows", Set.class);
+ method.setAccessible(true);
+ int returnValue = (int) method.invoke(elementMapService, rows);
+ Assert.assertEquals(3, returnValue);
+ returnValue = (int) method.invoke(elementMapService, new HashSet<String>());
+ Assert.assertEquals(1, returnValue);
+ }
+
+ @Test
+ public void computeColumnsTest() throws Exception {
+ Set<String> columns = new HashSet<>();
+ columns.add("02");
+ ElementMapService elementMapService = new ElementMapService();
+ Method method = elementMapService.getClass().getDeclaredMethod("computeColumns", Set.class);
+ method.setAccessible(true);
+ int returnValue = (int) method.invoke(elementMapService, columns);
+ Assert.assertEquals(3, returnValue);
+ returnValue = (int) method.invoke(elementMapService, new HashSet<String>());
+ Assert.assertEquals(1, returnValue);
+ }
+
+ @Test
+ public void fetchContainerObjectTest() throws Exception {
+ ElementMapService elementMapService = new ElementMapService();
+ Method method = elementMapService.getClass().getDeclaredMethod("fetchContainerObject", String.class, String.class, boolean.class, String.class, String.class) ;
+ method.setAccessible(true);
+
+
+ HashMap<String, Element> elementMap = new HashMap<>();
+ String elementId = "234";
+ Element element = new Element(elementId, "test");
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ element.setP(position);
+ element.setBorderType("U");
+ elementMap.put("241", element);
+
+ String logicalName = "Test Logical Name";
+ String domain = "Test Domain";
+ String name = "Test Container";
+
+ ElementDetails elementDetails = new ElementDetails(logicalName,"test","test","test","test","test","test","test","test","test");
+ element.setDetails(elementDetails);
+
+ Field field = elementMapService.getClass().getDeclaredField("elementMap");
+ field.setAccessible(true);
+ field.set(elementMapService, elementMap);
+
+ HashMap<String, Object> toscaElementsMap = new HashMap<>();
+ HashMap<String, Object> innertoscaElementsMap = new HashMap<>();
+
+
+ HashMap<String, String> properties = new HashMap<>();
+ properties.put("domain", domain);
+ innertoscaElementsMap.put("properties", properties);
+ toscaElementsMap.put(elementId, innertoscaElementsMap);
+
+ Field toscalEleMap = elementMapService.getClass().getDeclaredField("toscaElementsMap");
+ toscalEleMap.setAccessible(true);
+ toscalEleMap.set(elementMapService, toscaElementsMap);
+
+ Container container = (Container) method.invoke(elementMapService, elementId, name , true, logicalName, domain);
+ Assert.assertEquals(name, container.getName());
+ }
+
+ @Test
+ public void fetchContainerObjectWithFalseTest() throws Exception{
+
+ ElementMapService elementMapService = new ElementMapService();
+ Method method = elementMapService.getClass().getDeclaredMethod("fetchContainerObject", String.class, String.class, boolean.class, String.class, String.class) ;
+ method.setAccessible(true);
+
+ HashMap<String, Element> elementMap = new HashMap<>();
+ String elementId = "278";
+ Element element = new Element(elementId, "test");
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ element.setP(position);
+ element.setBorderType("U");
+ elementMap.put("285", element);
+
+ String logicalName = "Test Logical Name";
+ String domain = "Test Domain";
+ String name = "Test Container";
+
+ ElementDetails elementDetails = new ElementDetails(logicalName,"test","test","test","test","test","test","test","test","test");
+ element.setDetails(elementDetails);
+
+ Field field = elementMapService.getClass().getDeclaredField("elementMap");
+ field.setAccessible(true);
+ field.set(elementMapService, elementMap);
+
+ HashMap<String, Object> toscaElementsMap = new HashMap<>();
+ HashMap<String, Object> innertoscaElementsMap = new HashMap<>();
+
+
+ HashMap<String, String> properties = new HashMap<>();
+ properties.put("domain", domain);
+ innertoscaElementsMap.put("properties", properties);
+ toscaElementsMap.put(elementId, innertoscaElementsMap);
+
+ Field toscalEleMap = elementMapService.getClass().getDeclaredField("toscaElementsMap");
+ toscalEleMap.setAccessible(true);
+ toscalEleMap.set(elementMapService, toscaElementsMap);
+
+ HashMap<String, Container> innercontainerMap = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ innercontainerMap.put(domain + ":" + name, container00);
+ Field innercontainers = elementMapService.getClass().getDeclaredField("innercontainers");
+ innercontainers.setAccessible(true);
+ innercontainers.set(elementMapService, innercontainerMap);
+
+ Container container = (Container) method.invoke(elementMapService, elementId, name , false, logicalName, domain);
+ Assert.assertEquals(name, container.getName());
+
+ }
+
+ @Test
+ public void fetchContainerObjectWithFalse2Test() throws Exception{
+
+ ElementMapService elementMapService = new ElementMapService();
+ Method method = elementMapService.getClass().getDeclaredMethod("fetchContainerObject", String.class, String.class, boolean.class, String.class, String.class) ;
+ method.setAccessible(true);
+
+ HashMap<String, Element> elementMap = new HashMap<>();
+ String elementId = "278";
+
+ String logicalName = "Test Logical Name";
+ String domain = "Test Domain";
+ String name = "Test Container";
+
+ Field field = elementMapService.getClass().getDeclaredField("elementMap");
+ field.setAccessible(true);
+ field.set(elementMapService, elementMap);
+
+ HashMap<String, Object> toscaElementsMap = new HashMap<>();
+ HashMap<String, Object> innertoscaElementsMap = new HashMap<>();
+
+ HashMap<String, String> properties = new HashMap<>();
+ properties.put("domain", domain);
+ innertoscaElementsMap.put("properties", properties);
+ toscaElementsMap.put(elementId, innertoscaElementsMap);
+
+ Field toscalEleMap = elementMapService.getClass().getDeclaredField("toscaElementsMap");
+ toscalEleMap.setAccessible(true);
+ toscalEleMap.set(elementMapService, toscaElementsMap);
+
+ HashMap<String, Container> innercontainerMap = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ innercontainerMap.put(domain + ":" + name, container00);
+ Field innercontainers = elementMapService.getClass().getDeclaredField("innercontainers");
+ innercontainers.setAccessible(true);
+ innercontainers.set(elementMapService, innercontainerMap);
+
+ Container container = (Container) method.invoke(elementMapService, elementId, name , false, logicalName, domain);
+ Assert.assertEquals(name, container.getName());
+
+ }
+
+ @Test
+ public void fetchDomainObjectTest() throws Exception {
+ String id = "Domain Id";
+ String name = "D-Name";
+
+ ElementMapService elementMapService = new ElementMapService();
+ Method method = elementMapService.getClass().getDeclaredMethod("fetchDomainObject", String.class, String.class) ;
+ method.setAccessible(true);
+
+ Map<String, Element> elementRowCol = new HashMap<>();
+ Element element = new Element("374", "test");
+ Element element2 = new Element("375", "test");
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ element.setP(position);
+ element.setBorderType("U");
+ elementRowCol.put("285", element);
+ elementRowCol.put("382", element2);
+
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container023 = new Container("test","test",1,1,10,10,10,10,10,10);
+ containerRowCol.put("00", container023);
+
+
+ HashMap<String, Container> outercontainerMap = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ container00.setInnerContainer(containerRowCol);
+ container00.setElements(elementRowCol);
+ Container container01 = new Container("test","test",1,1,10,10,10,10,10,10);
+ container01.setElements(elementRowCol);
+ outercontainerMap.put(name+":", container00);
+ outercontainerMap.put(name+":/Test", container01);
+
+ Field outercontainers = elementMapService.getClass().getDeclaredField("outercontainers");
+ outercontainers.setAccessible(true);
+ outercontainers.set(elementMapService, outercontainerMap);
+ Domain domain = (Domain)method.invoke(elementMapService, id, name);
+ Assert.assertEquals(domain.getName(), name);
+
+ }
+
+ @Test
+ public void fetchElementObjectTest() throws Exception {
+
+ String domain = "Test Domain";
+
+ String id = "420";
+ String name = "ELEMENT";
+ String imagePath = "src/images/";
+
+ ElementMapService elementMapService = new ElementMapService();
+ Method method = elementMapService.getClass().getDeclaredMethod("fetchElementObject", String.class, String.class, String.class);
+ method.setAccessible(true);
+
+ HashMap<String, Object> toscaElementsMap = new HashMap<>();
+ HashMap<String, Object> innertoscaElementsMap = new HashMap<>();
+
+
+ HashMap<String, String> properties = new HashMap<>();
+ String network_function = "NETWORK_FUNCTION";
+ properties.put("domain", domain);
+
+ properties.put("logical_group", "logical/group");
+ properties.put("display_longname", "display_longname");
+ properties.put("display_shortname", "display_shortname");
+ properties.put("description", "description");
+ properties.put("primary_function", "primary_function");
+ properties.put("key_interfaces", "key_interfaces");
+ properties.put("location", "location");
+ properties.put("vendor", "vendor");
+ properties.put("vendor_shortname", "vendor_shortname");
+ properties.put("network_function", network_function);
+ properties.put("background_color", "background_color");
+
+
+ innertoscaElementsMap.put("properties", properties);
+ toscaElementsMap.put(name, innertoscaElementsMap);
+
+ Field toscalEleMap = elementMapService.getClass().getDeclaredField("toscaElementsMap");
+ toscalEleMap.setAccessible(true);
+ toscalEleMap.set(elementMapService, toscaElementsMap);
+ Element element= (Element)method.invoke(elementMapService, id, name, imagePath);
+ Assert.assertEquals(element.getImgFileName(), imagePath);
+ }
+
+ @Test
+ public void fetchElementObjectWithEmptyTest() throws Exception {
+
+ String domain = "Test Domain";
+
+ String id = "420";
+ String name = "ELEMENT";
+ String imagePath = "src/images/";
+
+ ElementMapService elementMapService = new ElementMapService();
+ Method method = elementMapService.getClass().getDeclaredMethod("fetchElementObject", String.class, String.class, String.class);
+ method.setAccessible(true);
+
+ HashMap<String, Object> toscaElementsMap = new HashMap<>();
+ HashMap<String, Object> innertoscaElementsMap = new HashMap<>();
+
+
+ HashMap<String, String> properties = new HashMap<>();
+ properties.put("domain", domain);
+
+ properties.put("logical_group", "logical/group");
+
+ innertoscaElementsMap.put("properties", properties);
+ toscaElementsMap.put(name, innertoscaElementsMap);
+
+ Field toscalEleMap = elementMapService.getClass().getDeclaredField("toscaElementsMap");
+ toscalEleMap.setAccessible(true);
+ toscalEleMap.set(elementMapService, toscaElementsMap);
+ Element element= (Element)method.invoke(elementMapService, id, name, imagePath);
+ Assert.assertEquals(element.getImgFileName(), imagePath);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FnMenuServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FnMenuServiceImplTest.java
new file mode 100644
index 00000000..2cf13d3a
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FnMenuServiceImplTest.java
@@ -0,0 +1,181 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.onap.portalsdk.core.domain.Menu;
+import org.onap.portalsdk.core.domain.MenuData;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+public class FnMenuServiceImplTest {
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @InjectMocks
+ private FnMenuServiceImpl fnMenuServiceImpl;
+
+ @Test
+ public void getFnMenuItemsTest() {
+ Long menuId = 1L;
+ List<MenuData> menuDataList = new ArrayList<>();
+ MenuData menuData = new MenuData();
+ menuData.setId(menuId);
+ menuDataList.add(menuData);
+ when(dataAccessService.getList(MenuData.class, null, "1", null)).thenReturn(menuDataList);
+ List<MenuData> returnList = fnMenuServiceImpl.getFnMenuItems();
+ Assert.assertTrue(returnList.size() > 0);
+ }
+
+ @Test
+ public void saveFnMenuDataTest() {
+ Long menuId = 1L;
+ MenuData menuData = new MenuData();
+ menuData.setId(menuId);
+ fnMenuServiceImpl.saveFnMenuData(menuData);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getParentIdTest() {
+ String label = "XYZ";
+
+ List<Long> longValues = new ArrayList<>();
+ longValues.add(1L);
+ longValues.add(2L);
+
+ Map<String, String> params = new HashMap<>();
+ params.put("paramLabel", label);
+ when(dataAccessService.executeNamedQuery("IdForLabelList", params, null)).thenReturn(longValues);
+ List<Long> returnList = fnMenuServiceImpl.getParentId(label);
+ Assert.assertTrue(returnList.size() > 0);
+
+ }
+
+ @Test
+ public void getParentListTest() {
+ List<List> parentList = new ArrayList<>();
+ List<Long> longValues = new ArrayList<>();
+ longValues.add(1L);
+ longValues.add(2L);
+ parentList.add(longValues);
+ when(dataAccessService.executeNamedQuery("parentList", null, null)).thenReturn(parentList);
+ List<List> returnParentList = fnMenuServiceImpl.getParentList();
+ Assert.assertTrue(returnParentList.size() > 0);
+ }
+
+ @Test
+ public void removeMenuItemDataTest() {
+ MenuData domainFnMenu = new MenuData();
+ domainFnMenu.setId(1L);
+ fnMenuServiceImpl.removeMenuItem(domainFnMenu);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void removeMenuItemTest() {
+ Menu menu = new Menu();
+ menu.setId(1L);
+ fnMenuServiceImpl.removeMenuItem(menu);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getMenuItemRowTest() {
+ Long id = 1L;
+ MenuData domainFnMenu = new MenuData();
+ domainFnMenu.setId(id);
+ when(dataAccessService.getDomainObject(MenuData.class, id, null)).thenReturn(domainFnMenu);
+ MenuData menuData = fnMenuServiceImpl.getMenuItemRow(id);
+ Assert.assertEquals(id, menuData.getId());
+ }
+
+ @Test
+ public void getMenuItemTest() {
+ Long id = 1L;
+ Menu menu = new Menu();
+ menu.setId(id);
+ when(dataAccessService.getDomainObject(Menu.class, id, null)).thenReturn(menu);
+ Menu returnMenu = fnMenuServiceImpl.getMenuItem(id);
+ Assert.assertEquals(id, returnMenu.getId());
+ }
+
+ @Test
+ public void saveFnMenuTest() {
+ Long id = 1L;
+ Menu menu = new Menu();
+ menu.setId(id);
+ fnMenuServiceImpl.saveFnMenu(menu);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void setMenuDataStructureTest() {
+ Set<MenuData> menuResult = new HashSet<>();
+
+ MenuData parentMenu = new MenuData();
+ parentMenu.setId(1L);
+
+ MenuData childMenu = new MenuData();
+ childMenu.setId(1L);
+
+ Set<MenuData> childSet = new HashSet<>();
+ childSet.add(childMenu);
+ parentMenu.setChildMenus(childSet);
+ menuResult.add(parentMenu);
+
+ List<List<MenuData>> childItemList = new ArrayList<>();
+ List<MenuData> parentList = new ArrayList<>();
+ fnMenuServiceImpl.setMenuDataStructure(childItemList, parentList, menuResult);
+ Assert.assertTrue(childItemList.size() > 0);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImplTest.java
new file mode 100644
index 00000000..b589c50b
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImplTest.java
@@ -0,0 +1,77 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ UserUtils.class })
+public class FunctionalMenuListServiceCentralizedImplTest {
+
+ @Mock
+ private RestApiRequestBuilder restApiRequestBuilder;
+
+ @InjectMocks
+ private FunctionalMenuListServiceCentralizedImpl fmServiceCentralizedImpl;
+
+ @Test(expected = IOException.class)
+ public void getFunctionCDListTest() throws IOException {
+
+ HttpServletRequest mockedRequest = Mockito.mock(HttpServletRequest.class);
+ User user = new User();
+ user.setOrgId(123L);
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ Mockito.when(restApiRequestBuilder.getViaREST("/menuFunctions", true, user.getOrgUserId())).thenReturn("");
+
+ fmServiceCentralizedImpl.getFunctionCDList(mockedRequest);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceImplTest.java
new file mode 100644
index 00000000..2cbedf97
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceImplTest.java
@@ -0,0 +1,79 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.RoleFunction;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+public class FunctionalMenuListServiceImplTest {
+
+ @InjectMocks
+ private FunctionalMenuListServiceImpl fmListServiceImpl;
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Test
+ public void getFunctionCDListTest() throws IOException {
+
+ HttpServletRequest mockedRequest = Mockito.mock(HttpServletRequest.class);
+ List<RoleFunction> roleFunctionList = new ArrayList<>();
+ RoleFunction roleFunction = new RoleFunction();
+ roleFunction.setId(1L);
+ roleFunction.setName("Test");
+ roleFunctionList.add(roleFunction);
+ Mockito.when(dataAccessService.executeNamedQuery("functionCDlist", null, null)).thenReturn(roleFunctionList);
+ List<RoleFunction> returnData = fmListServiceImpl.getFunctionCDList(mockedRequest);
+ Assert.assertTrue(returnData.size() > 0);
+
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LdapServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LdapServiceImplTest.java
new file mode 100644
index 00000000..87e507cd
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LdapServiceImplTest.java
@@ -0,0 +1,156 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import java.lang.reflect.Method;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.InitialDirContext;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.service.support.ServiceLocator;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ SystemProperties.class })
+public class LdapServiceImplTest {
+
+ @InjectMocks
+ private LdapServiceImpl ldapServiceImpl;
+
+ @Mock
+ private ServiceLocator serviceLocator;
+
+ @Test
+ public void searchPostTest() throws Exception {
+ User user = new User();
+ user.setFirstName("First Name");
+ user.setLastName("Last Name");
+ user.setHrid("HRID1");
+ user.setOrgManagerUserId("M123");
+ user.setOrgCode("ORG");
+ user.setEmail("xyz@xyz.com");
+ user.setOrgUserId("U123");
+
+ String sortBy1 = "sortBy1";
+ String sortBy2 = "sortBy2";
+ String sortBy3 = "sortBy3";
+ int pageNo = 10;
+ int dataSize = 20;
+ int userId = 123;
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.POST_INITIAL_CONTEXT_FACTORY)).thenReturn("FACTORY");
+ Mockito.when(SystemProperties.getProperty(SystemProperties.POST_PROVIDER_URL)).thenReturn("URL");
+ Mockito.when(SystemProperties.getProperty(SystemProperties.POST_SECURITY_PRINCIPAL)).thenReturn("PRINCIPAL");
+ Mockito.when(SystemProperties.getProperty(SystemProperties.POST_MAX_RESULT_SIZE)).thenReturn("1");
+
+ InitialDirContext dirContext = Mockito.mock(InitialDirContext.class);
+ SearchResult mockSearchResult = Mockito.mock(SearchResult.class);
+
+ Mockito.when(serviceLocator.getDirContext(Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(dirContext);
+
+ NamingEnumeration mockSearchResults = Mockito.mock(NamingEnumeration.class);
+ Mockito.when(dirContext.search(Mockito.anyString(), Mockito.anyString(), Mockito.any(SearchControls.class)))
+ .thenReturn(mockSearchResults);
+ Mockito.when(mockSearchResults.hasMore()).thenReturn(true);
+ Mockito.when(mockSearchResults.next()).thenReturn(mockSearchResult);
+ org.onap.portalsdk.core.command.support.SearchResult searchResult = (org.onap.portalsdk.core.command.support.SearchResult) ldapServiceImpl
+ .searchPost(user, sortBy1, sortBy2, sortBy3, pageNo, dataSize, userId);
+ Assert.assertNotNull(searchResult);
+ }
+
+ @Test
+ public void processAttributesTest() throws Exception {
+ BasicAttributes attributes = new BasicAttributes();
+
+ attributes.put("nickname", "FirstName");
+ attributes.put("initials", "Mr");
+
+ attributes.put("sn", "sn");
+ attributes.put("employeeNumber", "employeeNumber");
+ attributes.put("nickname", "FirstName");
+ attributes.put("mail", "mail");
+ attributes.put("telephoneNumber", "telephoneNumber");
+ attributes.put("departmentNumber", "departmentNumber");
+ attributes.put("a1", "a1");
+ attributes.put("street", "street");
+ attributes.put("roomNumber", "roomNumber");
+ attributes.put("l", "l");
+ attributes.put("st", "st");
+ attributes.put("postalCode", "postalCode");
+ attributes.put("zip4", "zip4");
+ attributes.put("physicalDeliveryOfficeName", "physicalDeliveryOfficeName");
+ attributes.put("bc", "bc");
+ attributes.put("friendlyCountryName", "friendlyCountryName");
+ attributes.put("bd", "bd");
+ attributes.put("bdname", "bdname");
+ attributes.put("jtname", "jtname");
+ attributes.put("mgrid", "mgrid");
+ attributes.put("a2", "a2");
+ attributes.put("compcode", "compcode");
+ attributes.put("compdesc", "compdesc");
+ attributes.put("bu", "bu");
+ attributes.put("buname", "buname");
+ attributes.put("silo", "silo");
+ attributes.put("costcenter", "costcenter");
+ attributes.put("b2", "b2");
+ attributes.put("test", "test");
+
+ Method method = ldapServiceImpl.getClass().getDeclaredMethod("processAttributes", Attributes.class);
+ method.setAccessible(true);
+
+ User user = (User)method.invoke(ldapServiceImpl, attributes);
+ Assert.assertNotNull(user);
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LocalAccessConditionTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LocalAccessConditionTest.java
new file mode 100644
index 00000000..c78e46cc
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LocalAccessConditionTest.java
@@ -0,0 +1,78 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
+import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.springframework.context.annotation.ConditionContext;
+import org.springframework.core.type.AnnotatedTypeMetadata;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ PortalApiProperties.class })
+public class LocalAccessConditionTest {
+
+ @InjectMocks
+ private LocalAccessCondition localAccessCondition;
+
+ @Test
+ public void matchesTest(){
+ ConditionContext context = Mockito.mock(ConditionContext.class);
+ AnnotatedTypeMetadata metadata = Mockito.mock(AnnotatedTypeMetadata.class);
+ boolean matches = localAccessCondition.matches(context, metadata);
+ Assert.assertTrue(matches);
+ }
+
+ @Test
+ public void matchesWithAccessTest(){
+ ConditionContext context = Mockito.mock(ConditionContext.class);
+ AnnotatedTypeMetadata metadata = Mockito.mock(AnnotatedTypeMetadata.class);
+ PowerMockito.mockStatic(PortalApiProperties.class);
+ Mockito.when(PortalApiProperties.getProperty(PortalApiConstants.ROLE_ACCESS_CENTRALIZED)).thenReturn("LOCAL");
+ boolean matches = localAccessCondition.matches(context, metadata);
+ Assert.assertTrue(matches);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LoginServiceCentralizedImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LoginServiceCentralizedImplTest.java
new file mode 100644
index 00000000..2f827bd9
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LoginServiceCentralizedImplTest.java
@@ -0,0 +1,200 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.command.LoginBean;
+import org.onap.portalsdk.core.domain.App;
+import org.onap.portalsdk.core.domain.Role;
+import org.onap.portalsdk.core.domain.RoleFunction;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.domain.UserApp;
+import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.portalsdk.core.web.support.AppUtils;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ PortalApiProperties.class, AppUtils.class, UserUtils.class, SystemProperties.class })
+public class LoginServiceCentralizedImplTest {
+
+ @InjectMocks
+ private LoginServiceCentralizedImpl loginServiceCentrImpl;
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Mock
+ private RestApiRequestBuilder restApiRequestBuilder;
+
+ @Mock
+ private UserService userService;
+
+ @Test
+ public void findUserTest() throws Exception {
+ String userId = "S1234";
+ LoginBean bean = new LoginBean();
+ bean.setUserid(userId);
+ String menuPropertiesFilename ="";
+ Map additionalParams = new HashMap();
+
+ User mockUser = new User();
+ mockUser.setOrgUserId("G1234");
+ mockUser.setLoginId(userId);
+
+ RoleFunction roleFunction = new RoleFunction();
+ roleFunction.setId(12L);
+ roleFunction.setName("Role Function");
+
+ Set roleFunctions = new TreeSet();
+ roleFunctions.add(roleFunction);
+
+ Role role = new Role();
+ role.setName("Role");
+ role.setActive(true);
+ role.setRoleFunctions(roleFunctions);
+
+ Set userApps = new TreeSet();
+ UserApp userApp = new UserApp();
+
+ App app = new App();
+ app.setId(new Long(1));
+ app.setName("Default");
+ userApp.setUserId(1L);
+ userApp.setApp(app);
+ userApp.setRole(role);
+ userApps.add(userApp);
+ mockUser.setUserApps(userApps);
+
+ mockUser.setActive(true);
+
+ Mockito.when(restApiRequestBuilder.getViaREST("/user/" + bean.getUserid(), true, bean.getUserid())).thenReturn("Dummy Response");
+ Mockito.when(userService.userMapper(Mockito.anyString())).thenReturn(mockUser);
+
+ Map<String, String> params = new HashMap<>();
+ params.put("orgUserId", mockUser.getOrgUserId());
+
+ List idList = new ArrayList();
+ idList.add(1L);
+ Mockito.when(dataAccessService.executeNamedQuery("getUserIdByorgUserId", params, null)).thenReturn(idList);
+
+ LoginBean loginBean = loginServiceCentrImpl.findUser(bean, menuPropertiesFilename, additionalParams);
+ Assert.assertEquals(loginBean.getUserid(), userId);
+ }
+
+
+ @Test
+ public void findUserWithErroMsgTest() throws Exception {
+ String userId = "S1234";
+ LoginBean bean = new LoginBean();
+ bean.setUserid(userId);
+ String menuPropertiesFilename ="";
+ Map additionalParams = new HashMap();
+
+ User mockUser = new User();
+ mockUser.setOrgUserId("G1234");
+ mockUser.setLoginId(userId);
+
+ mockUser.setActive(false);
+
+ Mockito.when(restApiRequestBuilder.getViaREST("/user/" + bean.getUserid(), true, bean.getUserid())).thenReturn("Dummy Response");
+ Mockito.when(userService.userMapper(Mockito.anyString())).thenReturn(mockUser);
+
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.isApplicationLocked()).thenReturn(true);
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.SYS_ADMIN_ROLE_ID)).thenReturn("SYSTEMS");
+
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(UserUtils.hasRole(Mockito.any(User.class), Mockito.any(String.class))).thenReturn(false);
+
+ LoginBean loginBean = loginServiceCentrImpl.findUser(bean, menuPropertiesFilename, additionalParams);
+ Assert.assertEquals(loginBean.getUserid(), userId);
+ }
+
+ @Test
+ public void findUserWihtoutUserIdTest() throws Exception {
+ LoginBean bean = new LoginBean();
+ String menuPropertiesFilename ="";
+ Map additionalParams = new HashMap();
+
+ User mockUser = new User();
+ mockUser.setOrgUserId("G1234");
+ mockUser.setLoginId("L1234");
+
+ LoginBean loginBean = loginServiceCentrImpl.findUser(bean, menuPropertiesFilename, additionalParams);
+ Assert.assertNull(loginBean.getLoginId());
+
+ }
+
+ @Test
+ public void findUserWithoutUserIdTest() throws Exception {
+ LoginBean bean = new LoginBean();
+ String menuPropertiesFilename ="";
+ Map additionalParams = new HashMap();
+ LoginBean loginBean = loginServiceCentrImpl.findUser(bean, menuPropertiesFilename, additionalParams);
+ Assert.assertNull(loginBean.getLoginId());
+ }
+
+ @Test
+ public void findUserWithoutUserIdAndPasswordTest() throws Exception {
+ LoginBean bean = new LoginBean();
+ String menuPropertiesFilename ="";
+ Map additionalParams = new HashMap();
+ LoginBean loginBean = loginServiceCentrImpl.findUser(bean, menuPropertiesFilename, additionalParams, false);
+ Assert.assertNull(loginBean.getLoginId());
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LoginServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LoginServiceImplTest.java
new file mode 100644
index 00000000..ecaec1cb
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LoginServiceImplTest.java
@@ -0,0 +1,185 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.command.LoginBean;
+import org.onap.portalsdk.core.domain.App;
+import org.onap.portalsdk.core.domain.Role;
+import org.onap.portalsdk.core.domain.RoleFunction;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.domain.UserApp;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.portalsdk.core.web.support.AppUtils;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ SystemProperties.class, AppUtils.class, UserUtils.class })
+public class LoginServiceImplTest {
+
+ @InjectMocks
+ private LoginServiceImpl loginServiceImpl;
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Test
+ public void findUserTest() throws Exception {
+ String userId = "S1234";
+ LoginBean bean = new LoginBean();
+ bean.setUserid(userId);
+ String menuPropertiesFilename = "";
+ Map additionalParams = new HashMap();
+
+ RoleFunction roleFunction = new RoleFunction();
+ roleFunction.setId(12L);
+ roleFunction.setName("Role Function");
+
+ Set roleFunctions = new TreeSet();
+ roleFunctions.add(roleFunction);
+
+ Role role = new Role();
+ role.setName("Role");
+ role.setActive(true);
+ role.setRoleFunctions(roleFunctions);
+
+ Set userApps = new TreeSet();
+ UserApp userApp = new UserApp();
+
+ App app = new App();
+ app.setId(new Long(1));
+ app.setName("Default");
+ userApp.setUserId(1L);
+ userApp.setApp(app);
+ userApp.setRole(role);
+ userApps.add(userApp);
+
+ User mockUser = new User();
+ mockUser.setOrgUserId("G1234");
+ mockUser.setLoginId(userId);
+ mockUser.setUserApps(userApps);
+ mockUser.setActive(true);
+
+ List users = new ArrayList();
+ users.add(mockUser);
+
+ Map<String, String> params = new HashMap<>();
+ params.put("org_user_id", bean.getUserid());
+
+ Mockito.when(dataAccessService.executeNamedQuery("getUserByOrgUserId", params, new HashMap()))
+ .thenReturn(users);
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_SET_NAME)).thenReturn("Menu");
+ Mockito.when(SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_SET_NAME)).thenReturn("Menu");
+
+ LoginBean returnBean = loginServiceImpl.findUser(bean, menuPropertiesFilename, additionalParams);
+ Assert.assertNotNull(returnBean.getUser());
+ }
+
+ @Test
+ public void findUserWithErrorMsgTest() throws Exception {
+ String userId = "S1234";
+ LoginBean bean = new LoginBean();
+ bean.setUserid(userId);
+ String menuPropertiesFilename = "";
+ Map additionalParams = new HashMap();
+
+ User mockUser = new User();
+ mockUser.setOrgUserId("G1234");
+ mockUser.setLoginId(userId);
+
+ List users = new ArrayList();
+ users.add(mockUser);
+
+ Map<String, String> params = new HashMap<>();
+ params.put("org_user_id", bean.getUserid());
+
+ Mockito.when(dataAccessService.executeNamedQuery("getUserByOrgUserId", params, new HashMap()))
+ .thenReturn(users);
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_SET_NAME)).thenReturn("Menu");
+ Mockito.when(SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_SET_NAME)).thenReturn("Menu");
+ Mockito.when(SystemProperties.getProperty(SystemProperties.SYS_ADMIN_ROLE_ID)).thenReturn("Role");
+
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.isApplicationLocked()).thenReturn(true);
+
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(UserUtils.hasRole(Mockito.any(User.class), Mockito.anyString())).thenReturn(false);
+
+ LoginBean returnBean = loginServiceImpl.findUser(bean, menuPropertiesFilename, additionalParams);
+ Assert.assertNull(returnBean.getUser());
+ }
+
+ @Test
+ public void findUserWithoutUseridAndPassTrueTest() throws Exception {
+ LoginBean bean = new LoginBean();
+ bean.setLoginId("L1234");
+ bean.setLoginPwd("L1234");
+ String menuPropertiesFilename = "";
+ Map additionalParams = new HashMap();
+ LoginBean returnBean = loginServiceImpl.findUser(bean, menuPropertiesFilename, additionalParams, true);
+ Assert.assertNull(returnBean.getUser());
+ }
+
+ @Test
+ public void findUserWithoutUseridAndPassFalseTest() throws Exception {
+ LoginBean bean = new LoginBean();
+ bean.setLoginId("L1234");
+ bean.setLoginPwd("L1234");
+ String menuPropertiesFilename = "";
+ Map additionalParams = new HashMap();
+ LoginBean returnBean = loginServiceImpl.findUser(bean, menuPropertiesFilename, additionalParams, false);
+ Assert.assertNull(returnBean.getUser());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/PostSearchServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/PostSearchServiceImplTest.java
new file mode 100644
index 00000000..7e42c531
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/PostSearchServiceImplTest.java
@@ -0,0 +1,188 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.command.PostSearchBean;
+import org.onap.portalsdk.core.domain.Lookup;
+import org.onap.portalsdk.core.domain.Role;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.springframework.mock.web.MockHttpServletRequest;
+
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({SystemProperties.class})
+public class PostSearchServiceImplTest {
+
+ @InjectMocks
+ private PostSearchServiceImpl postSearchServiceImpl;
+
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Test
+ public void processTest() throws Exception {
+
+ PostSearchBean postSearch = new PostSearchBean();
+
+ String select[] = {"One", "Two"};
+ String[] postOrgUserId = {"One", "Two"};
+ String firstNames[] = {"One", "Two"};
+ String[] lastNames = {"One", "Two"};
+ postSearch.setSelected(select);
+ postSearch.setPostFirstName(firstNames);
+ postSearch.setPostLastName(lastNames);
+
+ postSearch.setPostHrid(lastNames);
+ postSearch.setPostPhone(lastNames);
+ postSearch.setPostEmail(lastNames);
+ postSearch.setPostAddress1(lastNames);
+ postSearch.setPostAddress2(lastNames);
+ postSearch.setPostCity(firstNames);
+ postSearch.setPostState(lastNames);
+ postSearch.setPostZipCode(lastNames);
+ postSearch.setPostLocationClli(lastNames);
+ postSearch.setPostBusinessCountryCode(firstNames);
+ postSearch.setPostBusinessCountryName(lastNames);
+ postSearch.setPostOrgUserId(postOrgUserId);
+ postSearch.setPostDepartment(firstNames);
+ postSearch.setPostDepartmentName(firstNames);
+ postSearch.setPostBusinessUnit(firstNames);
+ postSearch.setPostBusinessUnitName(firstNames);
+ postSearch.setPostJobTitle(lastNames);
+ postSearch.setPostOrgManagerUserId(firstNames);
+ postSearch.setPostCommandChain(lastNames);
+ postSearch.setPostCompanyCode(firstNames);
+ postSearch.setPostCompany(firstNames);
+ postSearch.setPostCostCenter(firstNames);
+ postSearch.setPostSiloStatus(firstNames);
+ postSearch.setPostFinancialLocCode(firstNames);
+
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.addParameter("message_id", "5");
+
+ Lookup lookup = new Lookup();
+ lookup.setValue("Dummy Lookup");
+ List list =new ArrayList<>();
+ list.add(lookup);
+
+ Mockito.when(dataAccessService.getLookupList("fn_lu_country", "country_cd", "country","country = 'One'", null, null)).thenReturn(list);
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.POST_DEFAULT_ROLE_ID)).thenReturn("2");
+
+ Role role = new Role();
+ role.setId(2L);
+ Mockito.when(dataAccessService.getDomainObject(Role.class, Long.valueOf(SystemProperties.getProperty(SystemProperties.POST_DEFAULT_ROLE_ID)),
+ null)).thenReturn(role);
+
+ int importedUser = postSearchServiceImpl.process(request, postSearch);
+ Assert.assertEquals(2, importedUser);
+ }
+
+ @Test(expected = Exception.class)
+ public void processExceptionTest() throws Exception {
+
+ PostSearchBean postSearch = new PostSearchBean();
+
+ String select[] = {"One", "Two"};
+ String[] postOrgUserId = {"One", "Two"};
+ String firstNames[] = {"One", "Two"};
+ String[] lastNames = {"One", "Two"};
+ postSearch.setSelected(select);
+ postSearch.setPostFirstName(firstNames);
+ postSearch.setPostLastName(lastNames);
+
+ postSearch.setPostHrid(lastNames);
+ postSearch.setPostPhone(lastNames);
+ postSearch.setPostEmail(lastNames);
+ postSearch.setPostAddress1(lastNames);
+ postSearch.setPostAddress2(lastNames);
+ postSearch.setPostCity(firstNames);
+ postSearch.setPostState(lastNames);
+ postSearch.setPostZipCode(lastNames);
+ postSearch.setPostLocationClli(lastNames);
+ postSearch.setPostBusinessCountryCode(firstNames);
+ postSearch.setPostBusinessCountryName(lastNames);
+ postSearch.setPostOrgUserId(postOrgUserId);
+ postSearch.setPostDepartment(firstNames);
+ postSearch.setPostDepartmentName(firstNames);
+ postSearch.setPostBusinessUnit(firstNames);
+ postSearch.setPostBusinessUnitName(firstNames);
+ postSearch.setPostJobTitle(lastNames);
+ postSearch.setPostOrgManagerUserId(firstNames);
+ postSearch.setPostCommandChain(lastNames);
+ postSearch.setPostCompanyCode(firstNames);
+ postSearch.setPostCompany(firstNames);
+ postSearch.setPostCostCenter(firstNames);
+ postSearch.setPostSiloStatus(firstNames);
+ postSearch.setPostFinancialLocCode(firstNames);
+
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.addParameter("message_id", "5");
+
+ Lookup lookup = new Lookup();
+ lookup.setValue("Dummy Lookup");
+ List list =new ArrayList<>();
+ list.add(lookup);
+
+ Mockito.when(dataAccessService.getLookupList("fn_lu_country", "country_cd", "country","country = 'One'", null, null)).thenReturn(list);
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.POST_DEFAULT_ROLE_ID)).thenReturn("2");
+
+ Role role = new Role();
+ Mockito.when(dataAccessService.getDomainObject(Role.class, Long.valueOf(SystemProperties.getProperty(SystemProperties.POST_DEFAULT_ROLE_ID)),
+ null)).thenReturn(role);
+
+ postSearchServiceImpl.process(request, postSearch);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ProfileServiceCentralizedImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ProfileServiceCentralizedImplTest.java
new file mode 100644
index 00000000..23b3f25f
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ProfileServiceCentralizedImplTest.java
@@ -0,0 +1,89 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.Profile;
+import org.onap.portalsdk.core.domain.User;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+public class ProfileServiceCentralizedImplTest {
+
+ @InjectMocks
+ private ProfileServiceCentralizedImpl profileServiceCentrImpl ;
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Mock
+ private RestApiRequestBuilder restApiRequestBuilder;
+
+ @Test
+ public void findAllTest() throws Exception {
+ profileServiceCentrImpl.findAll();
+ }
+
+ @Test
+ public void getProfileTest() throws Exception {
+ String json = "{ \"first_name\" : \"Mercedes\", \"last_name\" : \"Name\" }";
+ Mockito.when(restApiRequestBuilder.getViaREST(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString())).thenReturn(json);
+ Profile profile = profileServiceCentrImpl.getProfile(12);
+ Assert.assertNotNull(profile);
+ }
+
+ @Test
+ public void getUserTest() throws Exception {
+ String json = "{ \"firstName\" : \"Mercedes\"}";
+ Mockito.when(restApiRequestBuilder.getViaREST(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString())).thenReturn(json);
+ User user = profileServiceCentrImpl.getUser("12");
+ Assert.assertNotNull(user);
+ }
+
+ @Test
+ public void saveUserTest() {
+ User user = new User();
+ profileServiceCentrImpl.saveUser(user);
+ Assert.assertTrue(true);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ProfileServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ProfileServiceImplTest.java
new file mode 100644
index 00000000..fae7b75b
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ProfileServiceImplTest.java
@@ -0,0 +1,99 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.dao.ProfileDao;
+import org.onap.portalsdk.core.domain.Profile;
+import org.onap.portalsdk.core.domain.User;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+public class ProfileServiceImplTest {
+
+ @InjectMocks
+ private ProfileServiceImpl profileServiceImpl;
+
+ @Mock
+ private ProfileDao profileDao;
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Test
+ public void findAllTest(){
+ profileServiceImpl.findAll();
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getUserTest(){
+ String userId = "123";
+ User user = new User();
+ user.setOrgUserId(userId);
+
+ Mockito.when(dataAccessService.getDomainObject(User.class, Long.parseLong(userId), null)).thenReturn(user);
+
+ User returnuser = profileServiceImpl.getUser(userId);
+ Assert.assertEquals(userId, returnuser.getOrgUserId());
+ }
+
+ @Test
+ public void saveUserTest() {
+ String userId = "123";
+ User user = new User();
+ user.setOrgUserId(userId);
+ profileServiceImpl.saveUser(user);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getProfileTest() {
+ Profile profile = new Profile();
+ Long id = 12L;
+ profile.setId(id);
+ Mockito.when(profileDao.getProfile(12)).thenReturn(profile);
+ Profile value = profileServiceImpl.getProfile(12);
+ Assert.assertEquals(id, value.getId());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RestApiRequestBuilderTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RestApiRequestBuilderTest.java
new file mode 100644
index 00000000..21a0e797
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RestApiRequestBuilderTest.java
@@ -0,0 +1,292 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import java.io.IOException;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.App;
+import org.onap.portalsdk.core.onboarding.rest.RestWebServiceClient;
+import org.onap.portalsdk.core.onboarding.util.CipherUtil;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ SystemProperties.class, CipherUtil.class, RestWebServiceClient.class })
+public class RestApiRequestBuilderTest {
+
+ @InjectMocks
+ private RestApiRequestBuilder restApiRequestBuilder;
+
+ @Mock
+ private AppService appService;
+
+ @Test
+ public void getViaRESTTest() throws Exception {
+ String restEndPoint = "";
+ boolean isBasicAuth = false;
+ String userId = "123";
+
+ App app = new App();
+ app.setName("Test");
+ app.setUsername("TestUser");
+ app.setAppPassword("Password");
+
+ String status = "SUCCESS";
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(app.getAppPassword());
+ PowerMockito.mockStatic(CipherUtil.class);
+ Mockito.when(CipherUtil.decryptPKC(app.getAppPassword(),
+ SystemProperties.getProperty(SystemProperties.Decryption_Key))).thenReturn(app.getAppPassword());
+
+ PowerMockito.mockStatic(RestWebServiceClient.class);
+
+ RestWebServiceClient client = Mockito.mock(RestWebServiceClient.class);
+
+ Mockito.when(RestWebServiceClient.getInstance()).thenReturn(client);
+
+ Mockito.when(client.getPortalContent(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
+ Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyBoolean()))
+ .thenReturn(status);
+
+ Mockito.when(appService.getDefaultApp()).thenReturn(app);
+
+ String response = restApiRequestBuilder.getViaREST(restEndPoint, isBasicAuth, userId);
+ Assert.assertEquals(status, response);
+ }
+
+ @Test(expected=IOException.class)
+ public void getViaRESTTExceptionest() throws Exception {
+ String restEndPoint = "";
+ boolean isBasicAuth = false;
+ String userId = "123";
+
+ App app = new App();
+ app.setName("Test");
+ app.setUsername("TestUser");
+ app.setAppPassword("Password");
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(app.getAppPassword());
+ Mockito.when(appService.getDefaultApp()).thenReturn(app);
+
+ restApiRequestBuilder.getViaREST(restEndPoint, isBasicAuth, userId);
+ }
+
+ @Test
+ public void getViaRESTWithoutAppTest() throws Exception {
+
+ String restEndPoint = "";
+ boolean isBasicAuth = false;
+ String userId = "123";
+
+ String status = "FAILURE";
+
+ PowerMockito.mockStatic(RestWebServiceClient.class);
+ RestWebServiceClient client = Mockito.mock(RestWebServiceClient.class);
+ Mockito.when(RestWebServiceClient.getInstance()).thenReturn(client);
+
+ Mockito.when(client.getPortalContent(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
+ Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyBoolean()))
+ .thenReturn(status);
+
+ Mockito.when(appService.getDefaultApp()).thenReturn(null);
+
+ String response = restApiRequestBuilder.getViaREST(restEndPoint, isBasicAuth, userId);
+ Assert.assertEquals(status, response);
+
+ }
+
+ @Test
+ public void postViaRESTTest() throws Exception {
+ String restEndPoint ="";
+ boolean isBasicAuth = false;
+ String content = "Data";
+ String userId = "123";
+
+ App app = new App();
+ app.setName("Test");
+ app.setUsername("TestUser");
+ app.setAppPassword("Password");
+
+ String status = "SUCCESS";
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(app.getAppPassword());
+ PowerMockito.mockStatic(CipherUtil.class);
+ Mockito.when(CipherUtil.decryptPKC(app.getAppPassword(),
+ SystemProperties.getProperty(SystemProperties.Decryption_Key))).thenReturn(app.getAppPassword());
+
+ PowerMockito.mockStatic(RestWebServiceClient.class);
+ RestWebServiceClient client = Mockito.mock(RestWebServiceClient.class);
+ Mockito.when(RestWebServiceClient.getInstance()).thenReturn(client);
+ Mockito.when(client.postPortalContent(Mockito.anyString(),Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
+ Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),Mockito.anyString(), Mockito.anyBoolean()))
+ .thenReturn(status);
+
+ Mockito.when(appService.getDefaultApp()).thenReturn(app);
+
+ restApiRequestBuilder.postViaREST(restEndPoint, isBasicAuth,content, userId);
+
+ Assert.assertTrue(true);
+ }
+
+ @Test(expected = IOException.class)
+ public void postViaRESTExceptionTest() throws Exception {
+ String restEndPoint ="";
+ boolean isBasicAuth = false;
+ String content = "Data";
+ String userId = "123";
+
+ App app = new App();
+ app.setName("Test");
+ app.setUsername("TestUser");
+ app.setAppPassword("Password");
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(app.getAppPassword());
+ Mockito.when(appService.getDefaultApp()).thenReturn(app);
+
+ restApiRequestBuilder.postViaREST(restEndPoint, isBasicAuth,content, userId);
+
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void postViaRESTWithoutAppTest() throws Exception {
+ String restEndPoint ="";
+ boolean isBasicAuth = false;
+ String content = "Data";
+ String userId = "123";
+ Mockito.when(appService.getDefaultApp()).thenReturn(null);
+
+ PowerMockito.mockStatic(RestWebServiceClient.class);
+ RestWebServiceClient client = Mockito.mock(RestWebServiceClient.class);
+ Mockito.when(RestWebServiceClient.getInstance()).thenReturn(client);
+ Mockito.when(client.postPortalContent(Mockito.anyString(),Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
+ Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),Mockito.anyString(), Mockito.anyBoolean()))
+ .thenReturn("SUCCESS");
+
+ restApiRequestBuilder.postViaREST(restEndPoint, isBasicAuth,content, userId);
+
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteViaRestTest() throws Exception {
+ String restEndPoint ="";
+ boolean isBasicAuth = false;
+ String content = "Data";
+ String userId = "123";
+
+ App app = new App();
+ app.setName("Test");
+ app.setUsername("TestUser");
+ app.setAppPassword("Password");
+
+ String status = "SUCCESS";
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(app.getAppPassword());
+ PowerMockito.mockStatic(CipherUtil.class);
+ Mockito.when(CipherUtil.decryptPKC(app.getAppPassword(),
+ SystemProperties.getProperty(SystemProperties.Decryption_Key))).thenReturn(app.getAppPassword());
+
+ PowerMockito.mockStatic(RestWebServiceClient.class);
+ RestWebServiceClient client = Mockito.mock(RestWebServiceClient.class);
+ Mockito.when(RestWebServiceClient.getInstance()).thenReturn(client);
+ Mockito.when(client.postPortalContent(Mockito.anyString(),Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
+ Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),Mockito.anyString(), Mockito.anyBoolean()))
+ .thenReturn(status);
+
+ Mockito.when(appService.getDefaultApp()).thenReturn(app);
+
+ restApiRequestBuilder.deleteViaRest(restEndPoint, isBasicAuth,content, userId);
+
+ Assert.assertTrue(true);
+ }
+
+ @Test(expected = IOException.class)
+ public void deleteViaRestExceptionTest() throws Exception {
+ String restEndPoint ="";
+ boolean isBasicAuth = false;
+ String content = "Data";
+ String userId = "123";
+
+ App app = new App();
+ app.setName("Test");
+ app.setUsername("TestUser");
+ app.setAppPassword("Password");
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(app.getAppPassword());
+ Mockito.when(appService.getDefaultApp()).thenReturn(app);
+
+ restApiRequestBuilder.deleteViaRest(restEndPoint, isBasicAuth,content, userId);
+
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteViaRestWithoutAppTest() throws Exception {
+ String restEndPoint ="";
+ boolean isBasicAuth = false;
+ String content = "Data";
+ String userId = "123";
+ Mockito.when(appService.getDefaultApp()).thenReturn(null);
+
+ PowerMockito.mockStatic(RestWebServiceClient.class);
+ RestWebServiceClient client = Mockito.mock(RestWebServiceClient.class);
+ Mockito.when(RestWebServiceClient.getInstance()).thenReturn(client);
+ Mockito.when(client.postPortalContent(Mockito.anyString(),Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
+ Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),Mockito.anyString(), Mockito.anyBoolean()))
+ .thenReturn("SUCCESS");
+
+ restApiRequestBuilder.deleteViaRest(restEndPoint, isBasicAuth,content, userId);
+
+ Assert.assertTrue(true);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccessTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccessTest.java
new file mode 100644
index 00000000..0b61af8d
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccessTest.java
@@ -0,0 +1,165 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.Role;
+import org.onap.portalsdk.core.domain.RoleFunction;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+public class RoleServiceCentralizedAccessTest {
+
+ @InjectMocks
+ private RoleServiceCentralizedAccess roleServiceCntrlAccess;
+
+ @Mock
+ private RestApiRequestBuilder restApiRequestBuilder;
+
+ @Test
+ public void getRoleFunctionsTest() throws Exception {
+ String loginId ="1234";
+ String response ="[ { \"code\" : \"abc\", \"name\" : \"xyz\" }, { \"code\" : \"pqr\", \"name\" : \"str\" } ]";
+ Mockito.when(restApiRequestBuilder.getViaREST("/functions", true, loginId)).thenReturn(response);
+ List<RoleFunction> roleFunctions = roleServiceCntrlAccess.getRoleFunctions(loginId);
+ Assert.assertTrue(roleFunctions.size() > 0);
+ }
+
+ @Test
+ public void getAvailableChildRolesWithEmptyRoleIdTest() throws Exception {
+ String loginId = "123";
+ Long roleId = null;
+ String response ="[ { \"active\" : true, \"name\" : \"xyz\" } ]";
+ Mockito.when(restApiRequestBuilder.getViaREST("/roles", true, loginId)).thenReturn(response);
+ List<Role> roles = roleServiceCntrlAccess.getAvailableChildRoles(loginId, roleId);
+ Assert.assertNotNull(roles);
+ }
+
+ @Test
+ public void getAvailableChildRolesWithZeroRoleIdTest() throws Exception {
+ String loginId = "123";
+ Long roleId = 0L;
+ String response ="[ { \"active\" : true, \"name\" : \"xyz\" } ]";
+ Mockito.when(restApiRequestBuilder.getViaREST("/roles", true, loginId)).thenReturn(response);
+ List<Role> roles = roleServiceCntrlAccess.getAvailableChildRoles(loginId, roleId);
+ Assert.assertNotNull(roles);
+ }
+
+ @Test
+ public void getAvailableChildRolesTest() throws Exception {
+ String loginId = "123";
+ Long roleId = 123L;
+ String response ="[ { \"active\" : false, \"name\" : \"xyz\" } ]";
+ Mockito.when(restApiRequestBuilder.getViaREST("/roles", true, loginId)).thenReturn(response);
+ String roleResponse =" { \"active\" : true, \"name\" : \"xyz\", \"roleFunctions\" : [ { \"code\" : \"abc\", \"name\" : \"RF1\" }, { \"code\" : \"pqr\", \"name\" : \"RF2\" } ] , \"parentRoles\": [ {\"active\" : false, \"name\" : \"XYZ-ABC\"}, {\"active\" : true, \"name\" : \"ABC\"} ] } ";
+ Mockito.when(restApiRequestBuilder.getViaREST("/role/" + roleId, true, loginId)).thenReturn(roleResponse);
+ roleServiceCntrlAccess.getAvailableChildRoles(loginId, roleId);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void saveRoleTest() throws Exception {
+ Role role = new Role();
+ role.setName("Role");
+ roleServiceCntrlAccess.saveRole("123", role);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteRoleTest() throws Exception {
+ Role role = new Role();
+ role.setName("Role");
+ role.setId(123l);
+ roleServiceCntrlAccess.deleteRole("123", role);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getActiveRolesTest() throws Exception {
+ String requestedLoginId ="1234";
+ String response ="[ { \"active\" : true, \"name\" : \"role1\" }, { \"active\" : false, \"name\" : \"role2\" } ]";
+ Mockito.when(restApiRequestBuilder.getViaREST("/activeRoles", true, requestedLoginId)).thenReturn(response);
+ List<Role> roles = roleServiceCntrlAccess.getActiveRoles(requestedLoginId);
+ Assert.assertNotNull(roles);
+ }
+
+ @Test
+ public void getRoleFunctionTest() throws IOException {
+ String requestedLoginId = "xyz";
+ String code ="abc";
+
+ String responseString = " { \"code\" : \"abc\", \"name\" : \"xyz\" }";
+ Mockito.when(restApiRequestBuilder.getViaREST("/function/" + code, true, requestedLoginId)).thenReturn(responseString);
+ RoleFunction roleFunction = roleServiceCntrlAccess.getRoleFunction(requestedLoginId, code);
+ Assert.assertNotNull(roleFunction);
+ }
+
+ @Test
+ public void saveRoleFunctionTest() throws IOException {
+ String requestedLoginId ="123";
+ RoleFunction domainRoleFunction = new RoleFunction();
+ domainRoleFunction.setId(1234L);
+ roleServiceCntrlAccess.saveRoleFunction(requestedLoginId, domainRoleFunction);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteRoleFunctionTest() throws IOException {
+ String requestedLoginId ="123";
+ RoleFunction domainRoleFunction = new RoleFunction();
+ domainRoleFunction.setId(1234L);
+ roleServiceCntrlAccess.deleteRoleFunction(requestedLoginId, domainRoleFunction);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteDependcyRoleRecord() throws IOException {
+ String requestedLoginId = "123";
+ Long id = 123L;
+ roleServiceCntrlAccess.deleteDependcyRoleRecord(requestedLoginId, id);
+ Assert.assertTrue(true);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceImplTest.java
new file mode 100644
index 00000000..3186b464
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceImplTest.java
@@ -0,0 +1,256 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import java.sql.Connection;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+import javax.sql.DataSource;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.Role;
+import org.onap.portalsdk.core.domain.RoleFunction;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+public class RoleServiceImplTest {
+
+ @InjectMocks
+ private RoleServiceImpl roleServiceImpl;
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Mock
+ private DataSource dataSource;
+
+ @Test
+ public void getRoleFunctions() throws Exception {
+ String loginId = "123";
+ roleServiceImpl.getRoleFunctions(loginId);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getAvailableChildRolesWithEmptyIdTest() throws Exception {
+ String loginId = "123";
+ Long roleId = null;
+ Role child1 = new Role();
+ child1.setName("Child1");
+
+ Role child2 = new Role();
+ child1.setName("Child2");
+ List<Role> childRoles = new ArrayList<>();
+ childRoles.add(child1);
+ childRoles.add(child2);
+ Mockito.when(dataAccessService.getList(Role.class, null)).thenReturn(childRoles);
+ List<Role> list = roleServiceImpl.getAvailableChildRoles(loginId, roleId);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void getAvailableChildRolesWithZeroIdTest() throws Exception {
+ String loginId = "123";
+ Long roleId = 0L;
+ Role child1 = new Role();
+ child1.setName("Child1");
+
+ Role child2 = new Role();
+ child1.setName("Child2");
+ List<Role> childRoles = new ArrayList<>();
+ childRoles.add(child1);
+ childRoles.add(child2);
+ Mockito.when(dataAccessService.getList(Role.class, null)).thenReturn(childRoles);
+ List<Role> list = roleServiceImpl.getAvailableChildRoles(loginId, roleId);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void getAvailableChildRolesTest() throws Exception {
+ String loginId = "123";
+ Long roleId = 123L;
+ Role child1 = new Role();
+ child1.setName("Child1");
+
+ Role child2 = new Role();
+ child2.setName("Child2");
+
+ List<Role> childRoles = new ArrayList<>();
+ childRoles.add(child1);
+ childRoles.add(child2);
+ Mockito.when(dataAccessService.getList(Role.class, null)).thenReturn(childRoles);
+
+ Role parentRole = new Role();
+ parentRole.setName("Parent");
+ Set parentRoles = new TreeSet();
+ parentRoles.add(parentRole);
+
+ Role currentRole = new Role();
+ currentRole.setName("Present Role");
+ currentRole.setParentRoles(parentRoles);
+ Mockito.when(dataAccessService.getDomainObject(Role.class, roleId, null)).thenReturn(currentRole);
+ roleServiceImpl.getAvailableChildRoles(loginId, roleId);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getRoleFunctionTest() {
+ String code = "abc";
+ String loginId ="123";
+ Mockito.when(dataAccessService.getDomainObject(RoleFunction.class, code, null)).thenReturn(new RoleFunction());
+ RoleFunction roleFunction = roleServiceImpl.getRoleFunction(loginId, code);
+ Assert.assertNotNull(roleFunction);
+ }
+
+ @Test
+ public void saveRoleFunctionTest() {
+ String loginId = "123";
+ RoleFunction domainRoleFunction = new RoleFunction();
+ roleServiceImpl.saveRoleFunction(loginId, domainRoleFunction);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteRoleFunctionTest() {
+ String loginId = "123";
+ RoleFunction domainRoleFunction = new RoleFunction();
+ roleServiceImpl.deleteRoleFunction(loginId, domainRoleFunction);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getRoleTest() {
+ String loginId = "123";
+ Long id = 123L;
+ Mockito.when(dataAccessService.getDomainObject(Role.class, id, null)).thenReturn(new Role());
+ Role role = roleServiceImpl.getRole(loginId, id);
+ Assert.assertNotNull(role);
+ }
+
+ @Test
+ public void saveRoleTest() {
+ String loginId = "123";
+ Role domainRole = new Role();
+ domainRole.setName("Test Role");
+ roleServiceImpl.saveRole(loginId, domainRole);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteRoleTest() {
+ String loginId = "123";
+ Role domainRole = new Role();
+ domainRole.setName("Test Role");
+ roleServiceImpl.deleteRole(loginId, domainRole);
+ Assert.assertTrue(true);
+ }
+
+
+ @Test
+ public void getAvailableRolesTest() {
+
+ String loginId = "123";
+ Role child1 = new Role();
+ child1.setName("Child1");
+
+ Role child2 = new Role();
+ child2.setName("Child2");
+
+ List<Role> childRoles = new ArrayList<>();
+ childRoles.add(child1);
+ childRoles.add(child2);
+ Mockito.when(dataAccessService.getList(Role.class, null)).thenReturn(childRoles);
+ List<Role> list = roleServiceImpl.getAvailableRoles(loginId);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void getActiveRolesTest() {
+
+ String loginId = "123";
+ Long roleId = 123L;
+ Role child1 = new Role();
+ child1.setName("Child1");
+
+ Role child2 = new Role();
+ child2.setName("Child2");
+
+ List<Role> childRoles = new ArrayList<>();
+ childRoles.add(child1);
+ childRoles.add(child2);
+
+ String filter = " where active_yn = 'Y' ";
+ Mockito.when(dataAccessService.getList(Role.class, filter, null, null)).thenReturn(childRoles);
+ List<Role> list = roleServiceImpl.getActiveRoles(loginId);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void deleteDependcyRoleRecordTest() throws Exception {
+ Connection conn = Mockito.mock(Connection.class);
+ Statement stmt = Mockito.mock(Statement.class);
+ String loginId= "123";
+ Long id = 123L;
+
+ Mockito.when(dataSource.getConnection()).thenReturn(conn);
+ Mockito.when(conn.createStatement()).thenReturn(stmt);
+ roleServiceImpl.deleteDependcyRoleRecord(loginId, id);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteDependcyRoleRecordExcepTest() throws Exception {
+ Connection conn = Mockito.mock(Connection.class);
+ String loginId= "123";
+ Long id = 123L;
+
+ Mockito.when(dataSource.getConnection()).thenReturn(conn);
+ roleServiceImpl.deleteDependcyRoleRecord(loginId, id);
+ Assert.assertTrue(true);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UrlAccessImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UrlAccessImplTest.java
new file mode 100644
index 00000000..f3cd7bbe
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UrlAccessImplTest.java
@@ -0,0 +1,97 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Restrictions;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.UrlsAccessible;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.springframework.mock.web.MockHttpServletRequest;
+
+@RunWith(PowerMockRunner.class)
+public class UrlAccessImplTest {
+
+ @InjectMocks
+ private UrlAccessImpl urlAccessImpl;
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Test
+ public void isUrlAccessibleWithF1eTest() {
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ String currentUrl ="TestURL/content";
+ boolean isAccessible = urlAccessImpl.isUrlAccessible(request, currentUrl);
+ Assert.assertTrue(isAccessible);
+ }
+
+ @Test
+ public void isUrlAccessibleWithF2Test() {
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.addParameter("message_id", "5");
+ request.addParameter("message_location_id", "123");
+ String currentUrl ="TestURL*/content*";
+
+ UrlsAccessible url1= new UrlsAccessible();
+ url1.setFunctionCd("F1");
+ url1.setUrl("*/contentData");
+
+ UrlsAccessible url2= new UrlsAccessible();
+ url2.setFunctionCd("F2");
+ url2.setUrl("*/contentValue");
+
+ List list = new ArrayList<>();
+ list.add(url1);
+ list.add(url2);
+
+ Mockito.when(dataAccessService.getList(Mockito.any(), Mockito.any(), Mockito.anyList(), Mockito.any())).thenReturn(list);
+
+ boolean isAccessible = urlAccessImpl.isUrlAccessible(request, currentUrl);
+ Assert.assertFalse(isAccessible);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UserProfileServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UserProfileServiceImplTest.java
new file mode 100644
index 00000000..f7bb3108
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UserProfileServiceImplTest.java
@@ -0,0 +1,91 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.core.service;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.domain.support.CollaborateList;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+
+@RunWith(PowerMockRunner.class)
+public class UserProfileServiceImplTest {
+
+ @InjectMocks
+ private UserProfileServiceImpl userProfileServiceImpl;
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Test
+ public void findAllTest() {
+ userProfileServiceImpl.findAll();
+ Assert.assertTrue(true);
+ }
+
+
+
+ @Test
+ public void saveUserTest(){
+ userProfileServiceImpl.saveUser(new User());
+ Assert.assertTrue(true);
+ }
+
+ /*@Test
+ public void findAllUserWithOnOfflineTest() throws Exception {
+ String originOrgUserId = "123";
+
+ Set<String> onlineUsers = new HashSet<>();
+ onlineUsers.add("123");
+
+ CollaborateList mockClass = Mockito.mock(CollaborateList.class);
+ Mockito.when(CollaborateList.getInstance()).thenReturn(mockClass);
+ Mockito.when(mockClass.getAllUserName()).thenReturn(onlineUsers);
+ userProfileServiceImpl.findAllUserWithOnOffline(originOrgUserId);
+ }*/
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/AttributeTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/AttributeTest.java
new file mode 100644
index 00000000..16a8a597
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/AttributeTest.java
@@ -0,0 +1,79 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.Attribute;
+
+public class AttributeTest {
+
+ private static final double DELTA = 1e-15;
+
+ public Attribute mockAttribute(){
+ Attribute attribute = new Attribute();
+
+ attribute.setName("test");
+ attribute.setHeight(10);
+ attribute.setLeft(10);
+ attribute.setTop(10);
+ attribute.setWidth(10);
+
+ return attribute;
+ }
+
+ @Test
+ public void attributeTest(){
+ Attribute attribute = mockAttribute();
+
+ Attribute attribute1 = new Attribute();
+ attribute1.setName("test");
+ attribute1.setHeight(10);
+ attribute1.setLeft(10);
+ attribute1.setTop(10);
+ attribute1.setWidth(10);
+
+ assertEquals(attribute.getHeight(), attribute1.getHeight(), DELTA);
+ assertEquals(attribute.getName(), attribute1.getName());
+ assertEquals(attribute.getLeft(), attribute1.getLeft(), DELTA);
+ assertEquals(attribute.getTop(), attribute1.getTop(), DELTA);
+ assertEquals(attribute.getWidth(), attribute1.getWidth(), DELTA);
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/CollaborateListTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/CollaborateListTest.java
new file mode 100644
index 00000000..4bc9f3b6
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/CollaborateListTest.java
@@ -0,0 +1,60 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.CollaborateList;
+
+public class CollaborateListTest {
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void addAndRemoveUserListTest(){
+ String user1 = "Test User1";
+ String user2 = "Test User2";
+ CollaborateList collaborateList = CollaborateList.getInstance();
+ collaborateList.addUserName(user1);
+ collaborateList.addUserName(user2);
+ collaborateList.delUserName(user2);
+
+ assertEquals(true, collaborateList.getAllUserName().contains(user1));
+ assertEquals(false, collaborateList.getAllUserName().contains(user2));
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ContainerTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ContainerTest.java
new file mode 100644
index 00000000..145ee58f
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ContainerTest.java
@@ -0,0 +1,193 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.domain.support.Container;
+import org.onap.portalsdk.core.domain.support.Element;
+import org.onap.portalsdk.core.domain.support.Position;
+import org.onap.portalsdk.core.domain.support.Size;
+import org.onap.portalsdk.core.restful.client.SharedContextRestClient;
+import org.onap.portalsdk.core.web.support.UserUtils;
+
+public class ContainerTest {
+
+ @InjectMocks
+ Container container = new Container();
+
+ @Mock
+ private SharedContextRestClient sharedContextRestClient;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ //MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+ NullPointerException nullPointerException = new NullPointerException();
+
+ User user = new User();
+
+ @Mock
+ UserUtils userUtils = new UserUtils();
+
+ private static final double DELTA = 1e-15;
+
+ public Container mockContainer(){
+ Container container = new Container("test","test",1,1,10,10,10,10,10,10);
+
+ Size size = new Size();
+ size.setHeight(10);
+ size.setWidth(10);
+
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+
+ Map<String, Container> containerRowCol = new HashMap<String, Container>();
+ Map<String, Element> elementRowCol = new HashMap<String, Element>();
+
+ List<Container> innerCList = new ArrayList<Container>();
+ List<Element> elementList = new ArrayList<Element>();
+
+ container.setName("test");
+ container.setVisibilityType("test");
+ container.setHeight(10);
+ container.setLeft(10);
+ container.setWidth(10);
+ container.setInnerContainer(null);
+ container.setElements(null);
+ container.setInnerCList(null);
+ container.setElementList(null);
+ container.setP(null);
+ return container;
+ }
+
+ @Test
+ public void containerTest(){
+ Container container = mockContainer();
+
+ Container container1 = new Container("test","test",1,1,10,10,10,10,10,10);
+
+ Size size1 = new Size();
+ size1.setHeight(10);
+ size1.setWidth(10);
+
+ Position position1 = new Position();
+ position1.setX(10);
+ position1.setY(10);
+ container1.setP(null);
+
+
+ container1.setName("test");
+ container.setVisibilityType("test");
+ container.setHeight(10);
+ container.setLeft(10);
+ container.setWidth(10);
+ container.setInnerContainer(null);
+ container.setElements(null);
+ container.setInnerCList(null);
+ container.setElementList(null);
+
+ assertEquals(container.getContainerRowCol(), container1.getContainerRowCol());
+ assertEquals(container.getElementRowCol(), container1.getElementRowCol());
+ assertEquals(container.getName(), container1.getName());
+ assertEquals(container.getP(), container1.getP());
+ }
+
+ @Test
+ public void computeSizeTest(){
+
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container = new Container("test","test",1,1,10,10,10,10,10,10);
+ containerRowCol.put("00", container);
+
+ Map<String, Element> elementRowCol = new HashMap<>();
+ Element element = new Element("1", "test");
+ elementRowCol.put("00", element);
+
+ Container containerTest = new Container("test","Broadworks complex",1,1,10,10,10,10,10,10);
+ containerTest.setElements(elementRowCol);
+ containerTest.setInnerContainer(containerRowCol);
+ Size size = containerTest.computeSize();
+ assertEquals(40.0,size.getWidth(), DELTA);
+ assertEquals(40.1, size.getHeight(), DELTA);
+ }
+
+ @Test
+ public void computeElementPositionsTest(){
+
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ Container container01 = new Container("test","test",1,1,10,10,10,10,10,10);
+ containerRowCol.put("00", container00);
+ containerRowCol.put("10", container01);
+ containerRowCol.put("11", container01);
+
+ Map<String, Element> elementRowCol = new HashMap<>();
+ Element element = new Element("1", "test");
+ elementRowCol.put("01", element);
+ elementRowCol.put("02", element);
+
+ Container containerTest = new Container("test","Broadworks complex",2,3,10,10,10,10,10,10);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ containerTest.setP(position);
+ containerTest.setElements(elementRowCol);
+ containerTest.setInnerContainer(containerRowCol);
+ containerTest.computeElementPositions();
+ assertEquals(20.0,containerTest.getContainerRowCol().get("00").getP().getX(), DELTA);
+ assertEquals(20.0,containerTest.getContainerRowCol().get("00").getP().getY(), DELTA);
+ assertEquals(50.0,containerTest.getContainerRowCol().get("11").getP().getX(), DELTA);
+ assertEquals(31.5,containerTest.getContainerRowCol().get("11").getP().getY(), DELTA);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainTest.java
new file mode 100644
index 00000000..ff9522df
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainTest.java
@@ -0,0 +1,143 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.Container;
+import org.onap.portalsdk.core.domain.support.Domain;
+import org.onap.portalsdk.core.domain.support.Size;
+
+public class DomainTest {
+
+ private static final double DELTA = 1e-15;
+
+ public Domain mockDomain(){
+
+ Domain domain = new Domain(null, null, 0, 0, 0, 0, 0, 0, 0);
+
+ domain.setP(null);
+ domain.setNewXafterColl(0);
+ domain.setYafterColl(0);
+ domain.setDomainToLayoutWd(0);
+ domain.setTop(0);
+ domain.setLeft(0);
+ domain.setHeight(0);
+ domain.setWidth(0);
+ domain.setName("test");
+ domain.setIndexChanged(false);
+ domain.setContainers(null);
+
+ return domain;
+ }
+
+ @Test
+ public void domainTest(){
+ Domain domain = mockDomain();
+
+ Domain domain1 = new Domain(null, null, 0, 0, 0, 0, 0, 0, 0);
+
+ domain1.setP(null);
+ domain1.setNewXafterColl(0);
+ domain1.setYafterColl(0);
+ domain1.setDomainToLayoutWd(0);
+ domain1.setTop(0);
+ domain1.setLeft(0);
+ domain1.setHeight(0);
+ domain1.setWidth(0);
+ domain1.setName("test");
+ domain1.setIndexChanged(false);
+ domain1.setContainers(null);
+
+ assertEquals(domain.getP(), domain1.getP());
+ assertEquals(domain.getNewXafterColl(), domain1.getNewXafterColl(), DELTA);
+ assertEquals(domain.getYafterColl(), domain1.getYafterColl(), DELTA);
+ assertEquals(domain.getDomainToLayoutWd(), domain1.getDomainToLayoutWd(), DELTA);
+ assertEquals(domain.getTop(), domain1.getTop(), DELTA);
+ assertEquals(domain.getLeft(), domain1.getLeft(), DELTA);
+ assertEquals(domain.getHeight(), domain1.getHeight(), DELTA);
+ assertEquals(domain.getWidth(), domain1.getWidth(), DELTA);
+ assertEquals(domain.getName(), domain1.getName());
+ assertEquals(domain.isIndexChanged(), domain1.isIndexChanged());
+ assertEquals(domain.getContainerRowCol(), domain1.getContainerRowCol());
+ }
+
+ @Test
+ public void computeSizeTest(){
+ Domain domain = new Domain("test", "VNI", 0, 0, 0, 0, 0, 2, 2);
+ Container container = new Container("test","test",1,1,10,10,10,10,10,10);
+ Map<String, Container> containerRowCol = new HashMap<>();
+ containerRowCol.put("00", container);
+ containerRowCol.put("10", container);
+ containerRowCol.put("11", container);
+ domain.setContainers(containerRowCol);
+ Size size = domain.computeSize();
+ assertEquals(5.0, size.getHeight(), DELTA);
+ }
+ @Test
+ public void computeSizeWithoutNameTest(){
+ Domain domain = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Container container = new Container("test","test",1,1,10,10,10,10,10,10);
+ Map<String, Container> containerRowCol = new HashMap<>();
+ containerRowCol.put("00", container);
+ containerRowCol.put("10", container);
+ containerRowCol.put("11", container);
+ domain.setContainers(containerRowCol);
+ Size size = domain.computeSize();
+ assertEquals(5.0, size.getHeight(), DELTA);
+ }
+
+ @Test
+ public void computeConatinerPositionsTest(){
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ Container container01 = new Container("test","test",1,1,10,10,10,10,10,10);
+ containerRowCol.put("00", container00);
+ containerRowCol.put("10", container01);
+ containerRowCol.put("11", container01);
+
+ Domain domain = new Domain("test", "XYZ", 0, 1, 1, 4, 4, 2, 2);
+ domain.setContainers(containerRowCol);
+ domain.computeConatinerPositions();
+ assertEquals(21.0, domain.getContainerRowCol().get("10").getP().getX(), DELTA);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainVOTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainVOTest.java
new file mode 100644
index 00000000..d000803e
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainVOTest.java
@@ -0,0 +1,107 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Date;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.DomainVo;
+
+public class DomainVOTest {
+
+ public DomainVo mockDomainVO(){
+ DomainVo domainVo = new DomainVo();
+
+ domainVo.setId((long) 1);
+ domainVo.setCreated(new Date());
+ domainVo.setModified(new Date());
+ domainVo.setCreatedId((long) 1);
+ domainVo.setModifiedId((long) 1);
+ domainVo.setRowNum((long) 1);
+ domainVo.setAuditUserId(null);
+ domainVo.setAuditTrail(null);
+
+ return domainVo;
+ }
+
+ @Test
+ public void domainVoTest(){
+ DomainVo domainVo = mockDomainVO();
+
+ DomainVo domainVo1 = new DomainVo();
+ domainVo1.setId((long) 1);
+ domainVo1.setCreated(new Date());
+ domainVo1.setModified(new Date());
+ domainVo1.setCreatedId((long) 1);
+ domainVo1.setModifiedId((long) 1);
+ domainVo1.setRowNum((long) 1);
+ domainVo1.setAuditUserId(null);
+ domainVo1.setAuditTrail(null);
+
+ assertEquals(domainVo.getId(), domainVo1.getId());
+ assertEquals(domainVo.getCreated(), domainVo1.getCreated());
+ assertEquals(domainVo.getModified(), domainVo1.getModified());
+ assertEquals(domainVo.getCreatedId(), domainVo1.getCreatedId());
+ assertEquals(domainVo.getModifiedId(), domainVo1.getModifiedId());
+ assertEquals(domainVo.getRowNum(), domainVo1.getRowNum());
+ assertEquals(domainVo.getAuditUserId(), domainVo1.getAuditUserId());
+ assertEquals(domainVo.getAuditTrail(), domainVo1.getAuditTrail());
+ }
+
+ @Test
+ public void copyTest(){
+ DomainVo domainVo = mockDomainVO();
+ domainVo.copy(true);
+ }
+
+ @Test
+ public void equalTest(){
+ DomainVo domainVo1 = mockDomainVO();
+ DomainVo domainVo2 = mockDomainVO();
+ assertEquals(true, domainVo1.equals(domainVo2));
+ }
+
+ @Test
+ public void compareTest(){
+ DomainVo domainVo1 = mockDomainVO();
+ DomainVo domainVo2 = mockDomainVO();
+ assertEquals(0, domainVo1.compareTo(domainVo2));
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementDetailsTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementDetailsTest.java
new file mode 100644
index 00000000..1f657e8d
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementDetailsTest.java
@@ -0,0 +1,64 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.ElementDetails;
+
+public class ElementDetailsTest {
+
+ public ElementDetails mockElementDetails(){
+ ElementDetails elementDetails = new ElementDetails("test","test","test","test","test","test","test","test","test","test");
+
+ elementDetails.setLogical_group("test");
+
+ return elementDetails;
+ }
+
+ @Test
+ public void elementDetailsTest(){
+ ElementDetails elementDetails = mockElementDetails();
+
+ ElementDetails elementDetails1 = new ElementDetails("test","test","test","test","test","test","test","test","test","test");
+ elementDetails1.setLogical_group("test");
+
+ assertEquals(elementDetails.getLogical_group(), elementDetails1.getLogical_group());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementTest.java
new file mode 100644
index 00000000..d4dbed3e
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementTest.java
@@ -0,0 +1,77 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.Element;
+
+public class ElementTest {
+
+ public Element mockElement(){
+ Element element = new Element("test","test","test","test","test",null);
+
+ element.setId("test");
+ element.setName("test");
+ element.setTop(10);
+ element.setLeft(10);
+ element.setHeight(10);
+ element.setWidth(10);
+ element.setImgFileName("test");
+ element.setBorderType("test");
+ element.setBgColor("test");
+ element.setP(null);
+
+ return element;
+ }
+
+ @Test
+ public void elementTest(){
+ Element element = mockElement();
+
+ Element element1 = new Element("test","test","test","test","test",null);
+
+ assertEquals(element.getId(), element1.getId());
+ assertEquals(element.getName(), element1.getName());
+ assertEquals(element.getImgFileName(), element1.getImgFileName());
+ assertEquals(element.getBorderType(), element1.getBorderType());
+ assertEquals(element.getP(), element1.getP());
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/FusionCommandTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/FusionCommandTest.java
new file mode 100644
index 00000000..ecaf9e54
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/FusionCommandTest.java
@@ -0,0 +1,65 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.domain.support;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.FusionCommand;
+
+public class FusionCommandTest {
+
+ public FusionCommand mockFusionCommand(){
+ FusionCommand fusionCommand = new FusionCommand();
+
+ fusionCommand.setTask("test");
+
+ return fusionCommand;
+ }
+
+ @Test
+ public void fusionCommandTest(){
+ FusionCommand fusionCommand = mockFusionCommand();
+
+ FusionCommand fusionCommand1 = new FusionCommand();
+ fusionCommand1.setTask("test");
+
+ assertEquals(fusionCommand.getTask(), fusionCommand1.getTask());
+ }
+
+} \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/LayoutTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/LayoutTest.java
new file mode 100644
index 00000000..d231703e
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/LayoutTest.java
@@ -0,0 +1,336 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.Container;
+import org.onap.portalsdk.core.domain.support.Domain;
+import org.onap.portalsdk.core.domain.support.Layout;
+import org.onap.portalsdk.core.domain.support.Position;
+
+public class LayoutTest {
+
+ private static final double DELTA = 1e-15;
+
+ public Layout mockLayout(){
+ Layout layout = new Layout(null, 0, 0, 0, 0);
+
+ layout.setCollapsedDomainsNewList(null);
+ layout.setCollapsedDomains(null);
+ layout.setNumberofColsofDomains(0);
+ layout.setDomainRowCol(null);
+
+ return layout;
+ }
+
+ @Test
+ public void layoutTest(){
+ Layout layout = mockLayout();
+
+ Layout layout1 = new Layout(null, 0, 0, 0, 0);
+ layout1.setCollapsedDomainsNewList(null);
+ layout1.setCollapsedDomains(null);
+ layout1.setNumberofColsofDomains(0);
+ layout1.setDomainRowCol(null);
+
+ assertEquals(layout.getCollapsedDomains(), layout1.getCollapsedDomains());
+ assertEquals(layout.getCollapsedDomainsNewList(), layout1.getCollapsedDomainsNewList());
+ assertEquals(layout.getNumberofColsofDomains(), layout1.getNumberofColsofDomains());
+ assertEquals(layout.getDomainRowCol(), layout1.getDomainRowCol());
+ }
+
+ @Test
+ public void computeDomainPositionsTest(){
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+ Domain domain = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ List<Domain> domainList = new ArrayList<>();
+ domainList.add(domain);
+ domainRowCol.put("00", domain);
+ domainRowCol.put("01", domain);
+ domainRowCol.put("10", domain);
+ layout.setDomainRowCol(domainRowCol);
+ layout.setCollapsedDomainsNewList(domainList);
+ layout.computeDomainPositions();
+ assertEquals(5.0, layout.getDomainRowCol().get("00").getP().getY(), DELTA);
+ }
+
+ @Test
+ public void computeDomainPositionsModifiedTest(){
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+ Domain domain = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ container00.setP(position);
+ containerRowCol.put("00", container00);
+ domain.setContainers(containerRowCol);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ List<Domain> domainList = new ArrayList<>();
+ domainList.add(domain);
+ domainRowCol.put("00", domain);
+ domainRowCol.put("01", domain);
+ domainRowCol.put("10", domain);
+ layout.setDomainRowCol(domainRowCol);
+ layout.setCollapsedDomainsNewList(domainList);
+ layout.computeDomainPositionsModified();
+ assertEquals(5.0, layout.getDomainRowCol().get("00").getP().getY(), DELTA);
+ }
+
+ @Test
+ public void collapseDomainModifiedTest(){
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+ Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Domain domain2 = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ container00.setP(position);
+ containerRowCol.put("00", container00);
+ containerRowCol.put("01", container00);
+ domain.setContainers(containerRowCol);
+ domain2.setContainers(containerRowCol);
+ domain.setIndexChanged(true);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ domainRowCol.put("00", domain);
+ domainRowCol.put("01", domain2);
+ domainRowCol.put("10", domain);
+ layout.setDomainRowCol(domainRowCol);
+ layout.collapseDomainModified("XYZ");
+ assertEquals(5.0, layout.getDomainRowCol().get("10").getP().getY(), DELTA);
+ }
+
+ @Test
+ public void collapseDomainNewTest(){
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+ Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Domain domain2 = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ container00.setP(position);
+ containerRowCol.put("00", container00);
+ containerRowCol.put("01", container00);
+ domain.setContainers(containerRowCol);
+ domain2.setContainers(containerRowCol);
+ domain.setIndexChanged(true);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ domainRowCol.put("00", domain);
+ domainRowCol.put("01", domain2);
+ domainRowCol.put("10", domain);
+ layout.setDomainRowCol(domainRowCol);
+ layout.collapseDomainNew("XYZ");
+ assertEquals(5.0, layout.getDomainRowCol().get("10").getP().getY(), DELTA);
+ }
+
+ @Test
+ public void collapseDomainTest(){
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+ Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Domain domain2 = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ container00.setP(position);
+ containerRowCol.put("00", container00);
+ containerRowCol.put("01", container00);
+ domain.setContainers(containerRowCol);
+ domain.setP(position);
+ domain2.setP(position);
+ domain2.setContainers(containerRowCol);
+ domain.setIndexChanged(true);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ domainRowCol.put("00", domain);
+ domainRowCol.put("01", domain2);
+ domainRowCol.put("10", domain);
+ layout.setDomainRowCol(domainRowCol);
+ layout.collapseDomain("XYZ");
+ assertEquals(5.0, layout.getDomainRowCol().get("10").getP().getY(), DELTA);
+ }
+
+
+ @Test
+ public void uncollapseDomainModifiedTest(){
+
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+
+ Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ domain.setP(position);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ domainRowCol.put("00", domain);
+
+ Map<String, Container> innerContainerRowCol = new HashMap<>();
+ Container innerContainer = new Container("test","test",1,1,10,10,10,10,10,10);
+ innerContainerRowCol.put("00", innerContainer);
+
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ container00.setInnerContainer(innerContainerRowCol);
+ containerRowCol.put("00", container00);
+
+ domain.setContainers(containerRowCol);
+
+ Map<String, Domain> originalDomainRowCol = new HashMap<>();
+ originalDomainRowCol.put("00", domain);
+
+ layout.setDomainRowCol(domainRowCol);
+ layout.setCollapsedDomains(originalDomainRowCol);
+
+ layout.uncollapseDomainModified("XYZ");
+ assertEquals(3, layout.getNumberofColsofDomains(), DELTA);
+
+ }
+
+
+ @Test
+ public void uncollapseDomainTest(){
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+
+ Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ domain.setP(position);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ domainRowCol.put("00", domain);
+
+ Map<String, Container> innerContainerRowCol = new HashMap<>();
+ Container innerContainer = new Container("test","test",1,1,10,10,10,10,10,10);
+ innerContainerRowCol.put("00", innerContainer);
+
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ container00.setInnerContainer(innerContainerRowCol);
+ containerRowCol.put("00", container00);
+
+ domain.setContainers(containerRowCol);
+
+ Map<String, Domain> originalDomainRowCol = new HashMap<>();
+ originalDomainRowCol.put("00", domain);
+
+ layout.setDomainRowCol(domainRowCol);
+ layout.setCollapsedDomains(originalDomainRowCol);
+
+ layout.uncollapseDomain("XYZ");
+ assertEquals(10.6, layout.getDomainRowCol().get("00").getP().getX(), DELTA);
+ }
+
+ @Test
+ public void uncollapseDomainNewTest(){
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+
+ Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ domain.setP(position);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ domainRowCol.put("00", domain);
+
+ Map<String, Container> innerContainerRowCol = new HashMap<>();
+ Container innerContainer = new Container("test","test",1,1,10,10,10,10,10,10);
+ innerContainerRowCol.put("00", innerContainer);
+
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ container00.setInnerContainer(innerContainerRowCol);
+ containerRowCol.put("00", container00);
+
+ domain.setContainers(containerRowCol);
+
+ Map<String, Domain> originalDomainRowCol = new HashMap<>();
+ originalDomainRowCol.put("00", domain);
+ layout.setDomainRowCol(domainRowCol);
+ layout.collapseDomain("XYZ");
+ layout.uncollapseDomainNew("XYZ");
+ assertEquals(11.0, layout.getDomainRowCol().get("00").getP().getX(), DELTA);
+ }
+
+ @Test
+ public void uncollapseDomainNew1Test(){
+
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+
+ Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ domain.setP(position);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ domainRowCol.put("00", domain);
+
+ Map<String, Container> innerContainerRowCol = new HashMap<>();
+ Container innerContainer = new Container("test","test",1,1,10,10,10,10,10,10);
+ innerContainerRowCol.put("00", innerContainer);
+
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ container00.setInnerContainer(innerContainerRowCol);
+ containerRowCol.put("00", container00);
+
+ domain.setContainers(containerRowCol);
+
+ Map<String, Domain> originalDomainRowCol = new HashMap<>();
+ originalDomainRowCol.put("00", domain);
+ layout.setDomainRowCol(domainRowCol);
+ layout.collapseDomain("XYZ");
+ layout.uncollapseDomainNew1("XYZ");
+ assertEquals(11.0, layout.getDomainRowCol().get("00").getP().getX(), DELTA);
+
+ }
+
+}
+
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/NameValueIdTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/NameValueIdTest.java
new file mode 100644
index 00000000..84720021
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/NameValueIdTest.java
@@ -0,0 +1,82 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.domain.support;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.DomainVo;
+import org.onap.portalsdk.core.domain.support.NameValueId;
+
+public class NameValueIdTest {
+
+ public NameValueId mockNameValueId(){
+ NameValueId nameValueId = new NameValueId("test","test");
+
+ nameValueId.setLab("test");
+ nameValueId.setVal("test");
+
+ return nameValueId;
+ }
+
+ @Test
+ public void nameValueIdTest(){
+ NameValueId nameValueId = mockNameValueId();
+
+ NameValueId nameValueId1 = new NameValueId("test","test");
+ nameValueId1.setLab("test");
+ nameValueId1.setVal("test");
+
+ assertEquals(nameValueId.getLab(), nameValueId1.getLab());
+ assertEquals(nameValueId.getVal(), nameValueId1.getVal());
+ }
+
+ @Test
+ public void equalsTest(){
+ NameValueId nameValueId1 = mockNameValueId();
+ NameValueId nameValueId2 = mockNameValueId();
+ assertEquals(true, nameValueId1.equals(nameValueId2));
+ }
+
+ @Test
+ public void hashCodeTest(){
+ NameValueId nameValueId1 = mockNameValueId();
+ assertNotNull(nameValueId1.hashCode());
+ }
+} \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/PositionTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/PositionTest.java
new file mode 100644
index 00000000..e75f1d10
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/PositionTest.java
@@ -0,0 +1,68 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.Position;
+
+public class PositionTest {
+
+ private static final double DELTA = 1e-15;
+
+ public Position mockPosition(){
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+
+ return position;
+ }
+
+ @Test
+ public void positionTest(){
+ Position position = mockPosition();
+
+ Position position1 = new Position();
+ position1.setX(10);
+ position1.setY(10);
+
+ assertEquals(position.getX(), position1.getX(), DELTA);
+ assertEquals(position.getY(), position1.getY(), DELTA);
+ }
+} \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/SizeTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/SizeTest.java
new file mode 100644
index 00000000..3ae57e39
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/SizeTest.java
@@ -0,0 +1,69 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalsdk.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.Size;
+
+public class SizeTest {
+
+ private static final double DELTA = 1e-15;
+
+ public Size mockSize(){
+ Size size = new Size();
+ size.setHeight(10);
+ size.setWidth(10);
+
+ return size;
+ }
+
+ @Test
+ public void sizeTest(){
+ Size size = mockSize();
+
+ Size size1 = new Size();
+ size1.setHeight(10);
+ size1.setWidth(10);
+
+ assertEquals(size.getHeight(), size1.getHeight(), DELTA);
+ assertEquals(size.getWidth(), size1.getWidth(), DELTA);
+ }
+
+} \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/sdkapp/core/onboarding/client/AppContextManagerTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/sdkapp/core/onboarding/client/AppContextManagerTest.java
new file mode 100644
index 00000000..ca8222e5
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/sdkapp/core/onboarding/client/AppContextManagerTest.java
@@ -0,0 +1,64 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.sdkapp.core.onboarding.client;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.onboarding.client.AppContextManager;
+
+public class AppContextManagerTest {
+
+ public AppContextManager mockAppContextManager(){
+
+ AppContextManager appContextManager = new AppContextManager();
+ appContextManager.setApplicationContext(null);
+
+ return appContextManager;
+ }
+
+ @Test
+ public void appContextManagerTest(){
+ AppContextManager appContextManager = mockAppContextManager();
+
+ AppContextManager appContextManager1 = new AppContextManager();
+
+ assertEquals(appContextManager.getAppContext(), appContextManager1.getAppContext());
+
+ }
+}