diff options
Diffstat (limited to 'ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain')
8 files changed, 620 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPermsDetailTest.java b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPermsDetailTest.java new file mode 100644 index 00000000..43dcc827 --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPermsDetailTest.java @@ -0,0 +1,94 @@ +/*- + * ============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 java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +public class ExternalAccessPermsDetailTest { + + public ExternalAccessPermsDetail mockExternalAccessPermsDetailTest() { + List<String> roles = new ArrayList<>(); + roles.add("test_role"); + roles.add("test_role2"); + ExternalAccessPermsDetail mockExtPermsDetailTest = new ExternalAccessPermsDetail(); + mockExtPermsDetailTest.setAction("*"); + mockExtPermsDetailTest.setDescription("test_name"); + mockExtPermsDetailTest.setType("test_type"); + mockExtPermsDetailTest.setInstance("test_instance"); + mockExtPermsDetailTest.setRoles(roles); + return mockExtPermsDetailTest; + } + + @Test + public void externalAccessPermsDetailTest() { + List<String> roles = new ArrayList<>(); + roles.add("test_role"); + roles.add("test_role2"); + ExternalAccessPermsDetail extPermsDetailTest = new ExternalAccessPermsDetail(); + ExternalAccessPermsDetail extPermsDetailTest2 = new ExternalAccessPermsDetail("test_type", "test_instance", "*", + "test_name"); + ExternalAccessPermsDetail extPermsDetailTest3 = new ExternalAccessPermsDetail("test_type", "test_instance", "*", + roles, "test_name"); + extPermsDetailTest.setAction("*"); + extPermsDetailTest.setDescription("test_name"); + extPermsDetailTest.setType("test_type"); + extPermsDetailTest.setInstance("test_instance"); + extPermsDetailTest.setRoles(roles); + assertEquals(extPermsDetailTest.getAction(), mockExternalAccessPermsDetailTest().getAction()); + assertEquals(extPermsDetailTest.getType(), mockExternalAccessPermsDetailTest().getType()); + assertEquals(extPermsDetailTest.getInstance(), mockExternalAccessPermsDetailTest().getInstance()); + assertEquals(extPermsDetailTest.getDescription(), mockExternalAccessPermsDetailTest().getDescription()); + assertEquals(extPermsDetailTest.getRoles(), mockExternalAccessPermsDetailTest().getRoles()); + assertEquals(extPermsDetailTest2.getAction(), mockExternalAccessPermsDetailTest().getAction()); + assertEquals(extPermsDetailTest2.getType(), mockExternalAccessPermsDetailTest().getType()); + assertEquals(extPermsDetailTest2.getInstance(), mockExternalAccessPermsDetailTest().getInstance()); + assertEquals(extPermsDetailTest2.getDescription(), mockExternalAccessPermsDetailTest().getDescription()); + assertEquals(extPermsDetailTest2.getRoles(), null); + assertEquals(extPermsDetailTest3.getAction(), mockExternalAccessPermsDetailTest().getAction()); + assertEquals(extPermsDetailTest3.getType(), mockExternalAccessPermsDetailTest().getType()); + assertEquals(extPermsDetailTest3.getInstance(), mockExternalAccessPermsDetailTest().getInstance()); + assertEquals(extPermsDetailTest3.getDescription(), mockExternalAccessPermsDetailTest().getDescription()); + assertEquals(extPermsDetailTest3.getRoles(), mockExternalAccessPermsDetailTest().getRoles()); + } + +} 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 new file mode 100644 index 00000000..0f3a65a5 --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessPermsTest.java @@ -0,0 +1,86 @@ +/*- + * ============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 java.util.ArrayList; +import java.util.List; + +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; + } + + @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"))); + } +} 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 new file mode 100644 index 00000000..acb14c65 --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRolePermsTest.java @@ -0,0 +1,68 @@ +/*- + * ============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 new file mode 100644 index 00000000..aa498aa0 --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessRoleTest.java @@ -0,0 +1,59 @@ +/*- + * ============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 ExternalAccessRoleTest { + + public ExternalAccessRole mockExternalAccessRoleTest() { + ExternalAccessRole mockRole = new ExternalAccessRole(); + mockRole.setName("test_role"); + mockRole.setDescription("test_role_description"); + return mockRole; + } + + @Test + public void externalAccessRolePermsTest() { + ExternalAccessRole role = new ExternalAccessRole("test_role", "test_role_description"); + assertEquals(role.getName(), mockExternalAccessRoleTest().getName()); + 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 new file mode 100644 index 00000000..5e750543 --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserRoleDetailTest.java @@ -0,0 +1,99 @@ +/*- + * ============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 java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +public class ExternalAccessUserRoleDetailTest { + + public ExternalAccessUserRoleDetail mockExternalAccessUserRoleDetailTest() { + 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 mockRoleDesc = new ExternalRoleDescription(); + 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); + 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))); + } +} diff --git a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserTest.java b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserTest.java new file mode 100644 index 00000000..18909b74 --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAccessUserTest.java @@ -0,0 +1,56 @@ +/*- + * ============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 ExternalAccessUserTest { + + public ExternalAccessUser mockExternalAccessUserTest() { + return new ExternalAccessUser("test", "test123"); + } + + @Test + public void externalAccessUserTest() { + ExternalAccessUser extUserTest = new ExternalAccessUser("test", "test123"); + assertEquals(extUserTest.getUser(), mockExternalAccessUserTest().getUser()); + assertEquals(extUserTest.getRole(), mockExternalAccessUserTest().getRole()); + } +} diff --git a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAuthUserRoleTest.java b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAuthUserRoleTest.java new file mode 100644 index 00000000..c295a537 --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalAuthUserRoleTest.java @@ -0,0 +1,64 @@ +/*- + * ============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 ExternalAuthUserRoleTest { + + public ExternalAuthUserRole mockExternalAccessUserTest() { + ExternalAuthUserRole mockExtAuthUserRole = new ExternalAuthUserRole(); + mockExtAuthUserRole.setUser("test123"); + mockExtAuthUserRole.setRole("test"); + mockExtAuthUserRole.setExpiryDate("1/1/1111"); + return mockExtAuthUserRole; + } + + @Test + public void externalAuthUserRoleTest() { + ExternalAuthUserRole extAuthUserRole = new ExternalAuthUserRole(); + extAuthUserRole.setUser("test123"); + extAuthUserRole.setRole("test"); + extAuthUserRole.setExpiryDate("1/1/1111"); + assertEquals(extAuthUserRole.getRole(), mockExternalAccessUserTest().getRole()); + assertEquals(extAuthUserRole.getUser(), mockExternalAccessUserTest().getUser()); + assertEquals(extAuthUserRole.getExpiryDate(), mockExternalAccessUserTest().getExpiryDate()); + } +} 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/ExternalRoleDescriptionTest.java new file mode 100644 index 00000000..251f8303 --- /dev/null +++ b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/domain/ExternalRoleDescriptionTest.java @@ -0,0 +1,94 @@ +/*- + * ============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 java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +public class ExternalRoleDescriptionTest { + + 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(); + 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(); + 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()); + assertEquals(extRoleDesc.getAppRoleId(), mockExternalRoleDescriptionTest().getAppRoleId()); + 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())); + } +} |