summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics/src
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java13
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java9
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java2
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/RemoteDbUtils.java8
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java42
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/RemDbInfo.java52
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/RaptorControllerAsyncTest.java16
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/RaptorControllerAsyncNewTest.java27
-rw-r--r--ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportWrapperTest.java4
9 files changed, 136 insertions, 37 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java
index 97faffb1..1dce0e36 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java
@@ -3684,11 +3684,10 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject {
setWholeSQL(reportSQL);
if(nvl(reportSQL).length()>0)
reportSQL = generateSQL(userId, request);
-
- if (reportSQL.toUpperCase().indexOf("ORDER BY ") < 0) {
+ if (nvl(reportSQL).toUpperCase().indexOf("ORDER BY ") < 0) {
StringBuffer sortBy = null;
- if (reportSQL.toUpperCase().indexOf("GROUP BY ") < 0)
+ if (nvl(reportSQL).toUpperCase().indexOf("GROUP BY ") < 0)
if (getDataSourceList().getDataSource().size() > 0) {
DataSourceType dst = (DataSourceType) getDataSourceList().getDataSource()
.get(0);
@@ -3706,15 +3705,17 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject {
} // while
}
} // if
- if (reportSQL.trim().toUpperCase().startsWith("SELECT")) {
+ if (nvl(reportSQL).trim().toUpperCase().startsWith("SELECT")) {
//if (!(dbType.equals("DAYTONA") && reportSQL.trim().toUpperCase().startsWith("SELECT")))
// reportSQL += " ORDER BY " + ((sortBy == null) ? "1" : sortBy.toString());
}
}
-
StringBuffer colNames = new StringBuffer();
StringBuffer colExtraIdNames = new StringBuffer();
StringBuffer colExtraDateNames = new StringBuffer();
+ if(getDBType()!=null && getDBType().equals(AppConstants.ORACLE)) {
+ colNames.append("rownum rnum");
+ }
if(getColumnNamesFromReportSQL) {
DataSet ds = ConnectionUtils.getDataSet(reportSQL, dbInfo);
@@ -3848,7 +3849,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject {
partSql = partSql+ " LIMIT "+ String.valueOf(startRow)+" , "+ String.valueOf(endRow);
} else if(getDBType().equals(AppConstants.ORACLE)) {
reportSQL = reportSQL.replace(" AS ", " ");
- partSql = "where rownum >= "+ String.valueOf(startRow)+" and rownum <= "+(Integer.parseInt(String.valueOf(startRow)) + Integer.parseInt(String.valueOf(endRow)));
+ partSql = "where rnum >= "+ String.valueOf(startRow)+" and rnum <= "+(Integer.parseInt(String.valueOf(startRow)) + Integer.parseInt(String.valueOf(endRow)));
} else if(getDBType().equals(AppConstants.POSTGRESQL)) {
partSql = partSql + " LIMIT "+ String.valueOf(endRow)+" , "+ String.valueOf(startRow);//limit [pageSize] offset [startRow]
}
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java
index 47b1ef9e..483505af 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java
@@ -51,6 +51,7 @@ public class DefinitionJSON implements WizardJSON {
private String dbInfo;
private String formHelpText;
private Integer pageSize;
+ private List<IdNameBooleanJSON> dbInfoList = null;
private List<IdNameBooleanJSON> displayArea = null;
private Boolean hideFormFieldsAfterRun;
private Integer maxRowsInExcelCSVDownload;
@@ -327,5 +328,11 @@ public class DefinitionJSON implements WizardJSON {
this.repDefType = repDefType;
}
-
+ public List<IdNameBooleanJSON> getDbInfoList() {
+ return dbInfoList;
+ }
+
+ public void setDbInfoList(List<IdNameBooleanJSON> dbInfoList) {
+ this.dbInfoList = dbInfoList;
+ }
}
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java
index bb99318f..4b72502f 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java
@@ -1338,7 +1338,7 @@ public class ReportRuntime extends ReportWrapper implements Cloneable, Serializa
DataColumnType dct = (DataColumnType) reportCols.get(c);
DataValue dv = new DataValue();
dr.addDataValue(dv);
- dv.setDisplayValue(ds.getString(r, c));
+ dv.setDisplayValue(ds.getString(r, ds.getColumnIndex(dct.getColId())));
dv.setColName(dct.getColName());
dv.setColId(dct.getColId());
dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/RemoteDbUtils.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/RemoteDbUtils.java
index 032b394b..fcff3183 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/RemoteDbUtils.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/RemoteDbUtils.java
@@ -58,7 +58,13 @@ public class RemoteDbUtils implements RDbUtils{
public Connection getRemoteConnection(String dbKey) {
- return raptorAdapter.getConnection(dbKey);
+ try {
+ org.onap.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.onap.portalsdk.analytics.util.RemDbInfo();
+ return remDbInfo.getDBConnection(dbKey);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ return null;
+ }
}
public void clearConnection(Connection conn) {
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java
index e06a1765..c761bdcc 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java
@@ -96,6 +96,7 @@ import org.onap.portalsdk.analytics.model.runtime.ReportFormFields;
import org.onap.portalsdk.analytics.model.runtime.ReportRuntime;
import org.onap.portalsdk.analytics.system.AppUtils;
import org.onap.portalsdk.analytics.system.ConnectionUtils;
+import org.onap.portalsdk.analytics.system.DbUtils;
import org.onap.portalsdk.analytics.system.Globals;
import org.onap.portalsdk.analytics.util.AppConstants;
import org.onap.portalsdk.analytics.util.DataSet;
@@ -711,6 +712,24 @@ public class RaptorControllerAsync extends RestrictedBaseController {
// }
if (rdef != null) {
+ String dbInfo = definitionJSON.getDbInfo();
+ rdef.setDBInfo(dbInfo);
+ //save dbType
+ String schemaSql = Globals.getRemoteDbSchemaSqlWithWhereClause();
+ schemaSql = schemaSql.replace("[schema_id]", dbInfo);
+ String dbType = null;
+ DataSet ds = null;
+ try {
+ ds = DbUtils.executeQuery(schemaSql);
+
+ String prefix = "", desc = "";
+
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ dbType = ds.getItem(i, 2);
+ }
+ }
+ catch (Exception e) {}
+ rdef.setDBType(dbType);
String reportName = definitionJSON.getReportName();
String errorString = "";
if (AppUtils.nvl(reportName).length() <= 0)
@@ -1358,6 +1377,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
if (pathVariables.containsKey("id")) {
id = pathVariables.get("id");
}
+
String detailId = "";
if (pathVariables.containsKey("detailId")) {
detailId = pathVariables.get("detailId");
@@ -1467,6 +1487,26 @@ public class RaptorControllerAsync extends RestrictedBaseController {
wizardJSON.setReportTitle((rdef != null) ? rdef.getReportTitle() : "");
wizardJSON.setReportSubTitle((rdef != null) ? rdef.getReportSubTitle() : "");
+
+ String schemaSql = Globals.getRemoteDbSchemaSql();
+ DataSet ds = null;
+ ArrayList<IdNameBooleanJSON> dbInfoList = new ArrayList<IdNameBooleanJSON>();
+ try {
+ ds = DbUtils.executeQuery(schemaSql);
+
+ String prefix = "", desc = "";
+
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ IdNameBooleanJSON dBNameJSON = new IdNameBooleanJSON();
+ dBNameJSON.setId(ds.getItem(i, 0));
+ dBNameJSON.setName(ds.getItem(i, 0));
+ dBNameJSON.setSelected(false);
+ dbInfoList.add(dBNameJSON);
+ }
+ }
+ catch (Exception e) {}
+ wizardJSON.setDbInfoList(dbInfoList);
+
/*Robert add*/
wizardJSON.setOneTimeRec((rdef != null) ? rdef.getIsOneTimeScheduleAllowed() : "false");
wizardJSON.setHourlyRec((rdef != null) ? rdef.getIsHourlyScheduleAllowed() : "false");
@@ -1572,7 +1612,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
try {
response.setContentType("application/json");
- ds = ConnectionUtils.getDataSet(sql, "local", true);
+ ds = ConnectionUtils.getDataSet(sql, rdef.getDBInfo(), true);
QueryResultJSON queryResultJSON = new QueryResultJSON();
queryResultJSON.setQuery(queryJSON.getQuery());
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/RemDbInfo.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/RemDbInfo.java
index 0b9e08c7..57c1e31d 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/RemDbInfo.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/RemDbInfo.java
@@ -37,24 +37,40 @@
*/
package org.onap.portalsdk.analytics.util;
+import java.sql.Connection;
import java.util.HashMap;
+import javax.servlet.ServletContext;
+
import org.onap.portalsdk.analytics.system.DbUtils;
import org.onap.portalsdk.analytics.system.Globals;
+import org.onap.portalsdk.analytics.system.fusion.adapter.RaptorAdapter;
+import org.onap.portalsdk.analytics.system.fusion.adapter.SpringContext;
+
+import com.mchange.v2.c3p0.ComboPooledDataSource;
public class RemDbInfo {
private HashMap remDbMap = null;
private HashMap remDbTypeMap = null;
+ private HashMap remDbConnectionMap = null;
public RemDbInfo() throws Exception {
if (remDbMap == null) {
load();
}
}
+
+ private RaptorAdapter raptorAdapter;
+
+
+ public void initializeDbUtils(ServletContext servletContext) {
+ raptorAdapter = (RaptorAdapter)SpringContext.getApplicationContext().getBean("raptorAdapter");
+ } // initializeDbUtils
public void load() throws Exception {
remDbMap = new HashMap();
remDbTypeMap = new HashMap();
+ remDbConnectionMap = new HashMap();
try {
//String query = " SELECT a.SCHEMA_ID, a.SCHEMA_DESC, DATASOURCE_TYPE, rownum id FROM SCHEMA_INFO a " +
// " where schema_id = 'local' union " +
@@ -65,20 +81,35 @@ public class RemDbInfo {
Globals.getDbUtils();
ds = DbUtils.executeQuery(query);
- String prefix = "", desc = "", dbType = "";
+ String prefix = "", desc = "", dbType = "", connectionUrl = "", username = "", password = "", driver_class = "";
if(ds.getRowCount() > 0) {
for (int i = 0; i < ds.getRowCount(); i++) {
- prefix = ds.getItem(i, 0);
- desc = ds.getItem(i, 1);
- dbType = ds.getItem(i, 2);
+ prefix = ds.getItem(i, 0);
+ desc = ds.getItem(i, 1);
+ dbType = ds.getItem(i, 2);
+ connectionUrl = ds.getItem(i, 3);
+ username = ds.getItem(i, 4);
+ password = ds.getItem(i, 5);
+ driver_class = ds.getItem(i, 6);
+
+ ComboPooledDataSource cpds = new ComboPooledDataSource();
+ cpds.setDriverClass( driver_class ); //loads the jdbc driver
+ cpds.setJdbcUrl( connectionUrl);
+ cpds.setUser(username);
+ cpds.setPassword(password);
+
+
+
remDbMap.put(prefix, desc);
remDbTypeMap.put(prefix, dbType);
+ remDbConnectionMap.put(prefix, cpds);
}
} else {
remDbMap.put("local", "local");
remDbTypeMap.put("local", Globals.getDBType());
+ remDbConnectionMap.put("local", raptorAdapter.getConnection());
}
}
catch (Exception e) {}
@@ -100,6 +131,19 @@ public class RemDbInfo {
return "";
}
+
+ public Connection getDBConnection(String prefix) {
+ if ((remDbConnectionMap != null) && (remDbConnectionMap.containsKey(prefix))) {
+ try {
+ return ((ComboPooledDataSource) remDbConnectionMap.get(prefix)).getConnection();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ return null;
+ }
+ }
+
+ return null;
+ }
public HashMap getDbHash() {
return remDbMap;
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/RaptorControllerAsyncTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/RaptorControllerAsyncTest.java
index c5010c1a..909fec8c 100644
--- a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/RaptorControllerAsyncTest.java
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/runtime/RaptorControllerAsyncTest.java
@@ -353,7 +353,7 @@ public class RaptorControllerAsyncTest {
Mockito.when(rsmd.getColumnCount()).thenReturn(1);
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -400,7 +400,7 @@ public class RaptorControllerAsyncTest {
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
// datset = new DataSet(rs);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -448,7 +448,7 @@ public class RaptorControllerAsyncTest {
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
// datset = new DataSet(rs);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -480,7 +480,7 @@ public class RaptorControllerAsyncTest {
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
// datset = new DataSet(rs);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -515,7 +515,7 @@ public class RaptorControllerAsyncTest {
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
// datset = new DataSet(rs);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -546,7 +546,7 @@ public class RaptorControllerAsyncTest {
Mockito.when(rsmd.getColumnCount()).thenReturn(1);
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -577,7 +577,7 @@ public class RaptorControllerAsyncTest {
Mockito.when(rsmd.getColumnCount()).thenReturn(1);
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -685,7 +685,7 @@ public class RaptorControllerAsyncTest {
PowerMockito.mockStatic(DbUtils.class);
Mockito.when(Globals.getReportUserAccess()).thenReturn("test");
DataSet datset = PowerMockito.mock(DataSet.class);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
CustomReportType customReportType = new CustomReportType();
customReportType.setReportType("test");
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/RaptorControllerAsyncNewTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/RaptorControllerAsyncNewTest.java
index f761733b..5b2da9ca 100644
--- a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/RaptorControllerAsyncNewTest.java
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/RaptorControllerAsyncNewTest.java
@@ -161,7 +161,7 @@ public class RaptorControllerAsyncNewTest {
Mockito.when(rsmd.getColumnCount()).thenReturn(1);
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -241,7 +241,7 @@ public class RaptorControllerAsyncNewTest {
Mockito.when(rsmd.getColumnCount()).thenReturn(1);
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -301,7 +301,7 @@ public class RaptorControllerAsyncNewTest {
Mockito.when(rsmd.getColumnCount()).thenReturn(1);
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -370,7 +370,7 @@ public class RaptorControllerAsyncNewTest {
Mockito.when(rsmd.getColumnCount()).thenReturn(1);
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -431,7 +431,7 @@ public class RaptorControllerAsyncNewTest {
Mockito.when(rsmd.getColumnCount()).thenReturn(1);
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -467,7 +467,7 @@ public class RaptorControllerAsyncNewTest {
Mockito.when(rsmd.getColumnCount()).thenReturn(1);
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -509,7 +509,7 @@ public class RaptorControllerAsyncNewTest {
Mockito.when(rsmd.getColumnCount()).thenReturn(1);
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -572,7 +572,7 @@ public class RaptorControllerAsyncNewTest {
Mockito.when(rsmd.getColumnCount()).thenReturn(1);
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -599,7 +599,7 @@ public class RaptorControllerAsyncNewTest {
Mockito.when(rsmd.getColumnCount()).thenReturn(1);
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -836,7 +836,7 @@ public class RaptorControllerAsyncNewTest {
Mockito.when(rsmd.getColumnCount()).thenReturn(1);
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -943,7 +943,7 @@ public class RaptorControllerAsyncNewTest {
Mockito.when(rsmd.getColumnCount()).thenReturn(1);
Mockito.when(rs.getMetaData()).thenReturn(rsmd);
DataSet datset = PowerMockito.mock(DataSet.class);
- Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn(null);
+ Mockito.when(datset.getString(Matchers.anyInt(), Matchers.anyString())).thenReturn(null);
Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(datset);
Mockito.when(Globals.getNewScheduleData()).thenReturn("test");
CustomReportType customReportType = new CustomReportType();
@@ -1342,7 +1342,7 @@ public class RaptorControllerAsyncNewTest {
public void retrieveDataForGivenQuery2Test() throws Exception
{
QueryJSON queryJSON = new QueryJSON();
- queryJSON.setQuery("select");
+ queryJSON.setQuery("test");
ServletContext servletContext = PowerMockito.mock(ServletContext.class);
Mockito.when(mockedRequest.getSession().getServletContext()).thenReturn(servletContext);
ReportDefinition rdf1 = PowerMockito.mock(ReportDefinition.class);
@@ -1378,8 +1378,7 @@ public class RaptorControllerAsyncNewTest {
assertEquals(raptorControllerAsync.nvl("test"),"test");
assertEquals(raptorControllerAsync.nvl("","default"),"default");
assertEquals(raptorControllerAsync.nvl("test","default"),"test");
-
-
+
raptorControllerAsync.retrieveDataForGivenQuery(false, queryJSON, mockedRequest, mockedResponse);
}
diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportWrapperTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportWrapperTest.java
index de3f4fff..073a413d 100644
--- a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportWrapperTest.java
+++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/xmlobj/ReportWrapperTest.java
@@ -79,6 +79,7 @@ import org.owasp.esapi.ESAPI;
import org.owasp.esapi.Encoder;
import org.owasp.esapi.codecs.Codec;
import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@@ -86,6 +87,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
@PrepareForTest({ AppConstants.class, Globals.class, AppUtils.class, DataCache.class, DbUtils.class, DataSet.class,
ReportLoader.class, ReportRuntime.class, Utils.class, ESAPI.class, Codec.class, SecurityCodecUtil.class,
ConnectionUtils.class, XSSFilter.class, ReportDefinition.class, UserUtils.class, ReportWrapper.class })
+@PowerMockIgnore("javax.management.*")
public class ReportWrapperTest {
MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
@@ -1721,4 +1723,4 @@ public class ReportWrapperTest {
}
-} \ No newline at end of file
+}