summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-aaf/src/test/java
diff options
context:
space:
mode:
authorKishore Reddy, Gujja (kg811t) <kg811t@research.att.com>2018-08-15 08:39:30 -0400
committerKishore Reddy, Gujja (kg811t) <kg811t@research.att.com>2018-08-15 11:21:38 -0400
commitecfe375994b7561d37a07f8879740b1c85f260a2 (patch)
tree2876499d2adeecea4af8641662722a3a3627338d /ecomp-sdk/epsdk-aaf/src/test/java
parent2e2ec498ce80d674c08ef8909adb5e1138b710bd (diff)
Modified User Auth and permission aaf services
Issue-ID: PORTAL-334 Change-Id: I461fd5a61879434e9c105c7598e9948004a5f608 Signed-off-by: Kishore Reddy, Gujja (kg811t) <kg811t@research.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-aaf/src/test/java')
-rw-r--r--ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleDescriptionTest.java (renamed from ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalRoleDescriptionTest.java)28
-rw-r--r--ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRolePermsTest.java68
-rw-r--r--ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleTest.java19
-rw-r--r--ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserRoleDetailTest.java42
4 files changed, 33 insertions, 124 deletions
diff --git a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalRoleDescriptionTest.java b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleDescriptionTest.java
index 251f8303..9e7970b2 100644
--- a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalRoleDescriptionTest.java
+++ b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleDescriptionTest.java
@@ -39,48 +39,29 @@ package org.onap.portalsdk.external.authorization.domain;
import static org.junit.Assert.assertEquals;
-import java.util.ArrayList;
-import java.util.List;
-
import org.junit.Test;
-public class ExternalRoleDescriptionTest {
+public class ExternalAccessRoleDescriptionTest {
- public ExternalRoleDescription mockExternalRoleDescriptionTest() {
- List<ExternalAccessPerms> mockPerms = new ArrayList<>();
- ExternalAccessPerms mockExtPermsTest = new ExternalAccessPerms();
- mockExtPermsTest.setAction("*");
- mockExtPermsTest.setDescription("test_name");
- mockExtPermsTest.setType("test_type");
- mockExtPermsTest.setInstance("test_instance");
- mockPerms.add(mockExtPermsTest);
- ExternalRoleDescription mockExtRoleDesc = new ExternalRoleDescription();
+ public ExternalAccessRoleDescription mockExternalRoleDescriptionTest() {
+ ExternalAccessRoleDescription mockExtRoleDesc = new ExternalAccessRoleDescription();
mockExtRoleDesc.setActive("true");
mockExtRoleDesc.setAppRoleId("1");
mockExtRoleDesc.setAppId("1");
mockExtRoleDesc.setId("1");
mockExtRoleDesc.setName("test");
- mockExtRoleDesc.setPermissions(mockPerms);
mockExtRoleDesc.setPriority("1");
return mockExtRoleDesc;
}
@Test
public void externalRoleDescriptionTest() {
- List<ExternalAccessPerms> perms = new ArrayList<>();
- ExternalAccessPerms extPermsTest = new ExternalAccessPerms();
- extPermsTest.setAction("*");
- extPermsTest.setDescription("test_name");
- extPermsTest.setType("test_type");
- extPermsTest.setInstance("test_instance");
- perms.add(extPermsTest);
- ExternalRoleDescription extRoleDesc = new ExternalRoleDescription();
+ ExternalAccessRoleDescription extRoleDesc = new ExternalAccessRoleDescription();
extRoleDesc.setActive("true");
extRoleDesc.setAppRoleId("1");
extRoleDesc.setAppId("1");
extRoleDesc.setId("1");
extRoleDesc.setName("test");
- extRoleDesc.setPermissions(perms);
extRoleDesc.setPriority("1");
assertEquals(extRoleDesc.getActive(), mockExternalRoleDescriptionTest().getActive());
assertEquals(extRoleDesc.getAppId(), mockExternalRoleDescriptionTest().getAppId());
@@ -88,7 +69,6 @@ public class ExternalRoleDescriptionTest {
assertEquals(extRoleDesc.getId(), mockExternalRoleDescriptionTest().getId());
assertEquals(extRoleDesc.getName(), mockExternalRoleDescriptionTest().getName());
assertEquals(extRoleDesc.getPriority(), mockExternalRoleDescriptionTest().getPriority());
- assertEquals(extRoleDesc.getPermissions(), mockExternalRoleDescriptionTest().getPermissions());
assertEquals(true, extRoleDesc.equals(mockExternalRoleDescriptionTest()));
}
}
diff --git a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRolePermsTest.java b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRolePermsTest.java
deleted file mode 100644
index acb14c65..00000000
--- a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRolePermsTest.java
+++ /dev/null
@@ -1,68 +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 ExternalAccessRolePermsTest {
-
- public ExternalAccessRolePerms mockExternalAccessRolePermsTest() {
- ExternalAccessPerms mockPerm = new ExternalAccessPerms();
- mockPerm.setAction("*");
- mockPerm.setDescription("test_name");
- mockPerm.setType("test_type");
- mockPerm.setInstance("test_instance");
- ExternalAccessRolePerms mockExtRolePermsTest = new ExternalAccessRolePerms(mockPerm, "test_role");
- return mockExtRolePermsTest;
- }
-
- @Test
- public void externalAccessRolePermsTest() {
- ExternalAccessPerms perm = new ExternalAccessPerms();
- perm.setAction("*");
- perm.setDescription("test_name");
- perm.setType("test_type");
- perm.setInstance("test_instance");
- ExternalAccessRolePerms mockExtRolePermsTest = new ExternalAccessRolePerms(perm, "test_role");
- assertEquals(mockExtRolePermsTest.getRole(), mockExternalAccessRolePermsTest().getRole());
- assertEquals(mockExtRolePermsTest.getPerm(), mockExternalAccessRolePermsTest().getPerm());
- }
-
-}
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 aa498aa0..3fc5ae86 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
@@ -39,21 +39,36 @@ package org.onap.portalsdk.external.authorization.domain;
import static org.junit.Assert.assertEquals;
+import java.util.ArrayList;
+import java.util.List;
+
import org.junit.Test;
public class ExternalAccessRoleTest {
public ExternalAccessRole mockExternalAccessRoleTest() {
ExternalAccessRole mockRole = new ExternalAccessRole();
+ ExternalAccessRoleDescription roleDesc = new ExternalAccessRoleDescription();
+ ExternalAccessPerms ecPerm = new ExternalAccessPerms();
+ List<ExternalAccessPerms> 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.setDescription("test_role_description");
+ mockRole.setPerms(ecPerms);
+ mockRole.setDescription(roleDesc);
return mockRole;
}
@Test
public void externalAccessRolePermsTest() {
- ExternalAccessRole role = new ExternalAccessRole("test_role", "test_role_description");
+ ExternalAccessRole mockRole = mockExternalAccessRoleTest();
+ ExternalAccessRole role = new ExternalAccessRole(mockRole.getName(), mockRole.getPerms(), mockRole.getDescription());
assertEquals(role.getName(), mockExternalAccessRoleTest().getName());
+ assertEquals(role.getPerms(), mockExternalAccessRoleTest().getPerms());
assertEquals(role.getDescription(), mockExternalAccessRoleTest().getDescription());
}
}
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 5e750543..9d20e02c 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
@@ -47,6 +47,7 @@ import org.junit.Test;
public class ExternalAccessUserRoleDetailTest {
public ExternalAccessUserRoleDetail mockExternalAccessUserRoleDetailTest() {
+ ExternalAccessRole role = new ExternalAccessRole();
List<ExternalAccessPerms> mockPerms = new ArrayList<>();
ExternalAccessPerms mockExtPermsTest = new ExternalAccessPerms();
mockExtPermsTest.setAction("*");
@@ -54,46 +55,27 @@ public class ExternalAccessUserRoleDetailTest {
mockExtPermsTest.setType("test_type");
mockExtPermsTest.setInstance("test_instance");
mockPerms.add(mockExtPermsTest);
- ExternalRoleDescription mockRoleDesc = new ExternalRoleDescription();
+ ExternalAccessRoleDescription mockRoleDesc = new ExternalAccessRoleDescription();
mockRoleDesc.setActive("true");
mockRoleDesc.setAppId("1");
mockRoleDesc.setAppRoleId("1");
mockRoleDesc.setId("1");
mockRoleDesc.setPriority("1");
mockRoleDesc.setName("test");
- mockRoleDesc.setPermissions(mockPerms);
- ExternalAccessUserRoleDetail mockExtUserRoleDetailTest = new ExternalAccessUserRoleDetail();
- mockExtUserRoleDetailTest.setName("test");
- mockExtUserRoleDetailTest.setDescription(mockRoleDesc);
+ mockRoleDesc.setName("com.test.app.rolename");
+ role.setPerms(mockPerms);
+ role.setDescription(mockRoleDesc);
+ ExternalAccessUserRoleDetail mockExtUserRoleDetailTest = new ExternalAccessUserRoleDetail(role);
return mockExtUserRoleDetailTest;
}
@Test
public void externalAccessPermsTest() {
- List<ExternalAccessPerms> perms = new ArrayList<>();
- ExternalAccessPerms extPermsTest = new ExternalAccessPerms();
- extPermsTest.setAction("*");
- extPermsTest.setDescription("test_name");
- extPermsTest.setType("test_type");
- extPermsTest.setInstance("test_instance");
- perms.add(extPermsTest);
- ExternalRoleDescription roleDesc = new ExternalRoleDescription();
- roleDesc.setActive("true");
- roleDesc.setAppId("1");
- roleDesc.setAppRoleId("1");
- roleDesc.setId("1");
- roleDesc.setPriority("1");
- roleDesc.setName("test");
- roleDesc.setPermissions(perms);
- ExternalAccessUserRoleDetail extUserRoleDetailTest = new ExternalAccessUserRoleDetail();
- extUserRoleDetailTest.setName("test");
- extUserRoleDetailTest.setDescription(roleDesc);
- ExternalAccessUserRoleDetail extUserRoleDetailTest2 = new ExternalAccessUserRoleDetail("test", roleDesc);
- assertEquals(extUserRoleDetailTest.getName(), mockExternalAccessUserRoleDetailTest().getName());
- assertEquals(extUserRoleDetailTest.getDescription(), mockExternalAccessUserRoleDetailTest().getDescription());
- assertEquals(extUserRoleDetailTest2.getName(), mockExternalAccessUserRoleDetailTest().getName());
- assertEquals(extUserRoleDetailTest2.getDescription(), mockExternalAccessUserRoleDetailTest().getDescription());
- assertEquals(true, new ExternalAccessUserRoleDetail("test",roleDesc)
- .equals(new ExternalAccessUserRoleDetail("test",roleDesc)));
+ ExternalAccessUserRoleDetail extUserRoleDetailTest2 = mockExternalAccessUserRoleDetailTest();
+ ExternalAccessRole role = extUserRoleDetailTest2.getRole();
+ assertEquals(role.getName(), mockExternalAccessUserRoleDetailTest().getRole().getName());
+ assertEquals(role.getPerms(), mockExternalAccessUserRoleDetailTest().getRole().getPerms());
+ assertEquals(role.getDescription(), mockExternalAccessUserRoleDetailTest().getRole().getDescription());
+
}
}