summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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/ExternalAccessUserRoleDetailTest.java91
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/VisualManagerTest.java75
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/search/SearchResultJSONTest.java77
4 files changed, 275 insertions, 67 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/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));
+
+ }
}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/VisualManagerTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/VisualManagerTest.java
new file mode 100644
index 00000000..6a08be11
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/VisualManagerTest.java
@@ -0,0 +1,75 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 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.
+ * 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.analytics.model.runtime;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class VisualManagerTest {
+ private VisualManager visualManager;
+
+ @Before
+ public void setUp() {
+ visualManager = new VisualManager();
+
+ }
+
+ @Test
+ public void testSetSortByColumn() {
+ visualManager.setSortByColumn("1");
+ Assert.assertEquals("1", visualManager.getSortByColId());
+ Assert.assertEquals("ASC", visualManager.getSortByAscDesc());
+ }
+
+ @Test
+ public void testHideColumn() {
+ visualManager.hideColumn("1");
+ assertFalse(visualManager.isColumnVisible("1"));
+ }
+
+ @Test
+ public void testShowColumn() {
+ visualManager.showColumn("1");
+ assertTrue(visualManager.isColumnVisible("1"));
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/search/SearchResultJSONTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/search/SearchResultJSONTest.java
new file mode 100644
index 00000000..c92dfb45
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/search/SearchResultJSONTest.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright © 2018 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ *****************************************************************************
+ *
+ *
+ */
+
+package org.onap.portalsdk.analytics.model.search;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.ArrayList;
+
+public class SearchResultJSONTest {
+ private SearchResultJSON searchResultJSON;
+
+ @Before
+ public void setUp() {
+ searchResultJSON = new SearchResultJSON();
+ }
+
+ @Test
+ public void testGetSetSearchResultColumns() {
+ ArrayList<SearchResultColumn> list = new ArrayList<>();
+ searchResultJSON.setSearchResultColumns(list);
+ assertEquals(list, searchResultJSON.getSearchResultColumns());
+ }
+
+ @Test
+ public void testGetSetSearchResultRows() {
+ ArrayList<SearchResultRow> list = new ArrayList<>();
+ searchResultJSON.setSearchResultRows(list);
+ assertEquals(list, searchResultJSON.getSearchResultRows());
+ }
+
+ @Test
+ public void testGetNumRows() {
+ ArrayList<SearchResultRow> list = new ArrayList<>();
+ searchResultJSON.setSearchResultRows(list);
+ assertEquals(0, searchResultJSON.getNumRows());
+ }
+
+ @Test
+ public void testNumColumns() {
+ ArrayList<SearchResultColumn> list = new ArrayList<>();
+ searchResultJSON.setSearchResultColumns(list);
+ assertEquals(0, searchResultJSON.getNumColumns());
+ }
+
+ @Test
+ public void testGetColumn() {
+ SearchResultColumn col = new SearchResultColumn("1", "Column1", "10", "left",
+ "url", "column1", "linkForm", "linkConfirmMsg",
+ "linkImg", "10", "10", true,
+ true, false, true);
+ ArrayList<SearchResultColumn> list = new ArrayList<>();
+ list.add(col);
+ searchResultJSON.setSearchResultColumns(list);
+ assertEquals(col, searchResultJSON.getColumn(0));
+ }
+}