summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-aaf/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-aaf/src/test')
-rw-r--r--ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPermsTest.java99
-rw-r--r--ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleTest.java75
-rw-r--r--ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserRoleDetailTest.java91
3 files changed, 174 insertions, 91 deletions
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 0f3a65a5..b118811b 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
@@ -4,7 +4,8 @@
* ===================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ===================================================================
- *
+ * Modifications Copyright (C) 2018 IBM.
+ * ===================================================================
* 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.
@@ -38,6 +39,7 @@
package org.onap.portalsdk.external.authorization.domain;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
@@ -46,41 +48,64 @@ import org.junit.Test;
public class ExternalAccessPermsTest {
- public ExternalAccessPerms mockExternalAccessPermsTest() {
- ExternalAccessPerms mockExtPermsTest = new ExternalAccessPerms();
- mockExtPermsTest.setAction("*");
- mockExtPermsTest.setDescription("test_name");
- mockExtPermsTest.setType("test_type");
- mockExtPermsTest.setInstance("test_instance");
- return mockExtPermsTest;
- }
+ public ExternalAccessPerms mockExternalAccessPermsTest() {
+ ExternalAccessPerms mockExtPermsTest = new ExternalAccessPerms();
+ mockExtPermsTest.setAction("*");
+ mockExtPermsTest.setDescription("test_name");
+ mockExtPermsTest.setType("test_type");
+ mockExtPermsTest.setInstance("test_instance");
+ return mockExtPermsTest;
+ }
- @Test
- public void externalAccessPermsTest() {
- List<String> roles = new ArrayList<>();
- roles.add("test_role");
- roles.add("test_role2");
- ExternalAccessPerms extPermsDetailTest = new ExternalAccessPerms();
- ExternalAccessPerms extPermsDetailTest2 = new ExternalAccessPerms("test_type", "test_instance", "*");
- ExternalAccessPerms extPermsDetailTest3 = new ExternalAccessPerms("test_type", "test_instance", "*",
- "test_name");
- extPermsDetailTest.setAction("*");
- extPermsDetailTest.setDescription("test_name");
- extPermsDetailTest.setType("test_type");
- extPermsDetailTest.setInstance("test_instance");
- assertEquals(extPermsDetailTest.getAction(), mockExternalAccessPermsTest().getAction());
- assertEquals(extPermsDetailTest.getType(), mockExternalAccessPermsTest().getType());
- assertEquals(extPermsDetailTest.getInstance(), mockExternalAccessPermsTest().getInstance());
- assertEquals(extPermsDetailTest.getDescription(), mockExternalAccessPermsTest().getDescription());
- assertEquals(extPermsDetailTest2.getAction(), mockExternalAccessPermsTest().getAction());
- assertEquals(extPermsDetailTest2.getType(), mockExternalAccessPermsTest().getType());
- assertEquals(extPermsDetailTest2.getInstance(), mockExternalAccessPermsTest().getInstance());
- assertEquals(null, extPermsDetailTest2.getDescription());
- assertEquals(extPermsDetailTest3.getAction(), mockExternalAccessPermsTest().getAction());
- assertEquals(extPermsDetailTest3.getType(), mockExternalAccessPermsTest().getType());
- assertEquals(extPermsDetailTest3.getInstance(), mockExternalAccessPermsTest().getInstance());
- assertEquals(extPermsDetailTest3.getDescription(), mockExternalAccessPermsTest().getDescription());
- assertEquals(true, new ExternalAccessPerms("test_type", "test_instance", "*", "test_name")
- .equals(new ExternalAccessPerms("test_type", "test_instance", "*", "test_name")));
- }
+ @Test
+ public void externalAccessPermsTest() {
+ List<String> roles = new ArrayList<>();
+ roles.add("test_role");
+ roles.add("test_role2");
+ ExternalAccessPerms extPermsDetailTest = new ExternalAccessPerms();
+ ExternalAccessPerms extPermsDetailTest2 = new ExternalAccessPerms("test_type", "test_instance", "*");
+ ExternalAccessPerms extPermsDetailTest3 = new ExternalAccessPerms("test_type", "test_instance", "*",
+ "test_name");
+ extPermsDetailTest.setAction("*");
+ extPermsDetailTest.setDescription("test_name");
+ extPermsDetailTest.setType("test_type");
+ extPermsDetailTest.setInstance("test_instance");
+ assertEquals(extPermsDetailTest.getAction(), mockExternalAccessPermsTest().getAction());
+ assertEquals(extPermsDetailTest.getType(), mockExternalAccessPermsTest().getType());
+ assertEquals(extPermsDetailTest.getInstance(), mockExternalAccessPermsTest().getInstance());
+ assertEquals(extPermsDetailTest.getDescription(), mockExternalAccessPermsTest().getDescription());
+ assertEquals(extPermsDetailTest2.getAction(), mockExternalAccessPermsTest().getAction());
+ assertEquals(extPermsDetailTest2.getType(), mockExternalAccessPermsTest().getType());
+ assertEquals(extPermsDetailTest2.getInstance(), mockExternalAccessPermsTest().getInstance());
+ assertEquals(null, extPermsDetailTest2.getDescription());
+ assertEquals(extPermsDetailTest3.getAction(), mockExternalAccessPermsTest().getAction());
+ assertEquals(extPermsDetailTest3.getType(), mockExternalAccessPermsTest().getType());
+ assertEquals(extPermsDetailTest3.getInstance(), mockExternalAccessPermsTest().getInstance());
+ assertEquals(extPermsDetailTest3.getDescription(), mockExternalAccessPermsTest().getDescription());
+ assertEquals(true, new ExternalAccessPerms("test_type", "test_instance", "*", "test_name")
+ .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()
+ {
+ ExternalAccessPerms extPermsDetailTest = new ExternalAccessPerms();
+ extPermsDetailTest.setAction("*");
+ extPermsDetailTest.setDescription("test_name");
+ extPermsDetailTest.setType("test_type");
+ extPermsDetailTest.setInstance("test_instance");
+ assertTrue((Integer)extPermsDetailTest.hashCode() instanceof Integer);
+ }
}
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 3fc5ae86..557f5444 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
@@ -4,6 +4,8 @@
* ===================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ===================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
* under the Apache License, Version 2.0 (the "License");
@@ -38,37 +40,62 @@
package org.onap.portalsdk.external.authorization.domain;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
+import org.junit.Before;
import org.junit.Test;
public class ExternalAccessRoleTest {
+
+ private ExternalAccessRole mockRole;
+ private ExternalAccessRole role;
+ private ExternalAccessRole role1;
- 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.setPerms(ecPerms);
- mockRole.setDescription(roleDesc);
- return mockRole;
- }
+ 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.setPerms(ecPerms);
+ mockRole.setDescription(roleDesc);
+ return mockRole;
+ }
+
+ @Before
+ public void setUp()
+ {
+ mockRole = mockExternalAccessRoleTest();
+ role = new ExternalAccessRole(mockRole.getName(), mockRole.getPerms(), mockRole.getDescription());
+ role1= new ExternalAccessRole(mockRole.getName(), mockRole.getPerms(), mockRole.getDescription());;
+ }
- @Test
- public void externalAccessRolePermsTest() {
- 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());
- }
+ @Test
+ public void externalAccessRolePermsTest() {
+
+ assertEquals(role.getName(), mockExternalAccessRoleTest().getName());
+ assertEquals(role.getPerms(), mockExternalAccessRoleTest().getPerms());
+ assertEquals(role.getDescription(), mockExternalAccessRoleTest().getDescription());
+ }
+
+ @Test
+ public void testEquals() {
+
+ assertTrue(role.equals(role1));
+ }
+
+ @Test
+ public void testHashCode () {
+ assertTrue((Integer)role.hashCode() instanceof Integer);
+
+ }
}
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 9d20e02c..f0a0a69e 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
@@ -4,6 +4,8 @@
* ===================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ===================================================================
+ * Modifications Copyright (C) 2018 IBM
+ * ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
* under the Apache License, Version 2.0 (the "License");
@@ -38,6 +40,7 @@
package org.onap.portalsdk.external.authorization.domain;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
@@ -46,36 +49,64 @@ 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("*");
- mockExtPermsTest.setDescription("test_name");
- 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;
- }
+ public ExternalAccessUserRoleDetail mockExternalAccessUserRoleDetailTest() {
+ ExternalAccessRole role = new ExternalAccessRole();
+ 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);
+ 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;
+ }
- @Test
- public void externalAccessPermsTest() {
- 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());
+ @Test
+ public void externalAccessPermsTest() {
+ 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());
- }
+ }
+
+ @Test
+ public void testGetSetRole() {
+ ExternalAccessUserRoleDetail externalAccessUserRoleDetail= new ExternalAccessUserRoleDetail();
+ ExternalAccessRole role = new ExternalAccessRole();
+ externalAccessUserRoleDetail.setRole(role);
+ assertEquals(role, externalAccessUserRoleDetail.getRole());
+ }
+
+ @Test
+ public void testhashCode() {
+ ExternalAccessUserRoleDetail externalAccessUserRoleDetail= new ExternalAccessUserRoleDetail();
+ ExternalAccessRole role = new ExternalAccessRole();
+ externalAccessUserRoleDetail.setRole(role);
+ assertTrue((Integer)(externalAccessUserRoleDetail.hashCode()) instanceof Integer);
+
+ }
+
+ @Test
+ public void testEquals() {
+ ExternalAccessUserRoleDetail externalAccessUserRoleDetail= new ExternalAccessUserRoleDetail();
+ ExternalAccessUserRoleDetail externalAccessUserRoleDetail1= new ExternalAccessUserRoleDetail();
+ ExternalAccessRole role = new ExternalAccessRole();
+ externalAccessUserRoleDetail.setRole(role);
+ externalAccessUserRoleDetail1.setRole(role);
+ assertTrue(externalAccessUserRoleDetail.equals(externalAccessUserRoleDetail1));
+
+ }
}