diff options
author | 2018-04-12 15:30:01 -0400 | |
---|---|---|
committer | 2018-04-12 16:21:28 -0400 | |
commit | 15843133cb53eaa3c0ffbdcbdbfc581819a5fcdc (patch) | |
tree | 4116200b3570c80ff6f5ca828884428825e95486 /ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core | |
parent | d8c81e748f1db2fbd2bdd810671d90894af35d69 (diff) |
pom, new modules changes
Issue-ID: PORTAL-254
portal/SDK release 2.3.0, domain, sdk aaf modules
Change-Id: I4308550f295620d10d049fef3a88db3365a48a6f
Signed-off-by: Kishore Reddy, Gujja (kg811t) <kg811t@research.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core')
31 files changed, 3080 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/AppTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/AppTest.java new file mode 100644 index 00000000..33a71e8e --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/AppTest.java @@ -0,0 +1,124 @@ +/* + * ============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; +import org.onap.portalsdk.core.domain.App; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/AuditLogTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/AuditLogTest.java new file mode 100644 index 00000000..5439df03 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/AuditLogTest.java @@ -0,0 +1,74 @@ +/* + * ============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.AuditLog; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/BroadcastMessageTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/BroadcastMessageTest.java new file mode 100644 index 00000000..9d47b770 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/BroadcastMessageTest.java @@ -0,0 +1,102 @@ +/* + * ============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.BroadcastMessage; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/FnMenuTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/FnMenuTest.java new file mode 100644 index 00000000..9f8b673b --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/FnMenuTest.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.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.FnMenu; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/LoginBeanTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LoginBeanTest.java new file mode 100644 index 00000000..a6df9865 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LoginBeanTest.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; +import org.onap.portalsdk.core.domain.LoginBean; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/LookupTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LookupTest.java new file mode 100644 index 00000000..100a81aa --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LookupTest.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 static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.Lookup; +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-domain/src/test/java/org/onap/portalsdk/core/domain/LuCountryTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuCountryTest.java new file mode 100644 index 00000000..07f321ba --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuCountryTest.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.domain; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.LuCountry; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/LuStateTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuStateTest.java new file mode 100644 index 00000000..b4a3aaa9 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuStateTest.java @@ -0,0 +1,66 @@ +/* + * ============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.LuState; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/LuTimeZoneTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuTimeZoneTest.java new file mode 100644 index 00000000..364fc235 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/LuTimeZoneTest.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.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.LuTimeZone; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/MenuDataTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/MenuDataTest.java new file mode 100644 index 00000000..67fecde1 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/MenuDataTest.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.MenuData; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/MenuTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/MenuTest.java new file mode 100644 index 00000000..9036d6da --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/MenuTest.java @@ -0,0 +1,85 @@ +/* + * ============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.Menu; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/ProfileTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/ProfileTest.java new file mode 100644 index 00000000..f91cf508 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/ProfileTest.java @@ -0,0 +1,71 @@ +/* + * ============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.Profile; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/RoleFunctionTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/RoleFunctionTest.java new file mode 100644 index 00000000..e6742363 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/RoleFunctionTest.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; +import org.onap.portalsdk.core.domain.RoleFunction; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/RoleTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/RoleTest.java new file mode 100644 index 00000000..92f09a3a --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/RoleTest.java @@ -0,0 +1,113 @@ +/* + * ============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; +import org.onap.portalsdk.core.domain.Role; +import org.onap.portalsdk.core.domain.RoleFunction; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleKeyTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleKeyTest.java new file mode 100644 index 00000000..a37dd226 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleKeyTest.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.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.UrlsAccessibleKey; +import org.onap.portalsdk.core.domain.User; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleTest.java new file mode 100644 index 00000000..e1af230d --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleTest.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.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.UrlsAccessible; +import org.onap.portalsdk.core.domain.UrlsAccessibleKey; +import org.onap.portalsdk.core.domain.User; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/UserAppIdTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserAppIdTest.java new file mode 100644 index 00000000..5bf4ee51 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserAppIdTest.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.domain; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.App; +import org.onap.portalsdk.core.domain.Role; +import org.onap.portalsdk.core.domain.User; +import org.onap.portalsdk.core.domain.UserAppId; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/UserAppTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserAppTest.java new file mode 100644 index 00000000..1feba309 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserAppTest.java @@ -0,0 +1,93 @@ +/* + * ============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.App; +import org.onap.portalsdk.core.domain.Role; +import org.onap.portalsdk.core.domain.User; +import org.onap.portalsdk.core.domain.UserApp; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/UserTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserTest.java new file mode 100644 index 00000000..eb06bf59 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/UserTest.java @@ -0,0 +1,220 @@ +/* + * ============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; +import org.onap.portalsdk.core.domain.App; +import org.onap.portalsdk.core.domain.Role; +import org.onap.portalsdk.core.domain.User; +import org.onap.portalsdk.core.domain.UserApp; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/support/AttributeTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/AttributeTest.java new file mode 100644 index 00000000..a8e86a19 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/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.core.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-domain/src/test/java/org/onap/portalsdk/core/domain/support/CollaborateListTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/CollaborateListTest.java new file mode 100644 index 00000000..ebf50189 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/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.core.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-domain/src/test/java/org/onap/portalsdk/core/domain/support/ContainerTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/ContainerTest.java new file mode 100644 index 00000000..498e693e --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/ContainerTest.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.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.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; + +public class ContainerTest { + + @InjectMocks + Container container = new Container(); + + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + } + + //MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); + + NullPointerException nullPointerException = new NullPointerException(); + + User user = new User(); + + 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-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainTest.java new file mode 100644 index 00000000..a24334f6 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/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.core.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-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainVOTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/DomainVOTest.java new file mode 100644 index 00000000..4771d54f --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/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.core.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-domain/src/test/java/org/onap/portalsdk/core/domain/support/ElementDetailsTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/ElementDetailsTest.java new file mode 100644 index 00000000..c9cd0e85 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/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.core.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-domain/src/test/java/org/onap/portalsdk/core/domain/support/ElementTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/ElementTest.java new file mode 100644 index 00000000..366f7396 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/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.core.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-domain/src/test/java/org/onap/portalsdk/core/domain/support/FusionCommandTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/FusionCommandTest.java new file mode 100644 index 00000000..bbdd5746 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/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.core.domain.support; + +import static org.junit.Assert.assertEquals; + +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-domain/src/test/java/org/onap/portalsdk/core/domain/support/LayoutTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/LayoutTest.java new file mode 100644 index 00000000..4b4b135c --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/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.core.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-domain/src/test/java/org/onap/portalsdk/core/domain/support/NameValueIdTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/NameValueIdTest.java new file mode 100644 index 00000000..ea73fc40 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/NameValueIdTest.java @@ -0,0 +1,81 @@ +/* + * ============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.support; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +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-domain/src/test/java/org/onap/portalsdk/core/domain/support/PositionTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/PositionTest.java new file mode 100644 index 00000000..1b837f76 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/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.core.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-domain/src/test/java/org/onap/portalsdk/core/domain/support/SizeTest.java b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/domain/support/SizeTest.java new file mode 100644 index 00000000..d65c0ce0 --- /dev/null +++ b/ecomp-sdk/epsdk-domain/src/test/java/org/onap/portalsdk/core/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.core.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 |