summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/test')
-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/error/UserAccessExceptionTest.java56
-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/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/RowHeaderColTest.java63
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/view/RowHeaderTest.java35
8 files changed, 205 insertions, 49 deletions
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/error/UserAccessExceptionTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/error/UserAccessExceptionTest.java
new file mode 100644
index 00000000..0a3bc2a7
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/error/UserAccessExceptionTest.java
@@ -0,0 +1,56 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 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.error;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class UserAccessExceptionTest {
+
+ @Test
+ public void testErrorMsg() {
+ UserAccessException userAccessException = new UserAccessException("","","");
+ assertEquals("Access denied. Please contact Administrator", userAccessException.getMessage());
+ }
+
+}
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/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/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());
+ }
}