diff options
author | 2018-02-07 17:12:02 -0500 | |
---|---|---|
committer | 2018-02-07 17:12:02 -0500 | |
commit | 558eb8fc1392428dbabc4d6016713bff99d6425f (patch) | |
tree | 7ff7952210e824aaf4697e6792527debc125c7a5 /ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support | |
parent | 0127650b2fd9b2846aabf8f955bb7e2cfb983f22 (diff) |
Added Junits
Issue-ID: PORTAL-136, PORTAL-188
Includes FW mode central changes
Change-Id: Iba6c0d48ed768e32d1fe4700d0044eb7f3fdc482
Signed-off-by: Hima Elisetty <hbindu@research.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support')
12 files changed, 1343 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/AttributeTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/AttributeTest.java new file mode 100644 index 00000000..16a8a597 --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/AttributeTest.java @@ -0,0 +1,79 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.domain.support; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.Attribute; + +public class AttributeTest { + + private static final double DELTA = 1e-15; + + public Attribute mockAttribute(){ + Attribute attribute = new Attribute(); + + attribute.setName("test"); + attribute.setHeight(10); + attribute.setLeft(10); + attribute.setTop(10); + attribute.setWidth(10); + + return attribute; + } + + @Test + public void attributeTest(){ + Attribute attribute = mockAttribute(); + + Attribute attribute1 = new Attribute(); + attribute1.setName("test"); + attribute1.setHeight(10); + attribute1.setLeft(10); + attribute1.setTop(10); + attribute1.setWidth(10); + + assertEquals(attribute.getHeight(), attribute1.getHeight(), DELTA); + assertEquals(attribute.getName(), attribute1.getName()); + assertEquals(attribute.getLeft(), attribute1.getLeft(), DELTA); + assertEquals(attribute.getTop(), attribute1.getTop(), DELTA); + assertEquals(attribute.getWidth(), attribute1.getWidth(), DELTA); + + } +} diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/CollaborateListTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/CollaborateListTest.java new file mode 100644 index 00000000..4bc9f3b6 --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/CollaborateListTest.java @@ -0,0 +1,60 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.domain.support; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.CollaborateList; + +public class CollaborateListTest { + + @SuppressWarnings("static-access") + @Test + public void addAndRemoveUserListTest(){ + String user1 = "Test User1"; + String user2 = "Test User2"; + CollaborateList collaborateList = CollaborateList.getInstance(); + collaborateList.addUserName(user1); + collaborateList.addUserName(user2); + collaborateList.delUserName(user2); + + assertEquals(true, collaborateList.getAllUserName().contains(user1)); + assertEquals(false, collaborateList.getAllUserName().contains(user2)); + } +} diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ContainerTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ContainerTest.java new file mode 100644 index 00000000..145ee58f --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ContainerTest.java @@ -0,0 +1,193 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.domain.support; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.onap.portalsdk.core.domain.User; +import org.onap.portalsdk.core.domain.support.Container; +import org.onap.portalsdk.core.domain.support.Element; +import org.onap.portalsdk.core.domain.support.Position; +import org.onap.portalsdk.core.domain.support.Size; +import org.onap.portalsdk.core.restful.client.SharedContextRestClient; +import org.onap.portalsdk.core.web.support.UserUtils; + +public class ContainerTest { + + @InjectMocks + Container container = new Container(); + + @Mock + private SharedContextRestClient sharedContextRestClient; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + } + + //MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); + + NullPointerException nullPointerException = new NullPointerException(); + + User user = new User(); + + @Mock + UserUtils userUtils = new UserUtils(); + + private static final double DELTA = 1e-15; + + public Container mockContainer(){ + Container container = new Container("test","test",1,1,10,10,10,10,10,10); + + Size size = new Size(); + size.setHeight(10); + size.setWidth(10); + + Position position = new Position(); + position.setX(10); + position.setY(10); + + Map<String, Container> containerRowCol = new HashMap<String, Container>(); + Map<String, Element> elementRowCol = new HashMap<String, Element>(); + + List<Container> innerCList = new ArrayList<Container>(); + List<Element> elementList = new ArrayList<Element>(); + + container.setName("test"); + container.setVisibilityType("test"); + container.setHeight(10); + container.setLeft(10); + container.setWidth(10); + container.setInnerContainer(null); + container.setElements(null); + container.setInnerCList(null); + container.setElementList(null); + container.setP(null); + return container; + } + + @Test + public void containerTest(){ + Container container = mockContainer(); + + Container container1 = new Container("test","test",1,1,10,10,10,10,10,10); + + Size size1 = new Size(); + size1.setHeight(10); + size1.setWidth(10); + + Position position1 = new Position(); + position1.setX(10); + position1.setY(10); + container1.setP(null); + + + container1.setName("test"); + container.setVisibilityType("test"); + container.setHeight(10); + container.setLeft(10); + container.setWidth(10); + container.setInnerContainer(null); + container.setElements(null); + container.setInnerCList(null); + container.setElementList(null); + + assertEquals(container.getContainerRowCol(), container1.getContainerRowCol()); + assertEquals(container.getElementRowCol(), container1.getElementRowCol()); + assertEquals(container.getName(), container1.getName()); + assertEquals(container.getP(), container1.getP()); + } + + @Test + public void computeSizeTest(){ + + Map<String, Container> containerRowCol = new HashMap<>(); + Container container = new Container("test","test",1,1,10,10,10,10,10,10); + containerRowCol.put("00", container); + + Map<String, Element> elementRowCol = new HashMap<>(); + Element element = new Element("1", "test"); + elementRowCol.put("00", element); + + Container containerTest = new Container("test","Broadworks complex",1,1,10,10,10,10,10,10); + containerTest.setElements(elementRowCol); + containerTest.setInnerContainer(containerRowCol); + Size size = containerTest.computeSize(); + assertEquals(40.0,size.getWidth(), DELTA); + assertEquals(40.1, size.getHeight(), DELTA); + } + + @Test + public void computeElementPositionsTest(){ + + Map<String, Container> containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + Container container01 = new Container("test","test",1,1,10,10,10,10,10,10); + containerRowCol.put("00", container00); + containerRowCol.put("10", container01); + containerRowCol.put("11", container01); + + Map<String, Element> elementRowCol = new HashMap<>(); + Element element = new Element("1", "test"); + elementRowCol.put("01", element); + elementRowCol.put("02", element); + + Container containerTest = new Container("test","Broadworks complex",2,3,10,10,10,10,10,10); + Position position = new Position(); + position.setX(10); + position.setY(10); + containerTest.setP(position); + containerTest.setElements(elementRowCol); + containerTest.setInnerContainer(containerRowCol); + containerTest.computeElementPositions(); + assertEquals(20.0,containerTest.getContainerRowCol().get("00").getP().getX(), DELTA); + assertEquals(20.0,containerTest.getContainerRowCol().get("00").getP().getY(), DELTA); + assertEquals(50.0,containerTest.getContainerRowCol().get("11").getP().getX(), DELTA); + assertEquals(31.5,containerTest.getContainerRowCol().get("11").getP().getY(), DELTA); + } +} diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainTest.java new file mode 100644 index 00000000..ff9522df --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainTest.java @@ -0,0 +1,143 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.domain.support; + +import static org.junit.Assert.assertEquals; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.Container; +import org.onap.portalsdk.core.domain.support.Domain; +import org.onap.portalsdk.core.domain.support.Size; + +public class DomainTest { + + private static final double DELTA = 1e-15; + + public Domain mockDomain(){ + + Domain domain = new Domain(null, null, 0, 0, 0, 0, 0, 0, 0); + + domain.setP(null); + domain.setNewXafterColl(0); + domain.setYafterColl(0); + domain.setDomainToLayoutWd(0); + domain.setTop(0); + domain.setLeft(0); + domain.setHeight(0); + domain.setWidth(0); + domain.setName("test"); + domain.setIndexChanged(false); + domain.setContainers(null); + + return domain; + } + + @Test + public void domainTest(){ + Domain domain = mockDomain(); + + Domain domain1 = new Domain(null, null, 0, 0, 0, 0, 0, 0, 0); + + domain1.setP(null); + domain1.setNewXafterColl(0); + domain1.setYafterColl(0); + domain1.setDomainToLayoutWd(0); + domain1.setTop(0); + domain1.setLeft(0); + domain1.setHeight(0); + domain1.setWidth(0); + domain1.setName("test"); + domain1.setIndexChanged(false); + domain1.setContainers(null); + + assertEquals(domain.getP(), domain1.getP()); + assertEquals(domain.getNewXafterColl(), domain1.getNewXafterColl(), DELTA); + assertEquals(domain.getYafterColl(), domain1.getYafterColl(), DELTA); + assertEquals(domain.getDomainToLayoutWd(), domain1.getDomainToLayoutWd(), DELTA); + assertEquals(domain.getTop(), domain1.getTop(), DELTA); + assertEquals(domain.getLeft(), domain1.getLeft(), DELTA); + assertEquals(domain.getHeight(), domain1.getHeight(), DELTA); + assertEquals(domain.getWidth(), domain1.getWidth(), DELTA); + assertEquals(domain.getName(), domain1.getName()); + assertEquals(domain.isIndexChanged(), domain1.isIndexChanged()); + assertEquals(domain.getContainerRowCol(), domain1.getContainerRowCol()); + } + + @Test + public void computeSizeTest(){ + Domain domain = new Domain("test", "VNI", 0, 0, 0, 0, 0, 2, 2); + Container container = new Container("test","test",1,1,10,10,10,10,10,10); + Map<String, Container> containerRowCol = new HashMap<>(); + containerRowCol.put("00", container); + containerRowCol.put("10", container); + containerRowCol.put("11", container); + domain.setContainers(containerRowCol); + Size size = domain.computeSize(); + assertEquals(5.0, size.getHeight(), DELTA); + } + @Test + public void computeSizeWithoutNameTest(){ + Domain domain = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Container container = new Container("test","test",1,1,10,10,10,10,10,10); + Map<String, Container> containerRowCol = new HashMap<>(); + containerRowCol.put("00", container); + containerRowCol.put("10", container); + containerRowCol.put("11", container); + domain.setContainers(containerRowCol); + Size size = domain.computeSize(); + assertEquals(5.0, size.getHeight(), DELTA); + } + + @Test + public void computeConatinerPositionsTest(){ + Map<String, Container> containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + Container container01 = new Container("test","test",1,1,10,10,10,10,10,10); + containerRowCol.put("00", container00); + containerRowCol.put("10", container01); + containerRowCol.put("11", container01); + + Domain domain = new Domain("test", "XYZ", 0, 1, 1, 4, 4, 2, 2); + domain.setContainers(containerRowCol); + domain.computeConatinerPositions(); + assertEquals(21.0, domain.getContainerRowCol().get("10").getP().getX(), DELTA); + } +} diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainVOTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainVOTest.java new file mode 100644 index 00000000..d000803e --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainVOTest.java @@ -0,0 +1,107 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.domain.support; + +import static org.junit.Assert.assertEquals; + +import java.util.Date; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.DomainVo; + +public class DomainVOTest { + + public DomainVo mockDomainVO(){ + DomainVo domainVo = new DomainVo(); + + domainVo.setId((long) 1); + domainVo.setCreated(new Date()); + domainVo.setModified(new Date()); + domainVo.setCreatedId((long) 1); + domainVo.setModifiedId((long) 1); + domainVo.setRowNum((long) 1); + domainVo.setAuditUserId(null); + domainVo.setAuditTrail(null); + + return domainVo; + } + + @Test + public void domainVoTest(){ + DomainVo domainVo = mockDomainVO(); + + DomainVo domainVo1 = new DomainVo(); + domainVo1.setId((long) 1); + domainVo1.setCreated(new Date()); + domainVo1.setModified(new Date()); + domainVo1.setCreatedId((long) 1); + domainVo1.setModifiedId((long) 1); + domainVo1.setRowNum((long) 1); + domainVo1.setAuditUserId(null); + domainVo1.setAuditTrail(null); + + assertEquals(domainVo.getId(), domainVo1.getId()); + assertEquals(domainVo.getCreated(), domainVo1.getCreated()); + assertEquals(domainVo.getModified(), domainVo1.getModified()); + assertEquals(domainVo.getCreatedId(), domainVo1.getCreatedId()); + assertEquals(domainVo.getModifiedId(), domainVo1.getModifiedId()); + assertEquals(domainVo.getRowNum(), domainVo1.getRowNum()); + assertEquals(domainVo.getAuditUserId(), domainVo1.getAuditUserId()); + assertEquals(domainVo.getAuditTrail(), domainVo1.getAuditTrail()); + } + + @Test + public void copyTest(){ + DomainVo domainVo = mockDomainVO(); + domainVo.copy(true); + } + + @Test + public void equalTest(){ + DomainVo domainVo1 = mockDomainVO(); + DomainVo domainVo2 = mockDomainVO(); + assertEquals(true, domainVo1.equals(domainVo2)); + } + + @Test + public void compareTest(){ + DomainVo domainVo1 = mockDomainVO(); + DomainVo domainVo2 = mockDomainVO(); + assertEquals(0, domainVo1.compareTo(domainVo2)); + } +} diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementDetailsTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementDetailsTest.java new file mode 100644 index 00000000..1f657e8d --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementDetailsTest.java @@ -0,0 +1,64 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.domain.support; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.ElementDetails; + +public class ElementDetailsTest { + + public ElementDetails mockElementDetails(){ + ElementDetails elementDetails = new ElementDetails("test","test","test","test","test","test","test","test","test","test"); + + elementDetails.setLogical_group("test"); + + return elementDetails; + } + + @Test + public void elementDetailsTest(){ + ElementDetails elementDetails = mockElementDetails(); + + ElementDetails elementDetails1 = new ElementDetails("test","test","test","test","test","test","test","test","test","test"); + elementDetails1.setLogical_group("test"); + + assertEquals(elementDetails.getLogical_group(), elementDetails1.getLogical_group()); + } +} diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementTest.java new file mode 100644 index 00000000..d4dbed3e --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementTest.java @@ -0,0 +1,77 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.domain.support; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.Element; + +public class ElementTest { + + public Element mockElement(){ + Element element = new Element("test","test","test","test","test",null); + + element.setId("test"); + element.setName("test"); + element.setTop(10); + element.setLeft(10); + element.setHeight(10); + element.setWidth(10); + element.setImgFileName("test"); + element.setBorderType("test"); + element.setBgColor("test"); + element.setP(null); + + return element; + } + + @Test + public void elementTest(){ + Element element = mockElement(); + + Element element1 = new Element("test","test","test","test","test",null); + + assertEquals(element.getId(), element1.getId()); + assertEquals(element.getName(), element1.getName()); + assertEquals(element.getImgFileName(), element1.getImgFileName()); + assertEquals(element.getBorderType(), element1.getBorderType()); + assertEquals(element.getP(), element1.getP()); + } + +} diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/FusionCommandTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/FusionCommandTest.java new file mode 100644 index 00000000..ecaf9e54 --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/FusionCommandTest.java @@ -0,0 +1,65 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.domain.support; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.FusionCommand; + +public class FusionCommandTest { + + public FusionCommand mockFusionCommand(){ + FusionCommand fusionCommand = new FusionCommand(); + + fusionCommand.setTask("test"); + + return fusionCommand; + } + + @Test + public void fusionCommandTest(){ + FusionCommand fusionCommand = mockFusionCommand(); + + FusionCommand fusionCommand1 = new FusionCommand(); + fusionCommand1.setTask("test"); + + assertEquals(fusionCommand.getTask(), fusionCommand1.getTask()); + } + +}
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/LayoutTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/LayoutTest.java new file mode 100644 index 00000000..d231703e --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/LayoutTest.java @@ -0,0 +1,336 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.domain.support; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.Container; +import org.onap.portalsdk.core.domain.support.Domain; +import org.onap.portalsdk.core.domain.support.Layout; +import org.onap.portalsdk.core.domain.support.Position; + +public class LayoutTest { + + private static final double DELTA = 1e-15; + + public Layout mockLayout(){ + Layout layout = new Layout(null, 0, 0, 0, 0); + + layout.setCollapsedDomainsNewList(null); + layout.setCollapsedDomains(null); + layout.setNumberofColsofDomains(0); + layout.setDomainRowCol(null); + + return layout; + } + + @Test + public void layoutTest(){ + Layout layout = mockLayout(); + + Layout layout1 = new Layout(null, 0, 0, 0, 0); + layout1.setCollapsedDomainsNewList(null); + layout1.setCollapsedDomains(null); + layout1.setNumberofColsofDomains(0); + layout1.setDomainRowCol(null); + + assertEquals(layout.getCollapsedDomains(), layout1.getCollapsedDomains()); + assertEquals(layout.getCollapsedDomainsNewList(), layout1.getCollapsedDomainsNewList()); + assertEquals(layout.getNumberofColsofDomains(), layout1.getNumberofColsofDomains()); + assertEquals(layout.getDomainRowCol(), layout1.getDomainRowCol()); + } + + @Test + public void computeDomainPositionsTest(){ + Layout layout = new Layout(null, 0, 0, 2, 2); + Domain domain = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Map<String, Domain> domainRowCol = new HashMap<>(); + List<Domain> domainList = new ArrayList<>(); + domainList.add(domain); + domainRowCol.put("00", domain); + domainRowCol.put("01", domain); + domainRowCol.put("10", domain); + layout.setDomainRowCol(domainRowCol); + layout.setCollapsedDomainsNewList(domainList); + layout.computeDomainPositions(); + assertEquals(5.0, layout.getDomainRowCol().get("00").getP().getY(), DELTA); + } + + @Test + public void computeDomainPositionsModifiedTest(){ + Layout layout = new Layout(null, 0, 0, 2, 2); + Domain domain = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Map<String, Container> containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + Position position = new Position(); + position.setX(10); + position.setY(10); + container00.setP(position); + containerRowCol.put("00", container00); + domain.setContainers(containerRowCol); + Map<String, Domain> domainRowCol = new HashMap<>(); + List<Domain> domainList = new ArrayList<>(); + domainList.add(domain); + domainRowCol.put("00", domain); + domainRowCol.put("01", domain); + domainRowCol.put("10", domain); + layout.setDomainRowCol(domainRowCol); + layout.setCollapsedDomainsNewList(domainList); + layout.computeDomainPositionsModified(); + assertEquals(5.0, layout.getDomainRowCol().get("00").getP().getY(), DELTA); + } + + @Test + public void collapseDomainModifiedTest(){ + Layout layout = new Layout(null, 0, 0, 2, 2); + Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Domain domain2 = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Map<String, Container> containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + Position position = new Position(); + position.setX(10); + position.setY(10); + container00.setP(position); + containerRowCol.put("00", container00); + containerRowCol.put("01", container00); + domain.setContainers(containerRowCol); + domain2.setContainers(containerRowCol); + domain.setIndexChanged(true); + Map<String, Domain> domainRowCol = new HashMap<>(); + domainRowCol.put("00", domain); + domainRowCol.put("01", domain2); + domainRowCol.put("10", domain); + layout.setDomainRowCol(domainRowCol); + layout.collapseDomainModified("XYZ"); + assertEquals(5.0, layout.getDomainRowCol().get("10").getP().getY(), DELTA); + } + + @Test + public void collapseDomainNewTest(){ + Layout layout = new Layout(null, 0, 0, 2, 2); + Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Domain domain2 = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Map<String, Container> containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + Position position = new Position(); + position.setX(10); + position.setY(10); + container00.setP(position); + containerRowCol.put("00", container00); + containerRowCol.put("01", container00); + domain.setContainers(containerRowCol); + domain2.setContainers(containerRowCol); + domain.setIndexChanged(true); + Map<String, Domain> domainRowCol = new HashMap<>(); + domainRowCol.put("00", domain); + domainRowCol.put("01", domain2); + domainRowCol.put("10", domain); + layout.setDomainRowCol(domainRowCol); + layout.collapseDomainNew("XYZ"); + assertEquals(5.0, layout.getDomainRowCol().get("10").getP().getY(), DELTA); + } + + @Test + public void collapseDomainTest(){ + Layout layout = new Layout(null, 0, 0, 2, 2); + Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Domain domain2 = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Map<String, Container> containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + Position position = new Position(); + position.setX(10); + position.setY(10); + container00.setP(position); + containerRowCol.put("00", container00); + containerRowCol.put("01", container00); + domain.setContainers(containerRowCol); + domain.setP(position); + domain2.setP(position); + domain2.setContainers(containerRowCol); + domain.setIndexChanged(true); + Map<String, Domain> domainRowCol = new HashMap<>(); + domainRowCol.put("00", domain); + domainRowCol.put("01", domain2); + domainRowCol.put("10", domain); + layout.setDomainRowCol(domainRowCol); + layout.collapseDomain("XYZ"); + assertEquals(5.0, layout.getDomainRowCol().get("10").getP().getY(), DELTA); + } + + + @Test + public void uncollapseDomainModifiedTest(){ + + Layout layout = new Layout(null, 0, 0, 2, 2); + + Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Position position = new Position(); + position.setX(10); + position.setY(10); + domain.setP(position); + Map<String, Domain> domainRowCol = new HashMap<>(); + domainRowCol.put("00", domain); + + Map<String, Container> innerContainerRowCol = new HashMap<>(); + Container innerContainer = new Container("test","test",1,1,10,10,10,10,10,10); + innerContainerRowCol.put("00", innerContainer); + + Map<String, Container> containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + container00.setInnerContainer(innerContainerRowCol); + containerRowCol.put("00", container00); + + domain.setContainers(containerRowCol); + + Map<String, Domain> originalDomainRowCol = new HashMap<>(); + originalDomainRowCol.put("00", domain); + + layout.setDomainRowCol(domainRowCol); + layout.setCollapsedDomains(originalDomainRowCol); + + layout.uncollapseDomainModified("XYZ"); + assertEquals(3, layout.getNumberofColsofDomains(), DELTA); + + } + + + @Test + public void uncollapseDomainTest(){ + Layout layout = new Layout(null, 0, 0, 2, 2); + + Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Position position = new Position(); + position.setX(10); + position.setY(10); + domain.setP(position); + Map<String, Domain> domainRowCol = new HashMap<>(); + domainRowCol.put("00", domain); + + Map<String, Container> innerContainerRowCol = new HashMap<>(); + Container innerContainer = new Container("test","test",1,1,10,10,10,10,10,10); + innerContainerRowCol.put("00", innerContainer); + + Map<String, Container> containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + container00.setInnerContainer(innerContainerRowCol); + containerRowCol.put("00", container00); + + domain.setContainers(containerRowCol); + + Map<String, Domain> originalDomainRowCol = new HashMap<>(); + originalDomainRowCol.put("00", domain); + + layout.setDomainRowCol(domainRowCol); + layout.setCollapsedDomains(originalDomainRowCol); + + layout.uncollapseDomain("XYZ"); + assertEquals(10.6, layout.getDomainRowCol().get("00").getP().getX(), DELTA); + } + + @Test + public void uncollapseDomainNewTest(){ + Layout layout = new Layout(null, 0, 0, 2, 2); + + Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Position position = new Position(); + position.setX(10); + position.setY(10); + domain.setP(position); + Map<String, Domain> domainRowCol = new HashMap<>(); + domainRowCol.put("00", domain); + + Map<String, Container> innerContainerRowCol = new HashMap<>(); + Container innerContainer = new Container("test","test",1,1,10,10,10,10,10,10); + innerContainerRowCol.put("00", innerContainer); + + Map<String, Container> containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + container00.setInnerContainer(innerContainerRowCol); + containerRowCol.put("00", container00); + + domain.setContainers(containerRowCol); + + Map<String, Domain> originalDomainRowCol = new HashMap<>(); + originalDomainRowCol.put("00", domain); + layout.setDomainRowCol(domainRowCol); + layout.collapseDomain("XYZ"); + layout.uncollapseDomainNew("XYZ"); + assertEquals(11.0, layout.getDomainRowCol().get("00").getP().getX(), DELTA); + } + + @Test + public void uncollapseDomainNew1Test(){ + + Layout layout = new Layout(null, 0, 0, 2, 2); + + Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2); + Position position = new Position(); + position.setX(10); + position.setY(10); + domain.setP(position); + Map<String, Domain> domainRowCol = new HashMap<>(); + domainRowCol.put("00", domain); + + Map<String, Container> innerContainerRowCol = new HashMap<>(); + Container innerContainer = new Container("test","test",1,1,10,10,10,10,10,10); + innerContainerRowCol.put("00", innerContainer); + + Map<String, Container> containerRowCol = new HashMap<>(); + Container container00 = new Container("test","test",1,1,10,10,10,10,10,10); + container00.setInnerContainer(innerContainerRowCol); + containerRowCol.put("00", container00); + + domain.setContainers(containerRowCol); + + Map<String, Domain> originalDomainRowCol = new HashMap<>(); + originalDomainRowCol.put("00", domain); + layout.setDomainRowCol(domainRowCol); + layout.collapseDomain("XYZ"); + layout.uncollapseDomainNew1("XYZ"); + assertEquals(11.0, layout.getDomainRowCol().get("00").getP().getX(), DELTA); + + } + +} + diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/NameValueIdTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/NameValueIdTest.java new file mode 100644 index 00000000..84720021 --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/NameValueIdTest.java @@ -0,0 +1,82 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.domain.support; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.DomainVo; +import org.onap.portalsdk.core.domain.support.NameValueId; + +public class NameValueIdTest { + + public NameValueId mockNameValueId(){ + NameValueId nameValueId = new NameValueId("test","test"); + + nameValueId.setLab("test"); + nameValueId.setVal("test"); + + return nameValueId; + } + + @Test + public void nameValueIdTest(){ + NameValueId nameValueId = mockNameValueId(); + + NameValueId nameValueId1 = new NameValueId("test","test"); + nameValueId1.setLab("test"); + nameValueId1.setVal("test"); + + assertEquals(nameValueId.getLab(), nameValueId1.getLab()); + assertEquals(nameValueId.getVal(), nameValueId1.getVal()); + } + + @Test + public void equalsTest(){ + NameValueId nameValueId1 = mockNameValueId(); + NameValueId nameValueId2 = mockNameValueId(); + assertEquals(true, nameValueId1.equals(nameValueId2)); + } + + @Test + public void hashCodeTest(){ + NameValueId nameValueId1 = mockNameValueId(); + assertNotNull(nameValueId1.hashCode()); + } +}
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/PositionTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/PositionTest.java new file mode 100644 index 00000000..e75f1d10 --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/PositionTest.java @@ -0,0 +1,68 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.domain.support; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.Position; + +public class PositionTest { + + private static final double DELTA = 1e-15; + + public Position mockPosition(){ + Position position = new Position(); + position.setX(10); + position.setY(10); + + return position; + } + + @Test + public void positionTest(){ + Position position = mockPosition(); + + Position position1 = new Position(); + position1.setX(10); + position1.setY(10); + + assertEquals(position.getX(), position1.getX(), DELTA); + assertEquals(position.getY(), position1.getY(), DELTA); + } +}
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/SizeTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/SizeTest.java new file mode 100644 index 00000000..3ae57e39 --- /dev/null +++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/SizeTest.java @@ -0,0 +1,69 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.domain.support; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.portalsdk.core.domain.support.Size; + +public class SizeTest { + + private static final double DELTA = 1e-15; + + public Size mockSize(){ + Size size = new Size(); + size.setHeight(10); + size.setWidth(10); + + return size; + } + + @Test + public void sizeTest(){ + Size size = mockSize(); + + Size size1 = new Size(); + size1.setHeight(10); + size1.setWidth(10); + + assertEquals(size.getHeight(), size1.getHeight(), DELTA); + assertEquals(size.getWidth(), size1.getWidth(), DELTA); + } + +}
\ No newline at end of file |