summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java12
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/controller/WizardProcessorTest.java12
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/line/LineInfoTest.java8
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/map/ColorPropertiesTest.java6
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/search/SearchResultColumnTest.java68
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/search/SearchResultTest.java79
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/adapter/FusionAdapterTest.java10
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/util/ExcelColorDefTest.java64
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataValueTest.java122
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderColTest.java63
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderTest.java35
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/LogoutControllerTest.java12
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/MenuListControllerTest.java8
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/RoleControllerTest.java460
-rw-r--r--ecomp-sdk/epsdk-app-os/db-scripts/readme10
-rw-r--r--ecomp-sdk/epsdk-app-os/src/main/resources/music.properties14
-rw-r--r--ecomp-sdk/epsdk-app-os/src/main/resources/portal.properties10
-rw-r--r--ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/web.xml26
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java6
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/onboarding/ueb/FunctionalMenuTest.java53
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/onboarding/ueb/UebExceptionTest.java66
-rw-r--r--ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/CipherUtil.java4
-rw-r--r--ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/InMemoryRestServer.java49
-rw-r--r--ecomp-sdk/epsdk-workflow/src/test/java/org/onap/portalsdk/rnotebookintegration/exception/RNotebookIntegrationExceptionTest.java56
24 files changed, 886 insertions, 367 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java
index 60c45b4f..4839f115 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java
@@ -1,9 +1,9 @@
/*
- * ============LICENSE_START==========================================
+ * ================LICENSE_START==========================================
* ONAP Portal SDK
- * ===================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+ * =======================================================================
+ * Copyright © 2017-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");
@@ -31,7 +31,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
- * ============LICENSE_END============================================
+ * ================LICENSE_END============================================
*
*
*/
@@ -3083,7 +3083,7 @@ public class ChartD3Helper {
StringBuffer groupBuffer = new StringBuffer("");
StringBuffer s = new StringBuffer("");
dataStr.append("{");
- dataStr.append(" \"ss4262\":{\n");
+ dataStr.append(" \"xxxxxx\":{\n");
String mid = "";
String mid_old = "";
String level = "-1";
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/controller/WizardProcessorTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/controller/WizardProcessorTest.java
index 52e0b1a1..7cfacadd 100644
--- a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/controller/WizardProcessorTest.java
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/controller/WizardProcessorTest.java
@@ -1,9 +1,9 @@
/*
- * ============LICENSE_START==========================================
+ * ============LICENSE_START==============================================
* ONAP Portal SDK
- * ===================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+ * =======================================================================
+ * Copyright © 2017-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");
@@ -31,7 +31,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
- * ============LICENSE_END============================================
+ * ============LICENSE_END================================================
*
*
*/
@@ -412,7 +412,7 @@ public class WizardProcessorTest {
mockHttpAttribute("hideExcelIcons","N");
mockHttpAttribute("hidePDFIcons","N");
- mockHttpAttribute("dataSource","org.att.onap.DataSource");
+ mockHttpAttribute("dataSource","org.onap.DataSource");
mockHttpAttribute("numFormCols","10");
mockHttpAttribute("reportTitle","ONAP Portal User Report");
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/line/LineInfoTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/line/LineInfoTest.java
index 5ff6e78b..f9a5ee2d 100644
--- a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/line/LineInfoTest.java
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/line/LineInfoTest.java
@@ -114,4 +114,12 @@ public class LineInfoTest {
assertEquals("length", list.get(0));
}
+ @Test
+ public void getAttributeKeysTest() throws Exception {
+ Map<String, String> lineAttributes1 = new HashMap<>();
+ lineAttributes1.put("length", "200cm");
+ lineInfo.initializeAttributes(lineAttributes1);
+ List<String> list = lineInfo.getAttributeKeys();
+ assertEquals("length", list.get(0));
+ }
}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/map/ColorPropertiesTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/map/ColorPropertiesTest.java
index 07d9a926..b6dc00e4 100644
--- a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/map/ColorPropertiesTest.java
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/gmap/map/ColorPropertiesTest.java
@@ -61,6 +61,7 @@ public class ColorPropertiesTest {
colorProperties.setColor(TYPE, COLOR);
colorProperties.setShape(TYPE, SHAPE);
colorProperties.setSize(TYPE, SIZE);
+ colorProperties.setSize(TYPE, NUMBER, SIZE);
colorProperties.setShape(TYPE, NUMBER, SHAPE);
}
@@ -90,4 +91,9 @@ public class ColorPropertiesTest {
public void testGetSize() {
assertEquals(100, colorProperties.getSize(TYPE));
}
+
+ @Test
+ public void testGetSizeWithNumber() {
+ assertEquals(100, colorProperties.getSize(TYPE, NUMBER));
+ }
}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/search/SearchResultColumnTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/search/SearchResultColumnTest.java
new file mode 100644
index 00000000..07b259a7
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/search/SearchResultColumnTest.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SearchResultColumnTest {
+ private SearchResultColumn searchResultColumn;
+
+ @Before
+ public void setUp() {
+ searchResultColumn = new SearchResultColumn( "columnId",
+ "columnTitle",
+ "columnWidth",
+ "alignment",
+ "linkURL",
+ "linkTitle",
+ "linkForm",
+ "linkConfirmMsg",
+ "linkImg",
+ "linkImgWidth",
+ "linkImgHeight",
+ true,
+ false,
+ false,
+ true);
+ }
+
+ @Test
+ public void testAllValues() {
+ Assert.assertEquals("columnTitle", searchResultColumn.getColumnTitle());
+ Assert.assertEquals("columnWidth", searchResultColumn.getColumnWidth());
+ Assert.assertEquals("alignment", searchResultColumn.getAlignment());
+ Assert.assertEquals("linkURL", searchResultColumn.getLinkURL());
+ Assert.assertEquals("linkTitle", searchResultColumn.getLinkTitle());
+ Assert.assertEquals("linkForm", searchResultColumn.getLinkForm());
+ Assert.assertEquals("linkConfirmMsg", searchResultColumn.getLinkConfirmMsg());
+ Assert.assertEquals("linkImg", searchResultColumn.getLinkImg());
+ Assert.assertEquals("linkImgWidth", searchResultColumn.getLinkImgWidth());
+ Assert.assertEquals("linkImgHeight", searchResultColumn.getLinkImgHeight());
+ Assert.assertEquals(true, searchResultColumn.isCopyLink());
+ Assert.assertEquals(false, searchResultColumn.isEditLink());
+ Assert.assertEquals(false, searchResultColumn.isDeleteLink());
+ Assert.assertEquals(true, searchResultColumn.isScheduleLink());
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/search/SearchResultTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/search/SearchResultTest.java
new file mode 100644
index 00000000..7d2fca1e
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/search/SearchResultTest.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * 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.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SearchResultTest {
+ private SearchResult searchResult;
+
+ @Before
+ public void setUp() {
+ searchResult = new SearchResult(1, 10, 1,2);
+ }
+
+ @Test
+ public void testGetPageNo() {
+ Assert.assertEquals(1, searchResult.getPageNo());
+ }
+
+ @Test
+ public void testGetPageSize() {
+ Assert.assertEquals(10, searchResult.getPageSize());
+ }
+
+ @Test
+ public void testGetSetDataSize() {
+ Assert.assertEquals(-1, searchResult.getDataSize());
+ }
+
+ @Test
+ public void testGetSetCsvPageFileName() {
+ searchResult.setCsvPageFileName("CSvFile");
+ Assert.assertEquals("CSvFile", searchResult.getCsvPageFileName());
+ }
+
+ @Test
+ public void testGetSetCsvAllRowsFileName() {
+ searchResult.setCsvAllRowsFileName("CSvAlRowsFile");
+ Assert.assertEquals("CSvAlRowsFile", searchResult.getCsvAllRowsFileName());
+ }
+
+ @Test
+ public void TestGetExcelAllRowsFileName() {
+ Assert.assertEquals(null, searchResult.getExcelAllRowsFileName());
+ }
+
+ @Test
+ public void TestAddColumn() {
+ SearchResultColumn col = new SearchResultColumn("1", "Column1", "10", "left",
+ "url", "column1", "linkForm", "linkConfirmMsg",
+ "linkImg", "10", "10", true,
+ true, false, true);
+ searchResult.addColumn(col);
+ Assert.assertEquals(col, searchResult.getColumn(0));
+ Assert.assertEquals(1, searchResult.getNumColumns());
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/adapter/FusionAdapterTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/adapter/FusionAdapterTest.java
index 27bd839b..4600ac89 100644
--- a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/adapter/FusionAdapterTest.java
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/adapter/FusionAdapterTest.java
@@ -45,8 +45,10 @@ public class FusionAdapterTest {
FusionAdapter fa=new FusionAdapter();
ComboPooledDataSource dataSource;
- Map<String,ComboPooledDataSource> dataSourceMap;
+ Map<String,ComboPooledDataSource> dataSourceMap;
ServletContext servletContext;
+
+
@Test
public void test() {
fa.setDataSource(dataSource);
@@ -55,4 +57,10 @@ public class FusionAdapterTest {
assertEquals(fa.getDataSource(), dataSource);
assertEquals(fa.getServletContext(), servletContext);
}
+
+ @Test
+ public void releaseConnectionTest() throws Exception{
+ fa.releaseConnection(null);
+ }
+
}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/util/ExcelColorDefTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/util/ExcelColorDefTest.java
new file mode 100644
index 00000000..dcc05976
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/util/ExcelColorDefTest.java
@@ -0,0 +1,64 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2018 IBM 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.analytics.util;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import static org.junit.Assert.assertNotNull;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ExcelColorDef.class})
+public class ExcelColorDefTest{
+
+ @Before
+ public void setUp(){
+ ExcelColorDef.initializeExcelColorDef();
+ }
+
+ @Test
+ public void getExcelColorTest(){
+ assertNotNull(ExcelColorDef.getExcelColor("#FFFF00"));
+ assertNotNull(ExcelColorDef.getExcelColor(Mockito.anyString()));
+ }
+}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataValueTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataValueTest.java
index 020eed27..12ad386a 100644
--- a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataValueTest.java
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/DataValueTest.java
@@ -4,6 +4,8 @@
* ===================================================================
* Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ===================================================================
+ * Modifications Copyright © 2018 IBM.
+ * ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
* under the Apache License, Version 2.0 (the "License");
@@ -39,52 +41,86 @@ package org.onap.portalsdk.analytics.view;
import static org.junit.Assert.*;
+import org.junit.Before;
import org.junit.Test;
public class DataValueTest {
+ private DataValue dataValue;
+ private HtmlFormatter formatter;
+
+ @Before
+ public void setUp()
+ {
+ dataValue = new DataValue();
+ dataValue.setDisplayName("displayName");
+ dataValue.setDisplayCalculatedValue("displayCalculatedValue");
+ dataValue.setDrillDownURL("drillDownURL");
+ dataValue.setDrillDowninPoPUp(false);
+ dataValue.setIndentation("indentation");
+ dataValue.setAlignment("alignment");
+ dataValue.setVisible(false);
+ dataValue.setHidden(false);
+ formatter = new HtmlFormatter();
+ dataValue.setCellFormatter(formatter);
+ dataValue.setBold(false);
+ dataValue.setRowFormatter(formatter);
+ dataValue.setFormatId("formatId");
+ dataValue.setCellFormat(false);
+ dataValue.setColId("colId");
+ dataValue.setDisplayName("displayName");
+ dataValue.setNowrap("nowrap");
+ dataValue.setHyperlinkURL("hyperlinkURL");
+ dataValue.setDisplayType("displayType");
+ dataValue.setActionImg("actionImg");
- @Test
- public void mockDataValueTest() {
- DataValue dataValue = new DataValue();
- dataValue.setDisplayName("displayName");
- dataValue.setDisplayCalculatedValue("displayCalculatedValue");
- dataValue.setDrillDownURL("drillDownURL");
- dataValue.setDrillDowninPoPUp(false);
- dataValue.setIndentation("indentation");
- dataValue.setAlignment("alignment");
- dataValue.setVisible(false);
- dataValue.setHidden(false);
- HtmlFormatter formatter = new HtmlFormatter();
- dataValue.setCellFormatter(formatter);
- dataValue.setBold(false);
- dataValue.setRowFormatter(formatter);
- dataValue.setFormatId("formatId");
- dataValue.setCellFormat(false);
- dataValue.setColId("colId");
- dataValue.setDisplayName("displayName");
- dataValue.setNowrap("nowrap");
- dataValue.setHyperlinkURL("hyperlinkURL");
- dataValue.setDisplayType("displayType");
- dataValue.setActionImg("actionImg");
-
- assertEquals(dataValue.getDisplayName(), "displayName");
- assertEquals(dataValue.getDisplayCalculatedValue(), "displayCalculatedValue");
- assertEquals(dataValue.getDrillDownURL(), "drillDownURL");
- assertFalse(dataValue.isDrillDowninPoPUp());
- assertEquals(dataValue.getIndentation(), "indentation");
- assertEquals(dataValue.getAlignment(), "alignment");
- assertFalse(dataValue.isVisible());
- assertFalse(dataValue.isHidden());
- assertEquals(dataValue.getCellFormatter(), formatter);
- assertEquals(dataValue.getRowFormatter(), formatter);
- assertEquals(dataValue.getFormatId(), "formatId");
- assertFalse(dataValue.isBold());
- assertEquals(dataValue.getColId(), "colId");
- assertEquals(dataValue.getDisplayName(), "displayName");
- assertEquals(dataValue.getNowrap(), "nowrap");
- assertEquals(dataValue.getHyperlinkURL(), "hyperlinkURL");
- assertEquals(dataValue.getDisplayType(), "displayType");
- assertEquals(dataValue.getActionImg(), "actionImg");
- }
+ }
+
+ @Test
+ public void mockDataValueTest() {
+
+ assertEquals(dataValue.getDisplayName(), "displayName");
+ assertEquals(dataValue.getDisplayCalculatedValue(), "displayCalculatedValue");
+ assertEquals(dataValue.getDrillDownURL(), "drillDownURL");
+ assertFalse(dataValue.isDrillDowninPoPUp());
+ assertEquals(dataValue.getIndentation(), "indentation");
+ assertEquals(dataValue.getAlignment(), "alignment");
+ assertFalse(dataValue.isVisible());
+ assertFalse(dataValue.isHidden());
+ assertEquals(dataValue.getCellFormatter(), formatter);
+ assertEquals(dataValue.getRowFormatter(), formatter);
+ assertEquals(dataValue.getFormatId(), "formatId");
+ assertFalse(dataValue.isBold());
+ assertEquals(dataValue.getColId(), "colId");
+ assertEquals(dataValue.getDisplayName(), "displayName");
+ assertEquals(dataValue.getNowrap(), "nowrap");
+ assertEquals(dataValue.getHyperlinkURL(), "hyperlinkURL");
+ assertEquals(dataValue.getDisplayType(), "displayType");
+ assertEquals(dataValue.getActionImg(), "actionImg");
+ }
+ @Test
+ public void testGetDisplayValueHtml()
+ {
+ assertEquals("&nbsp;", dataValue.getDisplayValueHtml());
+ }
+
+ @Test
+ public void testGetDisplayValueLinkHtml()
+ {
+ String drillDown="\"drillDownURL\"";
+ String s="<a href="+drillDown+">&nbsp;</a>";
+ assertEquals(s, dataValue.getDisplayValueLinkHtml());
+ }
+
+ @Test
+ public void testGetAlignmentHtml()
+ {
+ assertEquals(" align=alignment", dataValue.getAlignmentHtml());
+ }
+
+ @Test
+ public void testBgColorHtml()
+ {
+ assertEquals("", dataValue.getBgColorHtml());
+ }
}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderColTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderColTest.java
index 180abf02..932a4e75 100644
--- a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderColTest.java
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderColTest.java
@@ -4,6 +4,8 @@
* ===================================================================
* Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ===================================================================
+ * Modifications Copyright © 2018 IBM.
+ * ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
* under the Apache License, Version 2.0 (the "License");
@@ -35,6 +37,7 @@
*
*
*/
+
package org.onap.portalsdk.analytics.view;
import static org.junit.Assert.*;
@@ -43,33 +46,39 @@ import org.junit.Test;
public class RowHeaderColTest {
- @Test
- public void mockRowHeaderColTest() {
- RowHeaderCol rowHeaderCol = new RowHeaderCol();
- rowHeaderCol.setColumnTitle("columnTitle");
- rowHeaderCol.setColumnWidth("columnWidth");
- rowHeaderCol.setAlignment("alignment");
- rowHeaderCol.setColId("colId");
- rowHeaderCol.setDisplayHeaderAlignment(null);
- assertNull(rowHeaderCol.getDisplayHeaderAlignment());
- assertEquals(rowHeaderCol.getColId(), "colId");
- assertEquals(rowHeaderCol.getColumnTitle(), "columnTitle");
- assertEquals(rowHeaderCol.getColumnWidth(), "columnWidth");
- assertEquals(rowHeaderCol.getAlignment(), "alignment");
- assertEquals(rowHeaderCol.getColumnTitleHtml(), "columnTitle");
- assertEquals(rowHeaderCol.getColumnWidthHtml(), " width=columnWidth");
- assertEquals(rowHeaderCol.getAlignmentHtml(), " align=alignment");
- rowHeaderCol.resetNext();
- RowHeader rowHeader = new RowHeader();
- rowHeaderCol.addRowHeader(rowHeader);
- rowHeaderCol.addRowHeader(1, rowHeader);
- rowHeaderCol.setColumnTitle("");
- rowHeaderCol.setColumnWidth("");
- rowHeaderCol.setAlignment("");
- assertEquals(rowHeaderCol.getColumnTitleHtml(), "&nbsp;");
- assertEquals(rowHeaderCol.getColumnWidthHtml(), "");
- assertEquals(rowHeaderCol.getAlignmentHtml(), " align=center");
+ @Test
+ public void mockRowHeaderColTest() {
+ RowHeaderCol rowHeaderCol = new RowHeaderCol();
+ rowHeaderCol.setColumnTitle("columnTitle");
+ rowHeaderCol.setColumnWidth("columnWidth");
+ rowHeaderCol.setAlignment("alignment");
+ rowHeaderCol.setColId("colId");
+ rowHeaderCol.setDisplayHeaderAlignment(null);
+ rowHeaderCol.setNowrap("noWrap");
+ rowHeaderCol.setVisible(true);
+ assertEquals("noWrap", rowHeaderCol.getNowrap());
+ assertEquals(true, rowHeaderCol.isVisible());
+ assertNull(rowHeaderCol.getDisplayHeaderAlignment());
+ assertEquals(rowHeaderCol.getColId(), "colId");
+ assertEquals(rowHeaderCol.getColumnTitle(), "columnTitle");
+ assertEquals(rowHeaderCol.getColumnWidth(), "columnWidth");
+ assertEquals(rowHeaderCol.getAlignment(), "alignment");
+ assertEquals(rowHeaderCol.getColumnTitleHtml(), "columnTitle");
+ assertEquals(rowHeaderCol.getColumnWidthHtml(), " width=columnWidth");
+ assertEquals(rowHeaderCol.getAlignmentHtml(), " align=alignment");
+ rowHeaderCol.resetNext();
+ RowHeader rowHeader = new RowHeader();
+ rowHeaderCol.addRowHeader(rowHeader);
+ rowHeaderCol.addRowHeader(1, rowHeader);
+ rowHeaderCol.setColumnTitle("");
+ rowHeaderCol.setColumnWidth("");
+ rowHeaderCol.setAlignment("");
+ assertTrue(rowHeaderCol.hasNext());
+ assertNotNull(rowHeaderCol.getNext());
+ assertEquals(rowHeaderCol.getColumnTitleHtml(), "&nbsp;");
+ assertEquals(rowHeaderCol.getColumnWidthHtml(), "");
+ assertEquals(rowHeaderCol.getAlignmentHtml(), " align=center");
- }
+ }
}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderTest.java
index 6578ad6a..61d8d6d6 100644
--- a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderTest.java
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderTest.java
@@ -5,7 +5,8 @@
* ===================================================================
* Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ===================================================================
- *
+ * Modifications 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.
@@ -43,18 +44,22 @@ import org.junit.Test;
public class RowHeaderTest {
- @Test
- public void mockRowHeaderTest() {
- RowHeader rowHeader = new RowHeader();
- rowHeader.setRowTitle("rowTitle");
- rowHeader.setRowHeight("rowHeight");
- rowHeader.setRowSpan(1);
- rowHeader.setColSpan(1);
- rowHeader.setBold(false);
- assertEquals(rowHeader.getRowTitle(), "rowTitle");
- assertEquals(rowHeader.getRowHeight(), "rowHeight");
- assertEquals(rowHeader.getRowSpan(), 1);
- assertEquals(rowHeader.getColSpan(), 1);
- assertFalse(rowHeader.isBold());
- }
+ @Test
+ public void mockRowHeaderTest() {
+ RowHeader rowHeader = new RowHeader();
+ rowHeader.setRowTitle("rowTitle");
+ rowHeader.setRowHeight("rowHeight");
+ rowHeader.setRowSpan(1);
+ rowHeader.setColSpan(1);
+ rowHeader.setBold(false);
+ assertEquals("rowTitle", rowHeader.getRowTitleHtml());
+ assertEquals(" height=rowHeight", rowHeader.getRowHeightHtml());
+ assertEquals("", rowHeader.getRowSpanHtml());
+ assertEquals("", rowHeader.getColSpanHtml());
+ assertEquals(rowHeader.getRowTitle(), "rowTitle");
+ assertEquals(rowHeader.getRowHeight(), "rowHeight");
+ assertEquals(rowHeader.getRowSpan(), 1);
+ assertEquals(rowHeader.getColSpan(), 1);
+ assertFalse(rowHeader.isBold());
+ }
}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/LogoutControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/LogoutControllerTest.java
index a6ffb038..8883cfa8 100644
--- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/LogoutControllerTest.java
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/LogoutControllerTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START==========================================
* ONAP Portal SDK
* ===================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
* ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
@@ -108,7 +108,7 @@ public class LogoutControllerTest {
ServletRequestAttributes ServletRequestAttributes = new ServletRequestAttributes(mockedRequest);
Mockito.when(RequestContextHolder.currentRequestAttributes()).thenReturn(ServletRequestAttributes);
Mockito.when(PortalApiProperties
- .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp");
+ .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm");
logoutController.globalLogout(mockedRequest);
}
@@ -117,20 +117,20 @@ public class LogoutControllerTest {
PowerMockito.mockStatic(PortalApiProperties.class);
PowerMockito.mockStatic(PortalApiConstants.class);
Mockito.when(PortalApiProperties
- .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp");
+ .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm");
assertNull(logoutController.globalLogout(mockedRequest));
}
@Test
public void appLogoutTest(){
- ModelAndView actualModelView = new ModelAndView("redirect:https://portal.openecomp.org/ecompportal/process_csp");
+ ModelAndView actualModelView = new ModelAndView("redirect:http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm");
PowerMockito.mockStatic(PortalApiProperties.class);
PowerMockito.mockStatic(PortalApiConstants.class);
PowerMockito.mockStatic(RequestContextHolder.class);
ServletRequestAttributes ServletRequestAttributes = new ServletRequestAttributes(mockedRequest);
Mockito.when(RequestContextHolder.currentRequestAttributes()).thenReturn(ServletRequestAttributes);
Mockito.when(PortalApiProperties
- .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp");
+ .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm");
ModelAndView expectedModelView = logoutController.appLogout(mockedRequest);
assertEquals(actualModelView.getViewName(), expectedModelView.getViewName());
}
@@ -140,7 +140,7 @@ public class LogoutControllerTest {
PowerMockito.mockStatic(PortalApiProperties.class);
PowerMockito.mockStatic(PortalApiConstants.class);
Mockito.when(PortalApiProperties
- .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp");
+ .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm");
assertNull(logoutController.appLogout(mockedRequest));
}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/MenuListControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/MenuListControllerTest.java
index 2d6c0cd1..cc935b38 100644
--- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/MenuListControllerTest.java
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/MenuListControllerTest.java
@@ -193,7 +193,7 @@ public class MenuListControllerTest {
Mockito.when(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)).thenReturn("user");
Mockito.when(session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME))).thenReturn(user);
Mockito.when(PortalApiProperties
- .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp");
+ .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm");
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
@@ -206,7 +206,7 @@ public class MenuListControllerTest {
PowerMockito.mockStatic(PortalApiConstants.class);
Mockito.when(mockedRequest.getParameter("page")).thenReturn("contact");
Mockito.when(PortalApiProperties
- .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp");
+ .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm");
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
@@ -219,7 +219,7 @@ public class MenuListControllerTest {
PowerMockito.mockStatic(PortalApiConstants.class);
Mockito.when(mockedRequest.getParameter("page")).thenReturn("access");
Mockito.when(PortalApiProperties
- .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp");
+ .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm");
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
@@ -231,7 +231,7 @@ public class MenuListControllerTest {
PowerMockito.mockStatic(PortalApiProperties.class);
PowerMockito.mockStatic(PortalApiConstants.class);
Mockito.when(PortalApiProperties
- .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp");
+ .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm");
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/RoleControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/RoleControllerTest.java
index 9dee09fe..7cf893e1 100644
--- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/RoleControllerTest.java
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/RoleControllerTest.java
@@ -4,6 +4,8 @@
* ===================================================================
* Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ===================================================================
+ * Modifications Copyright © 2018 IBM.
+ * ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
* under the Apache License, Version 2.0 (the "License");
@@ -71,242 +73,260 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class RoleControllerTest {
- @InjectMocks
- RoleController roleController = new RoleController();
+ @InjectMocks
+ RoleController roleController = new RoleController();
- @Mock
- RoleService roleService;
+ @Mock
+ RoleService roleService;
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
- }
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
- MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
- HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
- HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
- NullPointerException nullPointerException = new NullPointerException();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+ NullPointerException nullPointerException = new NullPointerException();
- @Mock
- UserUtils userUtils = new UserUtils();
+ @Mock
+ UserUtils userUtils = new UserUtils();
- @Mock
- ServletRequestUtils servletRequestUtils;
+ @Mock
+ ServletRequestUtils servletRequestUtils;
- @Mock
- ObjectMapper mapper = new ObjectMapper();
+ @Mock
+ ObjectMapper mapper = new ObjectMapper();
- @Test
- public void roleTest() throws IOException {
- roleController.setViewName("Test");
- User user = new User();
- user.setOrgUserId("test12");
- Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Role expectedRole = new Role();
- expectedRole.setId((long) 1);
- Mockito.when(roleService.getRole(Matchers.anyString(), Matchers.anyLong())).thenReturn(expectedRole);
- List<RoleFunction> roleFunctionList = new ArrayList<RoleFunction>();
- List<Role> roleList = new ArrayList<Role>();
- Mockito.when(roleService.getRoleFunctions(user.getOrgUserId())).thenReturn(roleFunctionList);
- Mockito.when(roleService.getAvailableChildRoles(Matchers.anyString(), Matchers.anyLong())).thenReturn(roleList);
- ModelAndView expectedResult = roleController.role(mockedRequest);
- assertEquals(expectedResult.getViewName(), "Test");
- }
+ @Test
+ public void roleTest() throws IOException {
+ roleController.setViewName("Test");
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ Role expectedRole = new Role();
+ expectedRole.setId((long) 1);
+ Mockito.when(roleService.getRole(Matchers.anyString(), Matchers.anyLong())).thenReturn(expectedRole);
+ List<RoleFunction> roleFunctionList = new ArrayList<RoleFunction>();
+ List<Role> roleList = new ArrayList<Role>();
+ Mockito.when(roleService.getRoleFunctions(user.getOrgUserId())).thenReturn(roleFunctionList);
+ Mockito.when(roleService.getAvailableChildRoles(Matchers.anyString(), Matchers.anyLong())).thenReturn(roleList);
+ ModelAndView expectedResult = roleController.role(mockedRequest);
+ assertEquals(expectedResult.getViewName(), "Test");
+ }
- @Test
- public void roleExceptionTest() throws IOException {
- User user = new User();
- user.setOrgUserId("test12");
- Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Role expectedRole = new Role();
- expectedRole.setId((long) 1);
- Mockito.when(roleService.getRole(Matchers.anyString(), Matchers.anyLong())).thenReturn(expectedRole);
- Mockito.when(roleService.getRoleFunctions(user.getOrgUserId())).thenThrow(nullPointerException);
- ModelAndView expectedResult = roleController.role(mockedRequest);
- assertNull(expectedResult.getViewName(), null);
- }
+ @Test
+ public void roleExceptionTest() throws IOException {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ Role expectedRole = new Role();
+ expectedRole.setId((long) 1);
+ Mockito.when(roleService.getRole(Matchers.anyString(), Matchers.anyLong())).thenReturn(expectedRole);
+ Mockito.when(roleService.getRoleFunctions(user.getOrgUserId())).thenThrow(nullPointerException);
+ ModelAndView expectedResult = roleController.role(mockedRequest);
+ assertNull(expectedResult.getViewName(), null);
+ }
- @Test
- public void getRoleTest() throws IOException {
- User user = new User();
- user.setOrgUserId("test12");
- Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Role expectedRole = new Role();
- expectedRole.setId((long) 1);
- Mockito.when(roleService.getRole(Matchers.anyString(), Matchers.anyLong())).thenReturn(expectedRole);
- List<RoleFunction> roleFunctionList = new ArrayList<RoleFunction>();
- List<Role> roleList = new ArrayList<Role>();
- Mockito.when(roleService.getRoleFunctions(user.getOrgUserId())).thenReturn(roleFunctionList);
- Mockito.when(roleService.getAvailableChildRoles(Matchers.anyString(), Matchers.anyLong())).thenReturn(roleList);
- StringWriter sw = new StringWriter();
- PrintWriter writer = new PrintWriter(sw);
- Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
- roleController.getRole(mockedRequest, mockedResponse);
- }
+ @Test
+ public void getRoleTest() throws IOException {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ Role expectedRole = new Role();
+ expectedRole.setId((long) 1);
+ Mockito.when(roleService.getRole(Matchers.anyString(), Matchers.anyLong())).thenReturn(expectedRole);
+ List<RoleFunction> roleFunctionList = new ArrayList<RoleFunction>();
+ List<Role> roleList = new ArrayList<Role>();
+ Mockito.when(roleService.getRoleFunctions(user.getOrgUserId())).thenReturn(roleFunctionList);
+ Mockito.when(roleService.getAvailableChildRoles(Matchers.anyString(), Matchers.anyLong())).thenReturn(roleList);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ roleController.getRole(mockedRequest, mockedResponse);
+ }
- @Test
- public void getRoleExceptionTest() throws IOException {
- User user = new User();
- user.setOrgUserId("test12");
- Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
- Role expectedRole = new Role();
- expectedRole.setId((long) 1);
- Mockito.when(roleService.getRole(Matchers.anyString(), Matchers.anyLong())).thenReturn(expectedRole);
- List<RoleFunction> roleFunctionList = new ArrayList<RoleFunction>();
- List<Role> roleList = new ArrayList<Role>();
- Mockito.when(roleService.getRoleFunctions(user.getOrgUserId())).thenReturn(roleFunctionList);
- Mockito.when(roleService.getAvailableChildRoles(Matchers.anyString(), Matchers.anyLong())).thenReturn(roleList);
- roleController.getRole(mockedRequest, mockedResponse);
- }
+ @Test
+ public void getRoleExceptionTest() throws IOException {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ Role expectedRole = new Role();
+ expectedRole.setId((long) 1);
+ Mockito.when(roleService.getRole(Matchers.anyString(), Matchers.anyLong())).thenReturn(expectedRole);
+ List<RoleFunction> roleFunctionList = new ArrayList<RoleFunction>();
+ List<Role> roleList = new ArrayList<Role>();
+ Mockito.when(roleService.getRoleFunctions(user.getOrgUserId())).thenReturn(roleFunctionList);
+ Mockito.when(roleService.getAvailableChildRoles(Matchers.anyString(), Matchers.anyLong())).thenReturn(roleList);
+ roleController.getRole(mockedRequest, mockedResponse);
+ }
- @Test
- public void saveRoleTest() throws IOException {
- User user = new User();
- user.setOrgUserId("test12");
- Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
- String json = "{\"role\":{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"name\":\"test1\",\"active\":false,\"priority\":\"1\",\"roleFunctions\":[],\"childRoles\":[],\"editUrl\":\"/role.htm?role_id=1\",\"toggleActiveImage\":\"/static/fusion/images/inactive.png\",\"toggleActiveAltText\":\"Click to Activate Role\"},\"childRoles\":[],\"roleFunctions\":[]}";
- Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
- Role role = new Role();
- role.setId((long) 1);
- Mockito.when(roleService.getRole(user.getOrgUserId(), role.getId())).thenReturn(role);
- StringWriter sw = new StringWriter();
- PrintWriter writer = new PrintWriter(sw);
- Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
- assertNull(roleController.saveRole(mockedRequest, mockedResponse));
+ @Test
+ public void saveRoleTest() throws IOException {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ String json = "{\"role\":{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"name\":\"test1\",\"active\":false,\"priority\":\"1\",\"roleFunctions\":[],\"childRoles\":[],\"editUrl\":\"/role.htm?role_id=1\",\"toggleActiveImage\":\"/static/fusion/images/inactive.png\",\"toggleActiveAltText\":\"Click to Activate Role\"},\"childRoles\":[],\"roleFunctions\":[]}";
+ Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
+ Role role = new Role();
+ role.setId((long) 1);
+ Mockito.when(roleService.getRole(user.getOrgUserId(), role.getId())).thenReturn(role);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(roleController.saveRole(mockedRequest, mockedResponse));
- }
+ }
- @Test
- public void saveRoleWithRoleFunctionsTest() throws IOException {
- User user = new User();
- user.setOrgUserId("test12");
- Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
- String json = "{\"role\":{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"name\":\"test role modified test\",\"active\":true,\"priority\":null,\"roleFunctions\":[{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"code\":\"menu_test\",\"name\":\"Test Menu\",\"editUrl\":\"/role_function.htm?role_function_id=menu_test\",\"$$hashKey\":\"object:1476\"}],\"childRoles\":[],\"editUrl\":\"/role.htm?role_id=9356\",\"toggleActiveImage\":\"/static/fusion/images/active.png\",\"toggleActiveAltText\":\"Click to Deactivate Role\"},\"childRoles\":[],\"roleFunctions\":[{\"id\":9356,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"code\":\"menu_test\",\"name\":\"Test Menu\",\"editUrl\":\"/role_function.htm?role_function_id=menu_test\",\"$$hashKey\":\"object:1476\"}]}";
- Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
- Role role = new Role();
- role.setId((long) 1);
- Mockito.when(roleService.getRole(user.getOrgUserId(), role.getId())).thenReturn(role);
- StringWriter sw = new StringWriter();
- PrintWriter writer = new PrintWriter(sw);
- Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
- assertNull(roleController.saveRole(mockedRequest, mockedResponse));
- }
+ @Test
+ public void saveRoleWithRoleFunctionsTest() throws IOException {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ String json = "{\"role\":{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"name\":\"test role modified test\",\"active\":true,\"priority\":null,\"roleFunctions\":[{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"code\":\"menu_test\",\"name\":\"Test Menu\",\"editUrl\":\"/role_function.htm?role_function_id=menu_test\",\"$$hashKey\":\"object:1476\"}],\"childRoles\":[],\"editUrl\":\"/role.htm?role_id=9356\",\"toggleActiveImage\":\"/static/fusion/images/active.png\",\"toggleActiveAltText\":\"Click to Deactivate Role\"},\"childRoles\":[],\"roleFunctions\":[{\"id\":9356,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"code\":\"menu_test\",\"name\":\"Test Menu\",\"editUrl\":\"/role_function.htm?role_function_id=menu_test\",\"$$hashKey\":\"object:1476\"}]}";
+ Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
+ Role role = new Role();
+ role.setId((long) 1);
+ Mockito.when(roleService.getRole(user.getOrgUserId(), role.getId())).thenReturn(role);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(roleController.saveRole(mockedRequest, mockedResponse));
+ }
- @Test
- public void saveNewRoleTest() throws IOException {
- User user = new User();
- user.setOrgUserId("test12");
- Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
- String json = "{\"role\":{\"id\":null,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"name\":\"test1\",\"active\":false,\"priority\":\"1\",\"roleFunctions\":[],\"childRoles\":[],\"editUrl\":\"/role.htm?role_id=1\",\"toggleActiveImage\":\"/static/fusion/images/inactive.png\",\"toggleActiveAltText\":\"Click to Activate Role\"},\"childRoles\":[],\"roleFunctions\":[]}";
- Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
- Role role = new Role();
- role.setId((long) 1);
- Mockito.when(roleService.getRole(user.getOrgUserId(), role.getId())).thenReturn(role);
- StringWriter sw = new StringWriter();
- PrintWriter writer = new PrintWriter(sw);
- Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
- List<Role> roleList = new ArrayList<Role>();
- Role role1 = new Role();
- role1.setName("TestRole1");
- Role role2 = new Role();
- role2.setName("TestRole2");
- roleList.add(role1);
- roleList.add(role2);
- Mockito.when(roleService.getAvailableRoles(user.getOrgUserId())).thenReturn(roleList);
- assertNull(roleController.saveRole(mockedRequest, mockedResponse));
- }
+ @Test
+ public void saveNewRoleTest() throws IOException {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ String json = "{\"role\":{\"id\":null,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"name\":\"test1\",\"active\":false,\"priority\":\"1\",\"roleFunctions\":[],\"childRoles\":[],\"editUrl\":\"/role.htm?role_id=1\",\"toggleActiveImage\":\"/static/fusion/images/inactive.png\",\"toggleActiveAltText\":\"Click to Activate Role\"},\"childRoles\":[],\"roleFunctions\":[]}";
+ Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
+ Role role = new Role();
+ role.setId((long) 1);
+ Mockito.when(roleService.getRole(user.getOrgUserId(), role.getId())).thenReturn(role);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ List<Role> roleList = new ArrayList<Role>();
+ Role role1 = new Role();
+ role1.setName("TestRole1");
+ Role role2 = new Role();
+ role2.setName("TestRole2");
+ roleList.add(role1);
+ roleList.add(role2);
+ Mockito.when(roleService.getAvailableRoles(user.getOrgUserId())).thenReturn(roleList);
+ assertNull(roleController.saveRole(mockedRequest, mockedResponse));
+ }
- @Test
- public void saveNewRoleExceptionTestIfRoleNameExistsTest() throws IOException {
+ @Test
+ public void saveNewRoleExceptionTestIfRoleNameExistsTest() throws IOException {
- User user = new User();
- user.setOrgUserId("test12");
- Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
- String json = "{\"role\":{\"id\":null,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"name\":\"TestRole1\",\"active\":false,\"priority\":\"1\",\"roleFunctions\":[],\"childRoles\":[],\"editUrl\":\"/role.htm?role_id=1\",\"toggleActiveImage\":\"/static/fusion/images/inactive.png\",\"toggleActiveAltText\":\"Click to Activate Role\"},\"childRoles\":[],\"roleFunctions\":[]}";
- Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
- Role role = new Role();
- role.setId((long) 1);
- Mockito.when(roleService.getRole(user.getOrgUserId(), role.getId())).thenReturn(role);
- StringWriter sw = new StringWriter();
- PrintWriter writer = new PrintWriter(sw);
- Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
- List<Role> roleList = new ArrayList<Role>();
- Role role1 = new Role();
- role1.setName("TestRole1");
- Role role2 = new Role();
- role2.setName("TestRole2");
- roleList.add(role1);
- roleList.add(role2);
- Mockito.when(roleService.getAvailableRoles(user.getOrgUserId())).thenReturn(roleList);
- assertNull(roleController.saveRole(mockedRequest, mockedResponse));
- }
-
- @Test
- public void removeRoleFunctionTest() throws IOException
- {
- User user = new User();
- user.setOrgUserId("test12");
- Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
- String json = "{\"roleFunction\":{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"code\":\"menu_test\",\"name\":\"Test Menu\",\"editUrl\":\"/role_function.htm?role_function_id=menu_test\",\"$$hashKey\":\"object:1476\"}}";
- Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
- Role expectedRole = new Role();
- expectedRole.setId((long) 1);
- Mockito.when(roleService.getRole(Matchers.anyString(), Matchers.anyLong())).thenReturn(expectedRole);
- StringWriter sw = new StringWriter();
- PrintWriter writer = new PrintWriter(sw);
- Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
- assertNull(roleController.removeRoleFunction(mockedRequest, mockedResponse));
- }
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ String json = "{\"role\":{\"id\":null,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"name\":\"TestRole1\",\"active\":false,\"priority\":\"1\",\"roleFunctions\":[],\"childRoles\":[],\"editUrl\":\"/role.htm?role_id=1\",\"toggleActiveImage\":\"/static/fusion/images/inactive.png\",\"toggleActiveAltText\":\"Click to Activate Role\"},\"childRoles\":[],\"roleFunctions\":[]}";
+ Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
+ Role role = new Role();
+ role.setId((long) 1);
+ Mockito.when(roleService.getRole(user.getOrgUserId(), role.getId())).thenReturn(role);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ List<Role> roleList = new ArrayList<Role>();
+ Role role1 = new Role();
+ role1.setName("TestRole1");
+ Role role2 = new Role();
+ role2.setName("TestRole2");
+ roleList.add(role1);
+ roleList.add(role2);
+ Mockito.when(roleService.getAvailableRoles(user.getOrgUserId())).thenReturn(roleList);
+ assertNull(roleController.saveRole(mockedRequest, mockedResponse));
+ }
+
+ @Test
+ public void removeRoleFunctionTest() throws IOException
+ {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ String json = "{\"roleFunction\":{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"code\":\"menu_test\",\"name\":\"Test Menu\",\"editUrl\":\"/role_function.htm?role_function_id=menu_test\",\"$$hashKey\":\"object:1476\"}}";
+ Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
+ Role expectedRole = new Role();
+ expectedRole.setId((long) 1);
+ Mockito.when(roleService.getRole(Matchers.anyString(), Matchers.anyLong())).thenReturn(expectedRole);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(roleController.removeRoleFunction(mockedRequest, mockedResponse));
+ }
- @Test
- public void removeRoleFunctionExceptionTest() throws IOException
- {
- User user = new User();
- user.setOrgUserId("test12");
- Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
- String json = "{\"roleFunction\":{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"code\":\"menu_test\",\"name\":\"Test Menu\",\"editUrl\":\"/role_function.htm?role_function_id=menu_test\",\"$$hashKey\":\"object:1476\"}}";
- Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
- Role expectedRole = new Role();
- expectedRole.setId((long) 1);
- Mockito.when(roleService.getRole(Matchers.anyString(), Matchers.anyLong())).thenThrow(nullPointerException);
- StringWriter sw = new StringWriter();
- PrintWriter writer = new PrintWriter(sw);
- Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
- assertNull(roleController.removeRoleFunction(mockedRequest, mockedResponse));
- }
-
- @Test
- public void saveRoleFunctionTest() throws IOException
- {
- User user = new User();
- user.setOrgUserId("test12");
- Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
- String json = "{\"roleFunction\":{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"code\":\"menu_test\",\"name\":\"Test Menu\",\"editUrl\":\"/role_function.htm?role_function_id=menu_test\",\"$$hashKey\":\"object:1476\"}}";
- Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
- Role expectedRole = new Role();
- expectedRole.setId((long) 1);
- Mockito.when(roleService.getRole(Matchers.anyString(), Matchers.anyLong())).thenReturn(expectedRole);
- StringWriter sw = new StringWriter();
- PrintWriter writer = new PrintWriter(sw);
- Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
- assertNull(roleController.addRoleFunction(mockedRequest, mockedResponse));
- }
-
- @Test
- public void saveRoleFunctionExceptionTest() throws IOException
- {
- User user = new User();
- user.setOrgUserId("test12");
- Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
- String json = "{\"roleFunction\":{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"code\":\"menu_test\",\"name\":\"Test Menu\",\"editUrl\":\"/role_function.htm?role_function_id=menu_test\",\"$$hashKey\":\"object:1476\"}}";
- Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
- Role expectedRole = new Role();
- expectedRole.setId((long) 1);
- Mockito.when(roleService.getRole(Matchers.anyString(), Matchers.anyLong())).thenThrow(nullPointerException);
- StringWriter sw = new StringWriter();
- PrintWriter writer = new PrintWriter(sw);
- Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
- assertNull(roleController.addRoleFunction(mockedRequest, mockedResponse));
- }
+ @Test
+ public void removeRoleFunctionExceptionTest() throws IOException
+ {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ String json = "{\"roleFunction\":{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"code\":\"menu_test\",\"name\":\"Test Menu\",\"editUrl\":\"/role_function.htm?role_function_id=menu_test\",\"$$hashKey\":\"object:1476\"}}";
+ Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
+ Role expectedRole = new Role();
+ expectedRole.setId((long) 1);
+ Mockito.when(roleService.getRole(Matchers.anyString(), Matchers.anyLong())).thenThrow(nullPointerException);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(roleController.removeRoleFunction(mockedRequest, mockedResponse));
+ }
+
+ @Test
+ public void saveRoleFunctionTest() throws IOException
+ {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ String json = "{\"roleFunction\":{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"code\":\"menu_test\",\"name\":\"Test Menu\",\"editUrl\":\"/role_function.htm?role_function_id=menu_test\",\"$$hashKey\":\"object:1476\"}}";
+ Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
+ Role expectedRole = new Role();
+ expectedRole.setId((long) 1);
+ Mockito.when(roleService.getRole(Matchers.anyString(), Matchers.anyLong())).thenReturn(expectedRole);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(roleController.addRoleFunction(mockedRequest, mockedResponse));
+ }
+
+ @Test
+ public void removeChildRoleTest() throws IOException
+ {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ String json = "{\"role\":{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"name\":\"test role modified test\",\"active\":true,\"priority\":null,\"roleFunctions\":[{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"code\":\"menu_test\",\"name\":\"Test Menu\",\"editUrl\":\"/role_function.htm?role_function_id=menu_test\",\"$$hashKey\":\"object:1476\"}],\"childRole\":\"testChildRole\",\"editUrl\":\"/role.htm?role_id=9356\",\"toggleActiveImage\":\"/static/fusion/images/active.png\",\"toggleActiveAltText\":\"Click to Deactivate Role\"},\"childRoles\":[],\"roleFunctions\":[{\"id\":9356,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"code\":\"menu_test\",\"name\":\"Test Menu\",\"editUrl\":\"/role_function.htm?role_function_id=menu_test\",\"$$hashKey\":\"object:1476\"}]}";
+ Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
+ Role expectedRole = new Role();
+ expectedRole.setId((long) 1);
+ Mockito.when(roleService.getRole(Matchers.anyString(), Matchers.anyLong())).thenReturn(expectedRole);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(roleController.addChildRole(mockedRequest, mockedResponse));
+ assertNull(roleController.removeChildRole(mockedRequest, mockedResponse));
+ }
+
+ @Test
+ public void saveRoleFunctionExceptionTest() throws IOException
+ {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ String json = "{\"roleFunction\":{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"code\":\"menu_test\",\"name\":\"Test Menu\",\"editUrl\":\"/role_function.htm?role_function_id=menu_test\",\"$$hashKey\":\"object:1476\"}}";
+ Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
+ Role expectedRole = new Role();
+ expectedRole.setId((long) 1);
+ Mockito.when(roleService.getRole(Matchers.anyString(), Matchers.anyLong())).thenThrow(nullPointerException);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(roleController.addRoleFunction(mockedRequest, mockedResponse));
+ }
}
diff --git a/ecomp-sdk/epsdk-app-os/db-scripts/readme b/ecomp-sdk/epsdk-app-os/db-scripts/readme
index 0330789d..81944bb7 100644
--- a/ecomp-sdk/epsdk-app-os/db-scripts/readme
+++ b/ecomp-sdk/epsdk-app-os/db-scripts/readme
@@ -9,22 +9,22 @@ Directions:
DDL
For ONAP Amsterdam instance run EcompSdkDDLMySql_1710_Common.sql add script EcompSdkDDLMySql_1710_OS.sql.
-EcompSdkDDLMySql_1710_Common.sql - this is the DDL entries that both Opensource and AT&T have in common
+EcompSdkDDLMySql_1710_Common.sql - this is a common DDL file
EcompSdkDDLMySql_1710_OS.sql - this is the specific DDL entries that only OS needs, empty placeholder
For ONAP Beijing instance run EcompSdkDDLMySql_2_1_Common.sql add script EcompSdkDDLMySql_2_1_OS.sql.
-EcompSdkDDLMySql_2_1_Common.sql - this is the DDL entries that both Opensource and AT&T have in common
+EcompSdkDDLMySql_2_1_Common.sql - this is a common DDL file
EcompSdkDDLMySql_2_1_OS.sql - this is the specific DDL entries that only OS needs, empty placeholder
For ONAP Beijing instance run EcompSdkDDLMySql_2_2_common.sql and script EcompSdkDDLMySql_2_2_OS.sql.
-EcompSdkDDLMySql_2_2_Common.sql - this is the DDL entries that both Opensource and AT&T have in common
+EcompSdkDDLMySql_2_2_Common.sql - this is a common DDL file
EcompSdkDDLMySql_2_2_OS.sql - this is the specific DDL entries that only OS needs, empty placeholder
For ONAP Casablanca instance run EcompSdkDDLMySql_2_4_common.sql and script EcompSdkDDLMySql_2_4_OS.sql.
-EcompSdkDDLMySql_2_4_Common.sql - this is the DDL entries that both Opensource and AT&T have in common
+EcompSdkDDLMySql_2_4_Common.sql - this is a common DDL file
EcompSdkDDLMySql_2_4_OS.sql - this is the specific DDL entries that only OS needs, empty placeholder
DML
@@ -63,4 +63,4 @@ EcompSdkMySql_Rollback_2_1_to_1710_Common.sql
Our Existing Partner Apps can call the following scripts to upgrade from 2_1 to 2_2 version
EcompSdkMySql_Upgrade_2_1_to_2_2_Common.sql
-EcompSdkMySql_Rollback_2_2_to_2_1_Common.sql \ No newline at end of file
+EcompSdkMySql_Rollback_2_2_to_2_1_Common.sql
diff --git a/ecomp-sdk/epsdk-app-os/src/main/resources/music.properties b/ecomp-sdk/epsdk-app-os/src/main/resources/music.properties
index d7951560..93e82e19 100644
--- a/ecomp-sdk/epsdk-app-os/src/main/resources/music.properties
+++ b/ecomp-sdk/epsdk-app-os/src/main/resources/music.properties
@@ -13,19 +13,19 @@ music.cleanup.frequency = 6
#how old of session need to be cleaned up (hour)
music.cleanup.threshold = 10
music.enable = false
-cassandra.host=135.197.226.103
-zookeeper.host=135.197.226.103, 135.197.226.108, 135.197.226.119
+cassandra.host=localhost
+zookeeper.host=localhost1,localhost2,localhost3
cassandra.user=cassandra
cassandra.password=cassandra
#Music API
-#music.endpoint = http://vm-ep-dev4.research.att.com/MUSIC/rest/
+#music.endpoint = http://localhost/MUSIC/rest/
#music.version = v2
#music.keyspace = keyspaces
#music.x.minor.version = 3
#music.x.patch.version = 0
-#music.ns = com.att.ecomp.portal.demeter
-#music.user.id = m00468@portal.ecomp.att.com
-#music.password = friedG33nS-
+#music.ns = org.onap.portal
+#music.user.id = xxxxxx@org.onap.portal
+#music.password =
#music.consistency.info = type
-#music.consistency.info.value = eventual \ No newline at end of file
+#music.consistency.info.value = eventual
diff --git a/ecomp-sdk/epsdk-app-os/src/main/resources/portal.properties b/ecomp-sdk/epsdk-app-os/src/main/resources/portal.properties
index 05fd65c2..80a6b2b1 100644
--- a/ecomp-sdk/epsdk-app-os/src/main/resources/portal.properties
+++ b/ecomp-sdk/epsdk-app-os/src/main/resources/portal.properties
@@ -2,7 +2,7 @@
# ============LICENSE_START==========================================
# ONAP Portal SDK
# ===================================================================
-# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -35,7 +35,7 @@
#
#
###
-# Properties read by ECOMP Framework library, ecompFW.jar
+# Properties read by ONAP Portal Framework library, ecompFW.jar
##########################################################################
# The following properties should NOT be changed by partner applications.
@@ -56,10 +56,10 @@ use_rest_for_functional_menu=true
portal.api.impl.class = org.onap.portalapp.service.OnBoardingApiServiceImpl
# URL of the Portal where this app is onboarded
-ecomp_redirect_url = https://portal.onap.org/ecompportal/process_csp
+ecomp_redirect_url = http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm
-# URL of the ECOMP Portal REST API
-ecomp_rest_url = http://portal.onap.org:50580/ecompportal/auxapi
+# URL of the ONAP Portal REST API
+ecomp_rest_url = http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/auxapi
# Applications do not need to run a UEB listener after 1607.
ueb_listeners_enable = false
diff --git a/ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/web.xml b/ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/web.xml
index 8392e8d4..a87e478d 100644
--- a/ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/web.xml
+++ b/ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/web.xml
@@ -1,9 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!---
+ ===============LICENSE_START=======================================================
+ ONAP Portal SDK
+ ===================================================================================
+ Copyright (C) 2017-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 file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ This file 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=========================================================
+
+-->
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee">
- <display-name>ecomp-sdk-app-os</display-name>
+ <display-name>ONAPPORTALSDK</display-name>
<!-- The app can function on a HA cluster -->
<distributable />
@@ -35,4 +57,4 @@
<location>/WEB-INF/jsp/error.jsp</location>
</error-page>
-</web-app> \ No newline at end of file
+</web-app>
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java
index d60fe567..d250591e 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java
@@ -2,7 +2,7 @@
* ============LICENSE_START==========================================
* ONAP Portal SDK
* ===================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
* ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
@@ -60,11 +60,11 @@ public class EELFLoggerAdvice {
@Autowired
private AppService appService;
- // DateTime Format according to the ECOMP Application Logging Guidelines.
+ // DateTime Format according to the ONAP Application Logging Guidelines.
private static final SimpleDateFormat ecompLogDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
/**
- * Gets the current date and time in expected ECOMP log format.
+ * Gets the current date and time in expected ONAP log format.
*
* @return Current date and time
*/
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/onboarding/ueb/FunctionalMenuTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/onboarding/ueb/FunctionalMenuTest.java
new file mode 100644
index 00000000..6db82369
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/onboarding/ueb/FunctionalMenuTest.java
@@ -0,0 +1,53 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2018 IBM 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.core.onboarding.ueb;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class FunctionalMenuTest {
+
+ String userId="USERID";
+ @Test(expected=UebException.class)
+ public void testGet() throws Exception{
+ assertNotNull(FunctionalMenu.get(userId));
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/onboarding/ueb/UebExceptionTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/onboarding/ueb/UebExceptionTest.java
new file mode 100644
index 00000000..fa2ab40a
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/onboarding/ueb/UebExceptionTest.java
@@ -0,0 +1,66 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2018 IBM 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.core.onboarding.ueb;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class UebExceptionTest {
+
+ UebException uebException;
+ private String ERRORMSG="Test Error";
+ private String TOPICNAME="Test Topic";
+ private String MSGID="Test Message ID";
+ private String MSG="Test Message";
+
+ @Before
+ public void init(){
+ uebException= new UebException(ERRORMSG,TOPICNAME,MSGID,MSG);
+ }
+
+ @Test
+ public void testUebException() {
+ assertNotNull(uebException);
+ assertEquals(MSG, uebException.getUebMsg());
+ assertEquals(TOPICNAME, uebException.getTopicName());
+ assertEquals(MSGID, uebException.getMsgId());
+ }
+}
diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/CipherUtil.java b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/CipherUtil.java
index c92efb79..90addfe5 100644
--- a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/CipherUtil.java
+++ b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/CipherUtil.java
@@ -2,7 +2,7 @@
* ============LICENSE_START==========================================
* ONAP Portal SDK
* ===================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
* ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
@@ -208,7 +208,7 @@ public class CipherUtil {
* Decrypts the text using the secret key in key.properties file.
*
* @param message
- * The encrypted string that must be decrypted using the ecomp
+ * The encrypted string that must be decrypted using the ONAP Portal
* Encryption Key
* @return The String decrypted
* @throws CipherUtilException
diff --git a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/InMemoryRestServer.java b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/InMemoryRestServer.java
index 2c37e214..3877ae20 100644
--- a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/InMemoryRestServer.java
+++ b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/InMemoryRestServer.java
@@ -1,20 +1,39 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 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
- *
- * https://github.com/mp911de/rest-api-test
- *
- * Embedded InMemory REST server for RESTEasy. Usage:
- * <ul>
- * <li>InMemoryRestServer srv = InMemoryRestServer.create(...) passing your resources and provider classes</li>
- * <li>srv.baseUri() for BaseUrl</li>
- * <li>srv.newRequest("/relative/resource/path") to issue requests</li>
- * <li>srv.close() to stop</li>
- * </ul>
*
+ * 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.fw.test;
diff --git a/ecomp-sdk/epsdk-workflow/src/test/java/org/onap/portalsdk/rnotebookintegration/exception/RNotebookIntegrationExceptionTest.java b/ecomp-sdk/epsdk-workflow/src/test/java/org/onap/portalsdk/rnotebookintegration/exception/RNotebookIntegrationExceptionTest.java
new file mode 100644
index 00000000..da14f31e
--- /dev/null
+++ b/ecomp-sdk/epsdk-workflow/src/test/java/org/onap/portalsdk/rnotebookintegration/exception/RNotebookIntegrationExceptionTest.java
@@ -0,0 +1,56 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2018 IBM 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.rnotebookintegration.exception;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import static org.junit.Assert.assertEquals;
+
+@RunWith(MockitoJUnitRunner.class)
+public class RNotebookIntegrationExceptionTest {
+
+ @Test
+ public void getErrorCodeTest(){
+ RNotebookIntegrationException rNoteObj = new RNotebookIntegrationException(new Exception());
+ RNotebookIntegrationException rNoteObjErrorCode = new RNotebookIntegrationException("1");
+ assertEquals("1",rNoteObjErrorCode.getErrorCode());
+ }
+}