From 32f584718e108c192817863880941bd922c6575b Mon Sep 17 00:00:00 2001 From: "Kishore Reddy, Gujja (kg811t)" Date: Thu, 14 Feb 2019 15:16:30 -0500 Subject: pom, upgrade script changes, AAF role desc fix Issue-ID: PORTAL-356 portal/SDK release 2.5.1, POM, upgrade script Change-Id: If71a1bbbcf31699ed424c86a8fead2e3c704373f Signed-off-by: Kishore Reddy, Gujja (kg811t) --- ecomp-sdk/epsdk-aaf/pom.xml | 4 +- .../authorization/domain/ExternalAccessPerms.java | 12 +- .../authorization/domain/ExternalAccessRole.java | 17 +-- .../domain/ExternalAccessRoleDescription.java | 142 --------------------- .../domain/ExternalAccessPermsTest.java | 12 -- .../domain/ExternalAccessRoleDescriptionTest.java | 74 ----------- .../domain/ExternalAccessRoleTest.java | 10 +- .../domain/ExternalAccessUserRoleDetailTest.java | 10 -- .../util/EcompExternalAuthUtilsTest.java | 14 -- ecomp-sdk/epsdk-analytics/pom.xml | 2 +- ecomp-sdk/epsdk-app-common/pom.xml | 2 +- ecomp-sdk/epsdk-app-os/pom.xml | 2 +- ecomp-sdk/epsdk-app-overlay/pom.xml | 2 +- ecomp-sdk/epsdk-core/pom.xml | 2 +- .../portalsdk/core/service/UserApiServiceImpl.java | 45 ++----- .../core/service/UserApiServiceImplTest.java | 2 +- ecomp-sdk/epsdk-domain/pom.xml | 4 +- ecomp-sdk/epsdk-fw/pom.xml | 4 +- ecomp-sdk/epsdk-logger/pom.xml | 4 +- ecomp-sdk/epsdk-music/pom.xml | 4 +- ecomp-sdk/epsdk-workflow/pom.xml | 2 +- ecomp-sdk/pom.xml | 2 +- 22 files changed, 34 insertions(+), 338 deletions(-) delete mode 100644 ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleDescription.java delete mode 100644 ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleDescriptionTest.java diff --git a/ecomp-sdk/epsdk-aaf/pom.xml b/ecomp-sdk/epsdk-aaf/pom.xml index 0ad8ac69..0ed95f0f 100644 --- a/ecomp-sdk/epsdk-aaf/pom.xml +++ b/ecomp-sdk/epsdk-aaf/pom.xml @@ -7,12 +7,12 @@ org.onap.portal.sdk epsdk-project - 2.5.0 + 2.5.1 org.onap.portal.sdk epsdk-aaf - 2.5.0 + 2.5.1 jar ONAP Portal SDK AAF Authorization diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPerms.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPerms.java index a598a4c4..50496b5b 100644 --- a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPerms.java +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPerms.java @@ -39,7 +39,7 @@ package org.onap.portalsdk.external.authorization.domain; import java.io.Serializable; -public class ExternalAccessPerms implements Serializable, Comparable { +public class ExternalAccessPerms implements Serializable { /** * @@ -122,16 +122,6 @@ public class ExternalAccessPerms implements Serializable, Comparable { this.description = description; } - @Override - public int compareTo(Object obj) { - ExternalAccessPerms other = (ExternalAccessPerms) obj; - - String c1 = getInstance(); - String c2 = other.getInstance(); - - return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); - } - @Override public int hashCode() { final int prime = 31; diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRole.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRole.java index 2c6f3ff7..21c33ed3 100644 --- a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRole.java +++ b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRole.java @@ -46,18 +46,16 @@ public class ExternalAccessRole implements Serializable { public String name; private List perms; - public ExternalAccessRoleDescription description; public ExternalAccessRole() { super(); } - public ExternalAccessRole(String name, List ecPerms, ExternalAccessRoleDescription description) { + public ExternalAccessRole(String name, List ecPerms) { super(); this.name = name; this.perms = ecPerms; - this.description = description; } public String getName() { @@ -76,18 +74,10 @@ public class ExternalAccessRole implements Serializable { this.perms = perms; } - public ExternalAccessRoleDescription getDescription() { - return description; - } - public void setDescription(ExternalAccessRoleDescription description) { - this.description = description; - } - @Override public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((perms == null) ? 0 : perms.hashCode()); return result; @@ -102,11 +92,6 @@ public class ExternalAccessRole implements Serializable { if (getClass() != obj.getClass()) return false; ExternalAccessRole other = (ExternalAccessRole) obj; - if (description == null) { - if (other.description != null) - return false; - } else if (!description.equals(other.description)) - return false; if (name == null) { if (other.name != null) return false; diff --git a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleDescription.java b/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleDescription.java deleted file mode 100644 index e7e18749..00000000 --- a/ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleDescription.java +++ /dev/null @@ -1,142 +0,0 @@ -/*- - * ============LICENSE_START========================================== - * ONAP Portal SDK - * =================================================================== - * Copyright (C) 2017-2018 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============================================ - * - * - */ -package org.onap.portalsdk.external.authorization.domain; - -public class ExternalAccessRoleDescription { - - private String id; - private String name; - private String active; - private String priority; - private String appId; - private String appRoleId; - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getActive() { - return active; - } - public void setActive(String active) { - this.active = active; - } - public String getPriority() { - return priority; - } - public void setPriority(String priority) { - this.priority = priority; - } - public String getAppId() { - return appId; - } - public void setAppId(String appId) { - this.appId = appId; - } - public String getAppRoleId() { - return appRoleId; - } - public void setAppRoleId(String appRoleId) { - this.appRoleId = appRoleId; - } - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((active == null) ? 0 : active.hashCode()); - result = prime * result + ((appId == null) ? 0 : appId.hashCode()); - result = prime * result + ((appRoleId == null) ? 0 : appRoleId.hashCode()); - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((priority == null) ? 0 : priority.hashCode()); - return result; - } - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - ExternalAccessRoleDescription other = (ExternalAccessRoleDescription) obj; - if (active == null) { - if (other.active != null) - return false; - } else if (!active.equals(other.active)) - return false; - if (appId == null) { - if (other.appId != null) - return false; - } else if (!appId.equals(other.appId)) - return false; - if (appRoleId == null) { - if (other.appRoleId != null) - return false; - } else if (!appRoleId.equals(other.appRoleId)) - return false; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) - return false; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - if (priority == null) { - if (other.priority != null) - return false; - } else if (!priority.equals(other.priority)) - return false; - return true; - } - - - - -} diff --git a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPermsTest.java b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPermsTest.java index b118811b..b5645242 100644 --- a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPermsTest.java +++ b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPermsTest.java @@ -86,18 +86,6 @@ public class ExternalAccessPermsTest { .equals(new ExternalAccessPerms("test_type", "test_instance", "*", "test_name"))); } - @Test - public void testCompareTo() - { - ExternalAccessPerms extPermsDetailTest1 = new ExternalAccessPerms("test_type", "test_instance", "*"); - ExternalAccessPerms extPermsDetailTest2 = new ExternalAccessPerms("test_type", "test_instance", "*", - "test_name"); - extPermsDetailTest1.setInstance("test_instance"); - extPermsDetailTest2.setInstance("test_instance"); - int result= extPermsDetailTest1.compareTo(extPermsDetailTest2); - assertEquals(0, result); - } - @Test public void testHashCode() { diff --git a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleDescriptionTest.java b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleDescriptionTest.java deleted file mode 100644 index 9e7970b2..00000000 --- a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleDescriptionTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * ============LICENSE_START========================================== - * ONAP Portal SDK - * =================================================================== - * Copyright (C) 2018 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============================================ - * - * - */ -package org.onap.portalsdk.external.authorization.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -public class ExternalAccessRoleDescriptionTest { - - public ExternalAccessRoleDescription mockExternalRoleDescriptionTest() { - ExternalAccessRoleDescription mockExtRoleDesc = new ExternalAccessRoleDescription(); - mockExtRoleDesc.setActive("true"); - mockExtRoleDesc.setAppRoleId("1"); - mockExtRoleDesc.setAppId("1"); - mockExtRoleDesc.setId("1"); - mockExtRoleDesc.setName("test"); - mockExtRoleDesc.setPriority("1"); - return mockExtRoleDesc; - } - - @Test - public void externalRoleDescriptionTest() { - ExternalAccessRoleDescription extRoleDesc = new ExternalAccessRoleDescription(); - extRoleDesc.setActive("true"); - extRoleDesc.setAppRoleId("1"); - extRoleDesc.setAppId("1"); - extRoleDesc.setId("1"); - extRoleDesc.setName("test"); - extRoleDesc.setPriority("1"); - assertEquals(extRoleDesc.getActive(), mockExternalRoleDescriptionTest().getActive()); - assertEquals(extRoleDesc.getAppId(), mockExternalRoleDescriptionTest().getAppId()); - assertEquals(extRoleDesc.getAppRoleId(), mockExternalRoleDescriptionTest().getAppRoleId()); - assertEquals(extRoleDesc.getId(), mockExternalRoleDescriptionTest().getId()); - assertEquals(extRoleDesc.getName(), mockExternalRoleDescriptionTest().getName()); - assertEquals(extRoleDesc.getPriority(), mockExternalRoleDescriptionTest().getPriority()); - assertEquals(true, extRoleDesc.equals(mockExternalRoleDescriptionTest())); - } -} diff --git a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleTest.java b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleTest.java index 557f5444..c4595a6d 100644 --- a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleTest.java +++ b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleTest.java @@ -56,18 +56,15 @@ public class ExternalAccessRoleTest { public ExternalAccessRole mockExternalAccessRoleTest() { ExternalAccessRole mockRole = new ExternalAccessRole(); - ExternalAccessRoleDescription roleDesc = new ExternalAccessRoleDescription(); + String roleDesc = ""; ExternalAccessPerms ecPerm = new ExternalAccessPerms(); List ecPerms = new ArrayList<>(); ecPerm.setAction("test_action"); ecPerm.setType("test_type"); ecPerm.setInstance("test_instance"); ecPerm.setDescription("test_description"); - roleDesc.setActive("true"); - roleDesc.setAppId("1"); mockRole.setName("test_role"); mockRole.setPerms(ecPerms); - mockRole.setDescription(roleDesc); return mockRole; } @@ -75,8 +72,8 @@ public class ExternalAccessRoleTest { public void setUp() { mockRole = mockExternalAccessRoleTest(); - role = new ExternalAccessRole(mockRole.getName(), mockRole.getPerms(), mockRole.getDescription()); - role1= new ExternalAccessRole(mockRole.getName(), mockRole.getPerms(), mockRole.getDescription());; + role = new ExternalAccessRole(mockRole.getName(), mockRole.getPerms()); + role1= new ExternalAccessRole(mockRole.getName(), mockRole.getPerms()); } @Test @@ -84,7 +81,6 @@ public class ExternalAccessRoleTest { assertEquals(role.getName(), mockExternalAccessRoleTest().getName()); assertEquals(role.getPerms(), mockExternalAccessRoleTest().getPerms()); - assertEquals(role.getDescription(), mockExternalAccessRoleTest().getDescription()); } @Test diff --git a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserRoleDetailTest.java b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserRoleDetailTest.java index f0a0a69e..fd6d5309 100644 --- a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserRoleDetailTest.java +++ b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserRoleDetailTest.java @@ -58,16 +58,7 @@ public class ExternalAccessUserRoleDetailTest { mockExtPermsTest.setType("test_type"); mockExtPermsTest.setInstance("test_instance"); mockPerms.add(mockExtPermsTest); - ExternalAccessRoleDescription mockRoleDesc = new ExternalAccessRoleDescription(); - mockRoleDesc.setActive("true"); - mockRoleDesc.setAppId("1"); - mockRoleDesc.setAppRoleId("1"); - mockRoleDesc.setId("1"); - mockRoleDesc.setPriority("1"); - mockRoleDesc.setName("test"); - mockRoleDesc.setName("com.test.app.rolename"); role.setPerms(mockPerms); - role.setDescription(mockRoleDesc); ExternalAccessUserRoleDetail mockExtUserRoleDetailTest = new ExternalAccessUserRoleDetail(role); return mockExtUserRoleDetailTest; } @@ -78,7 +69,6 @@ public class ExternalAccessUserRoleDetailTest { ExternalAccessRole role = extUserRoleDetailTest2.getRole(); assertEquals(role.getName(), mockExternalAccessUserRoleDetailTest().getRole().getName()); assertEquals(role.getPerms(), mockExternalAccessUserRoleDetailTest().getRole().getPerms()); - assertEquals(role.getDescription(), mockExternalAccessUserRoleDetailTest().getRole().getDescription()); } diff --git a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtilsTest.java b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtilsTest.java index 98260e20..d2f64725 100644 --- a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtilsTest.java +++ b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtilsTest.java @@ -37,9 +37,7 @@ */ package org.onap.portalsdk.external.authorization.util; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import javax.xml.bind.DatatypeConverter; @@ -108,16 +106,4 @@ public class EcompExternalAuthUtilsTest { public void checkNameSpaceMatchingLengthTest() throws Exception { EcompExternalAuthUtils.checkNameSpaceMatching("com.test.app2.role", "com.test.app2.role.test"); } - - @Test - public void isJsonValidTest() { - boolean actual = EcompExternalAuthUtils.isJSONValid("{\"test\":\"test\"}"); - assertTrue(actual); - } - - @Test - public void isJsonValidFailTest() { - boolean actual = EcompExternalAuthUtils.isJSONValid("{\"test\":\"test\""); - assertFalse(actual); - } } diff --git a/ecomp-sdk/epsdk-analytics/pom.xml b/ecomp-sdk/epsdk-analytics/pom.xml index 8832dc63..5e442ac1 100644 --- a/ecomp-sdk/epsdk-analytics/pom.xml +++ b/ecomp-sdk/epsdk-analytics/pom.xml @@ -5,7 +5,7 @@ org.onap.portal.sdk epsdk-project - 2.5.0 + 2.5.1 diff --git a/ecomp-sdk/epsdk-app-common/pom.xml b/ecomp-sdk/epsdk-app-common/pom.xml index 07962283..6ae34ed2 100644 --- a/ecomp-sdk/epsdk-app-common/pom.xml +++ b/ecomp-sdk/epsdk-app-common/pom.xml @@ -5,7 +5,7 @@ org.onap.portal.sdk epsdk-project - 2.5.0 + 2.5.1 diff --git a/ecomp-sdk/epsdk-app-os/pom.xml b/ecomp-sdk/epsdk-app-os/pom.xml index 01ef6c34..5c9dd42a 100644 --- a/ecomp-sdk/epsdk-app-os/pom.xml +++ b/ecomp-sdk/epsdk-app-os/pom.xml @@ -9,7 +9,7 @@ org.onap.portal.sdk epsdk-project - 2.5.0 + 2.5.1 diff --git a/ecomp-sdk/epsdk-app-overlay/pom.xml b/ecomp-sdk/epsdk-app-overlay/pom.xml index a031711e..036df01d 100644 --- a/ecomp-sdk/epsdk-app-overlay/pom.xml +++ b/ecomp-sdk/epsdk-app-overlay/pom.xml @@ -5,7 +5,7 @@ org.onap.portal.sdk epsdk-project - 2.5.0 + 2.5.1 diff --git a/ecomp-sdk/epsdk-core/pom.xml b/ecomp-sdk/epsdk-core/pom.xml index da320242..6990268f 100644 --- a/ecomp-sdk/epsdk-core/pom.xml +++ b/ecomp-sdk/epsdk-core/pom.xml @@ -6,7 +6,7 @@ org.onap.portal.sdk epsdk-project - 2.5.0 + 2.5.1 diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/UserApiServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/UserApiServiceImpl.java index 074419e6..fd05c695 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/UserApiServiceImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/UserApiServiceImpl.java @@ -1,5 +1,4 @@ - /*- * ============LICENSE_START========================================== * ONAP Portal SDK @@ -62,7 +61,6 @@ import org.onap.portalsdk.core.onboarding.util.CipherUtil; import org.onap.portalsdk.core.util.SystemProperties; import org.onap.portalsdk.external.authorization.domain.ExternalAccessPerms; import org.onap.portalsdk.external.authorization.domain.ExternalAccessRole; -import org.onap.portalsdk.external.authorization.domain.ExternalAccessRoleDescription; import org.onap.portalsdk.external.authorization.domain.ExternalAccessUserRoleDetail; import org.onap.portalsdk.external.authorization.exception.UserNotFoundException; import org.onap.portalsdk.external.authorization.service.AAFRestServiceImpl; @@ -85,7 +83,6 @@ import com.fasterxml.jackson.databind.type.TypeFactory; @Service("userApiService") public class UserApiServiceImpl implements UserApiService { - private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UserApiServiceImpl.class); @Autowired @@ -104,8 +101,7 @@ public class UserApiServiceImpl implements UserApiService { @Autowired private AppService appService; - - + private AAFService aafService = new AAFRestServiceImpl(); @Override @@ -114,7 +110,7 @@ public class UserApiServiceImpl implements UserApiService { try { String namespace = EcompExternalAuthProperties .getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_NAMESPACE); - + HttpHeaders headers = getBasicAuthHeaders(); String userRoles = aafService.getUser(orgUserId, request, headers); ObjectMapper mapper = new ObjectMapper(); @@ -148,12 +144,6 @@ public class UserApiServiceImpl implements UserApiService { .endsWith(EcompExternalAuthUtils.EXT_ROLE_FIELD_ADMIN) && !role.getString(EcompExternalAuthUtils.EXT_ROLE_FIELD_NAME) .endsWith(EcompExternalAuthUtils.EXT_ROLE_FIELD_OWNER)) { - ExternalAccessRoleDescription ecDesc = new ExternalAccessRoleDescription(); - if (role.has(EcompExternalAuthUtils.EXT_FIELD_DESCRIPTION) && EcompExternalAuthUtils - .isJSONValid(role.getString(EcompExternalAuthUtils.EXT_FIELD_DESCRIPTION))) { - ecDesc = mapper.readValue(role.getString(EcompExternalAuthUtils.EXT_FIELD_DESCRIPTION), - ExternalAccessRoleDescription.class); - } List ecPerms = new ArrayList<>(); if (role.has(EcompExternalAuthUtils.EXT_FIELD_PERMS)) { JSONArray perms = role.getJSONArray(EcompExternalAuthUtils.EXT_FIELD_PERMS); @@ -161,7 +151,7 @@ public class UserApiServiceImpl implements UserApiService { .constructCollectionType(List.class, ExternalAccessPerms.class)); } ExternalAccessRole ecRole = new ExternalAccessRole( - role.getString(EcompExternalAuthUtils.EXT_ROLE_FIELD_NAME), ecPerms, ecDesc); + role.getString(EcompExternalAuthUtils.EXT_ROLE_FIELD_NAME), ecPerms); userRoleDetail = new ExternalAccessUserRoleDetail(ecRole); userRoleDetailList.add(userRoleDetail); } @@ -203,21 +193,11 @@ public class UserApiServiceImpl implements UserApiService { Set userApps = new TreeSet(); for (ExternalAccessUserRoleDetail userRoleDetail : userRoleDetailList) { ExternalAccessRole ecRole = userRoleDetail.getRole(); - ExternalAccessRoleDescription roleDesc = ecRole.getDescription(); UserApp userApp = new UserApp(); Role role = new Role(); Set roleFunctions = new TreeSet<>(); - if (roleDesc.getName() == null) { - role.setActive(true); - role.setName(ecRole.getName()); - } else { - role.setActive(Boolean.valueOf(roleDesc.getActive())); - role.setId(Long.valueOf(roleDesc.getAppRoleId())); - role.setName(roleDesc.getName()); - if (!roleDesc.getPriority().equals(EcompExternalAuthUtils.EXT_NULL_VALUE)) { - role.setPriority(Integer.valueOf(roleDesc.getPriority())); - } - } + role.setActive(true); + role.setName(ecRole.getName()); for (ExternalAccessPerms extPerm : ecRole.getPerms()) { RoleFunction roleFunction = new RoleFunction(); roleFunction.setCode(extPerm.getInstance()); @@ -252,10 +232,10 @@ public class UserApiServiceImpl implements UserApiService { @Override public List getRoleFunctions(String orgUserId) throws Exception { HttpHeaders headers = getBasicAuthHeaders(); - return aafService.getRoleFunctions(orgUserId,headers); + return aafService.getRoleFunctions(orgUserId, headers); } - + @SuppressWarnings("unused") private ResponseEntity getPermsFromExternalAuthSystem(HttpEntity entity, String endPoint) { ResponseEntity getResponse = template.exchange( EcompExternalAuthProperties.getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_URL) + endPoint, @@ -283,14 +263,13 @@ public class UserApiServiceImpl implements UserApiService { result = CipherUtil.decryptPKC(encrypted, SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger,"decryptedPassword failed", e); + logger.error(EELFLoggerDelegate.errorLogger, "decryptedPassword failed", e); throw e; } } return result; } - - + private SearchResult loadSearchResultData(PostSearchBean searchCriteria) throws NamingException { return ldapService.searchPost(searchCriteria.getUser(), searchCriteria.getSortBy1(), searchCriteria.getSortBy2(), searchCriteria.getSortBy3(), searchCriteria.getPageNo(), @@ -302,15 +281,13 @@ public class UserApiServiceImpl implements UserApiService { String encryptedPass = EcompExternalAuthProperties .getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_PASSWORD); String appPassword = decryptPass(encryptedPass); - return aafService.checkUserExists(username,password, appPassword); + return aafService.checkUserExists(username, password, appPassword); } - - @Override public List getIfUserPermsExists(String username) throws Exception { HttpHeaders headers = getBasicAuthHeaders(); - return aafService.getIfUserPermsExists(username,headers); + return aafService.getIfUserPermsExists(username, headers); } } \ No newline at end of file diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UserApiServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UserApiServiceImplTest.java index 7fa24ad9..0d76b445 100644 --- a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UserApiServiceImplTest.java +++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UserApiServiceImplTest.java @@ -230,7 +230,6 @@ public class UserApiServiceImplTest { userRolesList.add(mockJsonObjectRole4); userRolesList.add(mockJsonObjectRole5); mockJsonObjectFinalUserRole.put("role", userRolesList); - Mockito.when(EcompExternalAuthUtils.isJSONValid(addDesc)).thenReturn(true); ResponseEntity response = new ResponseEntity<>(mockJsonObjectFinalUserRole.toString(), HttpStatus.OK); Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET), Matchers.>any(), Matchers.eq(String.class))).thenReturn(response); @@ -240,6 +239,7 @@ public class UserApiServiceImplTest { String user = mapper.writeValueAsString(userObj()); Mockito.when(aafService.getUser("test123", mockedRequest, headers)).thenReturn(user); User actual = UserApiServiceImpl.getUser("test123", mockedRequest); + assertNull(actual); } @Test diff --git a/ecomp-sdk/epsdk-domain/pom.xml b/ecomp-sdk/epsdk-domain/pom.xml index e3c1e97a..5bf776e0 100644 --- a/ecomp-sdk/epsdk-domain/pom.xml +++ b/ecomp-sdk/epsdk-domain/pom.xml @@ -5,12 +5,12 @@ org.onap.portal.sdk epsdk-project - 2.5.0 + 2.5.1 org.onap.portal.sdk epsdk-domain - 2.5.0 + 2.5.1 jar ONAP Portal SDK Domain diff --git a/ecomp-sdk/epsdk-fw/pom.xml b/ecomp-sdk/epsdk-fw/pom.xml index 151a01ef..019f19b3 100644 --- a/ecomp-sdk/epsdk-fw/pom.xml +++ b/ecomp-sdk/epsdk-fw/pom.xml @@ -6,7 +6,7 @@ org.onap.portal.sdk epsdk-project - 2.5.0 + 2.5.1 @@ -72,7 +72,7 @@ org.onap.portal.sdk epsdk-logger - 2.5.0 + 2.5.1 org.onap.aaf.authz diff --git a/ecomp-sdk/epsdk-logger/pom.xml b/ecomp-sdk/epsdk-logger/pom.xml index 4d07982c..a1f4c152 100644 --- a/ecomp-sdk/epsdk-logger/pom.xml +++ b/ecomp-sdk/epsdk-logger/pom.xml @@ -4,12 +4,12 @@ org.onap.portal.sdk epsdk-project - 2.5.0 + 2.5.1 org.onap.portal.sdk epsdk-logger - 2.5.0 + 2.5.1 diff --git a/ecomp-sdk/epsdk-music/pom.xml b/ecomp-sdk/epsdk-music/pom.xml index 6dc20dcd..86955e5a 100644 --- a/ecomp-sdk/epsdk-music/pom.xml +++ b/ecomp-sdk/epsdk-music/pom.xml @@ -5,12 +5,12 @@ org.onap.portal.sdk epsdk-project - 2.5.0 + 2.5.1 org.onap.portal.sdk epsdk-music - 2.5.0 + 2.5.1 jar ONAP Portal SDK Music diff --git a/ecomp-sdk/epsdk-workflow/pom.xml b/ecomp-sdk/epsdk-workflow/pom.xml index 300ed92d..85905011 100644 --- a/ecomp-sdk/epsdk-workflow/pom.xml +++ b/ecomp-sdk/epsdk-workflow/pom.xml @@ -5,7 +5,7 @@ org.onap.portal.sdk epsdk-project - 2.5.0 + 2.5.1 diff --git a/ecomp-sdk/pom.xml b/ecomp-sdk/pom.xml index 178e7894..d298b7b7 100644 --- a/ecomp-sdk/pom.xml +++ b/ecomp-sdk/pom.xml @@ -13,7 +13,7 @@ org.onap.portal.sdk epsdk-project - 2.5.0 + 2.5.1 pom portal-sdk https://wiki.onap.org/display/DW/Portal -- cgit 1.2.3-korg