diff options
Diffstat (limited to 'ecomp-sdk/epsdk-fw')
3 files changed, 161 insertions, 125 deletions
diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/CipherUtil.java b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/CipherUtil.java index c92efb79..90addfe5 100644 --- a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/CipherUtil.java +++ b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/CipherUtil.java @@ -2,7 +2,7 @@ * ============LICENSE_START========================================== * ONAP Portal SDK * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed @@ -208,7 +208,7 @@ public class CipherUtil { * Decrypts the text using the secret key in key.properties file. * * @param message - * The encrypted string that must be decrypted using the ecomp + * The encrypted string that must be decrypted using the ONAP Portal * Encryption Key * @return The String decrypted * @throws CipherUtilException diff --git a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/DomainTest.java b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/DomainTest.java index 45145e43..a212e4fa 100644 --- a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/DomainTest.java +++ b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/DomainTest.java @@ -4,6 +4,8 @@ * =================================================================== * Copyright © 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== + * Modifications Copyright © 2018 IBM. + * =================================================================== * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); @@ -39,6 +41,7 @@ package org.onap.portalsdk.fw.test; import java.util.HashSet; +import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -52,118 +55,132 @@ import org.onap.portalsdk.core.restful.domain.SharedContext; public class DomainTest extends AbstractModelTest { - private final Log logger = LogFactory.getLog(DomainTest.class); + private final Log logger = LogFactory.getLog(DomainTest.class); - @Test - public void testPortalAPIResponse() { - PortalAPIResponse m = new PortalAPIResponse(true, s1); - Assert.assertEquals("ok", m.getStatus()); - Assert.assertEquals(s1, m.getMessage()); - logger.info(m.toString()); - } + @Test + public void testPortalAPIResponse() { + PortalAPIResponse m = new PortalAPIResponse(true, s1); + Assert.assertEquals("ok", m.getStatus()); + Assert.assertEquals(s1, m.getMessage()); + logger.info(m.toString()); + } - @Test - public void testEcompRole() { - EcompRole m = new EcompRole(); - m.setId(l1); - m.setName(s1); - Assert.assertEquals(l1, m.getId()); - Assert.assertEquals(s1, m.getName()); - Assert.assertTrue(m.equals(m)); - Assert.assertFalse(m.equals(new EcompRole())); - Assert.assertNotNull(m.hashCode()); - logger.info(m.toString()); - } + @Test + public void testEcompRole() { + EcompRole m = new EcompRole(); + EcompRole m1 = new EcompRole(); + m1.setId(l1); + m.setId(l1); + m.setName(s1); + Set roleFunctions = new HashSet(); + m.setRoleFunctions(roleFunctions); + Assert.assertEquals(roleFunctions, m.getRoleFunctions()); + Assert.assertEquals(l1, m.getId()); + Assert.assertEquals(s1, m.getName()); + Assert.assertTrue(m.equals(m)); + Assert.assertFalse(m.equals(new EcompRole())); + Assert.assertNotNull(m.hashCode()); + Assert.assertEquals(0, m.compareTo(m1)); + logger.info(m.toString()); + } - @Test - public void testEcompUser() { - EcompUser m = new EcompUser(); - m.setActive(false); - m.setEmail(s1); - m.setFirstName(s2); - m.setHrid(s3); - m.setJobTitle(s4); - m.setLastName(s5); - m.setLoginId(s6); - m.setManagerId(s7); - m.setMiddleInitial(s8); - m.setOrgCode(s9); - m.setOrgId(l1); - m.setOrgManagerUserId(s10); - // Start over at 1, but double - m.setOrgUserId(s1 + s1); - m.setPhone(s2 + s2); - EcompRole r = new EcompRole(); - HashSet<EcompRole> roles = new HashSet<>(); - roles.add(r); - m.setRoles(roles); - Assert.assertEquals(false, m.isActive()); - Assert.assertEquals(s1, m.getEmail()); - Assert.assertEquals(s2, m.getFirstName()); - Assert.assertEquals(s3, m.getHrid()); - Assert.assertEquals(s4, m.getJobTitle()); - Assert.assertEquals(s5, m.getLastName()); - Assert.assertEquals(s6, m.getLoginId()); - Assert.assertEquals(s7, m.getManagerId()); - Assert.assertEquals(s8, m.getMiddleInitial()); - Assert.assertEquals(s9, m.getOrgCode()); - Assert.assertEquals(l1, m.getOrgId()); - Assert.assertEquals(s10, m.getOrgManagerUserId()); - Assert.assertEquals(s1 + s1, m.getOrgUserId()); - Assert.assertEquals(s2 + s2, m.getPhone()); - // this is weak - Assert.assertEquals(roles, m.getRoles()); - Assert.assertTrue(m.equals(m)); - Assert.assertFalse(m.equals(null)); - Assert.assertFalse(m.equals(new EcompUser())); - Assert.assertNotNull(m.hashCode()); - logger.info(m.toString()); - } + @Test + public void testEcompUser() { + EcompUser m = new EcompUser(); + EcompUser m1 = new EcompUser(); + m1.setLoginId(s6); + m.setActive(false); + m.setEmail(s1); + m.setFirstName(s2); + m.setHrid(s3); + m.setJobTitle(s4); + m.setLastName(s5); + m.setLoginId(s6); + m.setManagerId(s7); + m.setMiddleInitial(s8); + m.setOrgCode(s9); + m.setOrgId(l1); + m.setOrgManagerUserId(s10); + // Start over at 1, but double + m.setOrgUserId(s1 + s1); + m.setPhone(s2 + s2); + EcompRole r = new EcompRole(); + HashSet<EcompRole> roles = new HashSet<>(); + roles.add(r); + m.setRoles(roles); + Assert.assertEquals(false, m.isActive()); + Assert.assertEquals(s1, m.getEmail()); + Assert.assertEquals(s2, m.getFirstName()); + Assert.assertEquals(s3, m.getHrid()); + Assert.assertEquals(s4, m.getJobTitle()); + Assert.assertEquals(s5, m.getLastName()); + Assert.assertEquals(s6, m.getLoginId()); + Assert.assertEquals(s7, m.getManagerId()); + Assert.assertEquals(s8, m.getMiddleInitial()); + Assert.assertEquals(s9, m.getOrgCode()); + Assert.assertEquals(l1, m.getOrgId()); + Assert.assertEquals(s10, m.getOrgManagerUserId()); + Assert.assertEquals(s1 + s1, m.getOrgUserId()); + Assert.assertEquals(s2 + s2, m.getPhone()); + // this is weak + Assert.assertEquals(roles, m.getRoles()); + Assert.assertTrue(m.equals(m)); + Assert.assertFalse(m.equals(null)); + Assert.assertFalse(m.equals(new EcompUser())); + Assert.assertNotNull(m.hashCode()); + Assert.assertEquals(0, m.compareTo(m1)); + logger.info(m.toString()); + } - @Test - public void testPortalTimeoutVO() { - PortalTimeoutVO m = new PortalTimeoutVO(); - m.setjSessionId(s1); - m.setSessionTimOutMilliSec(l1); - Assert.assertEquals(s1, m.getjSessionId()); - Assert.assertEquals(l1, m.getSessionTimOutMilliSec()); - Assert.assertTrue(m.equals(m)); - Assert.assertFalse(m.equals(null)); - Assert.assertFalse(m.equals(new PortalTimeoutVO())); - } + @Test + public void testPortalTimeoutVO() { + PortalTimeoutVO m = new PortalTimeoutVO(); + PortalTimeoutVO m1 = new PortalTimeoutVO(); + m1.setSessionTimOutMilliSec(l1); + m.setjSessionId(s1); + m.setSessionTimOutMilliSec(l1); + Assert.assertEquals(s1, m.getjSessionId()); + Assert.assertEquals(l1, m.getSessionTimOutMilliSec()); + Assert.assertTrue(m.equals(m)); + Assert.assertFalse(m.equals(null)); + Assert.assertFalse(m.equals(new PortalTimeoutVO())); + Assert.assertEquals(0, m.compareTo(m1)); + } - @Test - public void testSharedContext() { - SharedContext m = new SharedContext(); - m.setAuditTrail(s1); - m.setAuditUserId(s2); - m.setCkey(s3); - m.setContext_id(s4); - m.setCreate_time(l1); - m.setCreated(s5); - m.setCreatedId(s6); - m.setCvalue(s7); - m.setId(l2); - m.setModified(s8); - m.setModifiedId(s9); - m.setResponse(s10); - m.setRowNum(s1 + s1); - Assert.assertEquals(s1, m.getAuditTrail()); - Assert.assertEquals(s2, m.getAuditUserId()); - Assert.assertEquals(s3, m.getCkey()); - Assert.assertEquals(s4, m.getContext_id()); - Assert.assertEquals(l1, m.getCreate_time()); - Assert.assertEquals(s5, m.getCreated()); - Assert.assertEquals(s6, m.getCreatedId()); - Assert.assertEquals(s7, m.getCvalue()); - Assert.assertEquals(l2, m.getId()); - Assert.assertEquals(s8, m.getModified()); - Assert.assertEquals(s9, m.getModifiedId()); - Assert.assertEquals(s10, m.getResponse()); - Assert.assertEquals(s1 + s1, m.getRowNum()); - Assert.assertTrue(m.equals(m)); - Assert.assertFalse(m.equals(null)); - Assert.assertFalse(m.equals(new SharedContext())); - } + @Test + public void testSharedContext() { + SharedContext m = new SharedContext(); + m.setAuditTrail(s1); + m.setAuditUserId(s2); + m.setCkey(s3); + m.setContext_id(s4); + m.setCreate_time(l1); + m.setCreated(s5); + m.setCreatedId(s6); + m.setCvalue(s7); + m.setId(l2); + m.setModified(s8); + m.setModifiedId(s9); + m.setResponse(s10); + m.setRowNum(s1 + s1); + Assert.assertEquals(s1, m.getAuditTrail()); + Assert.assertEquals(s2, m.getAuditUserId()); + Assert.assertEquals(s3, m.getCkey()); + Assert.assertEquals(s4, m.getContext_id()); + Assert.assertEquals(l1, m.getCreate_time()); + Assert.assertEquals(s5, m.getCreated()); + Assert.assertEquals(s6, m.getCreatedId()); + Assert.assertEquals(s7, m.getCvalue()); + Assert.assertEquals(l2, m.getId()); + Assert.assertEquals(s8, m.getModified()); + Assert.assertEquals(s9, m.getModifiedId()); + Assert.assertEquals(s10, m.getResponse()); + Assert.assertEquals(s1 + s1, m.getRowNum()); + Assert.assertTrue(m.equals(m)); + Assert.assertFalse(m.equals(null)); + Assert.assertFalse(m.equals(new SharedContext())); + Assert.assertTrue(m.toString() instanceof String); + Assert.assertTrue((Integer) m.hashCode() instanceof Integer); + } } diff --git a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/InMemoryRestServer.java b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/InMemoryRestServer.java index 2c37e214..3877ae20 100644 --- a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/InMemoryRestServer.java +++ b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/InMemoryRestServer.java @@ -1,20 +1,39 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. +/* + * ============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 - * - * https://github.com/mp911de/rest-api-test - * - * Embedded InMemory REST server for RESTEasy. Usage: - * <ul> - * <li>InMemoryRestServer srv = InMemoryRestServer.create(...) passing your resources and provider classes</li> - * <li>srv.baseUri() for BaseUrl</li> - * <li>srv.newRequest("/relative/resource/path") to issue requests</li> - * <li>srv.close() to stop</li> - * </ul> * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * */ package org.onap.portalsdk.fw.test; |