summaryrefslogtreecommitdiffstats
path: root/portal-BE/src/test/java/org/onap
diff options
context:
space:
mode:
authorDominik Mizyn <d.mizyn@samsung.com>2019-10-30 11:41:12 +0100
committerDominik Mizyn <d.mizyn@samsung.com>2019-11-18 13:51:45 +0100
commitd904fc786956891946e7bd92b559fdb98f62330f (patch)
tree1a8a731cff63dc26f4d76a7e4897d3262cd3949e /portal-BE/src/test/java/org/onap
parentdf4d078a7e3bcb1d566b0f3f69108979ecaf62d0 (diff)
UserRolesController methods up
readExternalRequestAccess(), getUserAppCatalogRoles(), putAppWithUserRoleRequest(), testGetRoles(), importRolesFromRemoteApplication(), getUsersFromAppEndpoint() up Issue-ID: PORTAL-710 Change-Id: I751d5e412ec85a1a65b0b7d43a023ce6a1915d91 Signed-off-by: Dominik Mizyn <d.mizyn@samsung.com>
Diffstat (limited to 'portal-BE/src/test/java/org/onap')
-rw-r--r--portal-BE/src/test/java/org/onap/portal/controller/UserRolesControllerTest.java12
-rw-r--r--portal-BE/src/test/java/org/onap/portal/service/fn/FnUserRoleServiceTest.java78
2 files changed, 90 insertions, 0 deletions
diff --git a/portal-BE/src/test/java/org/onap/portal/controller/UserRolesControllerTest.java b/portal-BE/src/test/java/org/onap/portal/controller/UserRolesControllerTest.java
index b2048e8f..dcbef08a 100644
--- a/portal-BE/src/test/java/org/onap/portal/controller/UserRolesControllerTest.java
+++ b/portal-BE/src/test/java/org/onap/portal/controller/UserRolesControllerTest.java
@@ -54,6 +54,7 @@ import java.util.HashSet;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
+import javax.servlet.http.HttpServletRequest;
import javax.sql.DataSource;
import org.h2.tools.RunScript;
import org.hibernate.Session;
@@ -68,6 +69,8 @@ import org.onap.portal.domain.db.fn.FnLanguage;
import org.onap.portal.domain.db.fn.FnRole;
import org.onap.portal.domain.db.fn.FnUser;
import org.onap.portal.domain.db.fn.FnUserRole;
+import org.onap.portal.domain.dto.ecomp.ExternalSystemAccess;
+import org.onap.portal.framework.MockitoTestSuite;
import org.onap.portal.service.fn.FnAppService;
import org.onap.portal.service.fn.FnLanguageService;
import org.onap.portal.service.fn.FnLuTimezoneService;
@@ -127,4 +130,13 @@ class UserRolesControllerTest {
//Then
assertEquals(expected, actual);
}
+
+ @Test
+ void readExternalRequestAccess() {
+ ExternalSystemAccess expected = new ExternalSystemAccess("external_access_enable", false);
+ ExternalSystemAccess actual = userRolesController.readExternalRequestAccess();
+
+ assertEquals(expected.getAccessValue(), actual.getAccessValue());
+ assertEquals(expected.getKey(), actual.getKey());
+ }
} \ No newline at end of file
diff --git a/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserRoleServiceTest.java b/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserRoleServiceTest.java
new file mode 100644
index 00000000..bdbc2c03
--- /dev/null
+++ b/portal-BE/src/test/java/org/onap/portal/service/fn/FnUserRoleServiceTest.java
@@ -0,0 +1,78 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ===================================================================
+ *
+ * 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.portal.service.fn;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.transaction.Transactional;
+import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.junit.runner.RunWith;
+import org.onap.portal.domain.db.fn.FnUser;
+import org.onap.portal.domain.dto.ecomp.EPUserAppCatalogRoles;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+@Transactional
+@TestPropertySource(locations = "classpath:test.properties")
+class FnUserRoleServiceTest {
+ @Autowired
+ private FnUserRoleService fnUserRoleService;
+ @Autowired
+ private FnUserService fnUserService;
+
+ @Test
+ void getUserAppCatalogRoles() {
+ FnUser user = fnUserService.loadUserByUsername("demo");
+
+ List<EPUserAppCatalogRoles> actual = fnUserRoleService.getUserAppCatalogRoles(user, "appName");
+
+ List<EPUserAppCatalogRoles> expected = new ArrayList<>();
+
+ assertEquals(expected, actual);
+ }
+} \ No newline at end of file