summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRAMALINGAM, SUNDAR (sr7234) <sr7234@us.att.com>2018-07-25 16:13:16 -0400
committerRAMALINGAM, SUNDAR (sr7234) <sr7234@us.att.com>2018-07-25 16:13:56 -0400
commit40a17c1d7e5f0edca350a49210e16223a875d290 (patch)
treead3a6b61fe17444dde4bf88f4dfd1cba2636f065
parent39191aaa6cf9f9d164c995e580c7df418b59b5c9 (diff)
Reporting Enhancements
Issue-ID: PORTAL-314 Remote DB logic is added to enhance RAPTOR to pull content from different DB as well as Different DB TYPE Change-Id: I5cb343cd9daa912d78e7a8e409d28c8845d9afb4 Signed-off-by: RAMALINGAM, SUNDAR (sr7234) <sr7234@us.att.com>
-rw-r--r--ecomp-sdk/epsdk-analytics/README.md6
-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
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/conf/sql.properties4
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-run-controller.js7
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-step-controller.js18
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/report-run.html2
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/steps/step1.html17
15 files changed, 176 insertions, 51 deletions
diff --git a/ecomp-sdk/epsdk-analytics/README.md b/ecomp-sdk/epsdk-analytics/README.md
index 9c3ce95d..917de951 100644
--- a/ecomp-sdk/epsdk-analytics/README.md
+++ b/ecomp-sdk/epsdk-analytics/README.md
@@ -11,6 +11,12 @@ features including charts, maps and reports ("Raptor").
### ONAP Distributions
+Version 2.5.0
+- PORTAL-314 Fixed Bug for chart not showing up and for remote connection map bug (sql.properties).
+- PORTAL-314 Fixed Bug due to test java in analytics section.
+- PORTAL-314 Remote DB logic is added to enhance RAPTOR to pull content from different DB as well as Different DB TYPE
+
+
Version 1.4.0
- PORTAL-19 Rename Java package base to org.onap
- PORTAL-72 Address Sonar Scan code issues
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
+}
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/conf/sql.properties b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/conf/sql.properties
index c643bb97..c5e4b57b 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/conf/sql.properties
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/conf/sql.properties
@@ -5,8 +5,8 @@
load.custom.report.xml = SELECT cr.report_xml FROM cr_report cr WHERE rep_id=?
# need to copy to oracle
-load.remoteDB.schema = SELECT 'local' SCHEMA_ID, 'local' SCHEMA_DESC, null DATASOURCE_TYPE FROM dual union SELECT a.SCHEMA_ID, a.SCHEMA_DESC, DATASOURCE_TYPE FROM SCHEMA_INFO a where schema_id <> 'local' order by schema_id
-load.remoteDB.schema.where = SELECT a.SCHEMA_ID, a.SCHEMA_DESC, DATASOURCE_TYPE FROM SCHEMA_INFO a where schema_id = '[schema_id]'
+load.remoteDB.schema = SELECT 'local' SCHEMA_ID, 'local' SCHEMA_DESC, null DATASOURCE_TYPE, null CONNECTION_URL, null USER_NAME, null PASS, null DRIVER_CLASS FROM dual union SELECT a.SCHEMA_ID, a.SCHEMA_DESC, DATASOURCE_TYPE, CONNECTION_URL, USER_NAME, PASSWORD, DRIVER_CLASS FROM SCHEMA_INFO a where schema_id <> 'local' order by schema_id
+load.remoteDB.schema.where = SELECT a.SCHEMA_ID, a.SCHEMA_DESC, DATASOURCE_TYPE, CONNECTION_URL, USER_NAME, PASSWORD, DRIVER_CLASS FROM SCHEMA_INFO a where schema_id = '[schema_id]'
#formfield rendering
formfield.id.name.sql.prefix=SELECT id, name FROM (
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-run-controller.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-run-controller.js
index daa47900..45c300fe 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-run-controller.js
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-run-controller.js
@@ -80,8 +80,8 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams','
}
else
$scope.reportData.reportHeading = $scope.reportData.reportName;
- if(!$scope.urlParams.hideChart && $scope.reportData.chartAvailable && $scope.reportData.totalRows>1){
- // console.log('raptor.htm?action=chart.run&'+convertQueryString($scope.urlParams));
+ if( ($scope.urlParams.hideChart === undefined || $scope.urlParams.hideChart) && $scope.reportData.chartAvailable && $scope.reportData.totalRows>=1){
+ //console.log('raptor.htm?action=chart.run&'+convertQueryString($scope.urlParams));
$http.get('raptor.htm?action=chart.run&'+convertQueryString($scope.urlParams)).then(
function(response){
$scope.showChart = true;
@@ -175,7 +175,7 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams','
//console.log(stacktraceFP + " " + $scope.reportData.errormessage);
}
if(!pagination) {
- if(!$scope.urlParams.hideChart && $scope.reportData.chartAvailable && $scope.reportData.totalRows>1){
+ if( ($scope.urlParams.hideChart === undefined || $scope.urlParams.hideChart) && $scope.reportData.chartAvailable && $scope.reportData.totalRows>=1){
// console.log('raptor.htm?action=chart.run&c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'display_content=Y&r_page='+(paginationOptions.pageNumber-1));
$http.get('raptor.htm?action=chart.run&c_master='+$scope.urlParams.c_master+'&'+formFieldsUrl+'display_content=Y&r_page='+(paginationOptions.pageNumber-1)).then(
function(response) {
@@ -209,6 +209,7 @@ appDS2.controller("reportRunController", ['$scope','$rootScope','$routeParams','
$scope.gridOptions = {
pageNumber: 1,
+ useExternalPagination: true,
sort : null,
paginationPageSizes: [5],
paginationPageSize: 5,
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-step-controller.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-step-controller.js
index 43f877c3..54a14242 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-step-controller.js
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-step-controller.js
@@ -95,8 +95,14 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
{name:'HidePdf', selected:false}
]
+/* $scope.definitionData.dbSrcOptions=[
+ {text:'local', value:'local', selected:true},
+ {text:'e911dev_leto07', value:'e911dev_leto07', selected:false},
+ ]*/
+
$scope.pageSizeValues=['10','25','50','100','500'];
$scope.pageSizeOptions =[];
+ $scope.dbSrcOptions =[];
$scope.maxRowValues = ['500','1000','2000','3000','4000','5000','10000','15000','20000','25000','30000','35000','40000','45000','50000','65000']
$scope.maxRowOptions =[];
$scope.frozenColValues = ['0','1','2','3','4'];
@@ -110,7 +116,8 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
/******create*****/
if(!$scope.isEdit){
$scope.definitionData.reportType = 'Linear';
- $scope.definitionData.dbInfo = 'Local';
+ //$scope.definitionData.dbInfo = 'Local';
+ //$scope.definitionData.dbSrcOptions = ['Local'];
}
/****end create***/
@@ -120,6 +127,10 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
raptorReportFactory.getDefinitionByReportId(id).then(function(data){
$scope.showLoader=false;
$scope.definitionData = data;
+ $scope.definitionData.dbSrc=data.dbInfo;
+ $scope.definitionData.dbSrcOptions = data.dbInfoList;
+ console.log($scope.definitionData.dbSrcOptions[0].name);
+
$scope.showLoader = false;
for(x in data.displayOptions){
if(data.displayOptions[x].name=='HideFormFields')
@@ -156,6 +167,7 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
}
$scope.constructureDefDropDown = function(){
+
for(i in $scope.pageSizeValues){
var v = {
value :$scope.pageSizeValues[i],
@@ -202,6 +214,10 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
$scope.constructDef = function(){
var data =Object.assign({}, $scope.definitionData);
+ if($scope.definitionData.dbSrc){
+ console.log("Hello World ", $scope.definitionData.dbSrc);
+ data.dbInfo = $scope.definitionData.dbSrc;
+ }
for(x in $scope.definitionData.displayOptions){
if($scope.definitionData.displayOptions[x].name=='HideFormFields')
data.displayOptions[x].selected = $scope.displayOptions.hideFormFields
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/report-run.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/report-run.html
index 7b2c23e1..ba609151 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/report-run.html
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/report-run.html
@@ -112,7 +112,7 @@ body {
<div ng-if="showGrid">
<div id="grid1" ui-grid="gridOptions" ui-grid-pagination
ui-grid-pinning ui-grid-resize-columns class="grid"
- style="height: {{gridHeight">
+ style="height: {{gridHeight}}">
<div class="no-rows" ng-show="!gridOptions.data.length">
<div class="msg">
<span>{{reportData.message}}</span>
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/steps/step1.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/steps/step1.html
index a9baadf8..64d31d97 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/steps/step1.html
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/steps/step1.html
@@ -24,20 +24,23 @@
<div class="form-row" >
<label for="textinputID-2a">Report Description</label>
<div class="field-group">
- <textarea b2b-reset b2b-reset-textarea ng-model="definitionData.reportDescr" ng-disabled="disabled" ng-trim="false" placeholder="{{placeholderText}}" rows="{{textAreaRows}}" maxlength="{{textAreaMaxlength}}" class="span12" id="textareaID1Tooltip1" ng-focus='showTooltip1=true' ng-blur='showTooltip1=false' aria-describedby="textareaID1TooltipContent1"></textarea>
+ <textarea b2b-reset b2b-reset-textarea ng-model="definitionData.reportDescr" ng-disabled="false" ng-trim="false" placeholder="{{placeholderText}}" rows="{{textAreaRows}}" maxlength="{{textAreaMaxlength}}" class="span12" id="textareaID1Tooltip1" ng-focus='showTooltip1=true' ng-blur='showTooltip1=false' aria-describedby="textareaID1TooltipContent1"></textarea>
</div>
</div>
<div class="form-row" >
<label for="textinputID-2a">Report Type</label>
<div class="field-group">
- <input id="reportType" ddh-reset="" class="span12" type="text" data-ng-model="definitionData.reportType" ng-disabled="true">
+ <input id="reportType" ddh-reset="" class="span12" type="text" data-ng-model="definitionData.reportType" ng-disabled="false">
</div>
</div>
<div class="form-row" >
- <label for="textinputID-2a">Data Source</label>
- <div class="field-group">
- <input id="dataSrc" ddh-reset="" class="span12" type="text" data-ng-model="definitionData.dbInfo" ng-disabled="true">
- </div>
+ <label for="selectInputID-2a">Data Source</label>
+ <select id="dataSrc" name="dataSrc" b2b-dropdown placeholder-text="Select DBSource" ng-model="definitionData.dbSrc">
+ <option b2b-dropdown-list option-repeat="d in definitionData.dbSrcOptions" value="{{d.id}}">{{d.name}}</option>
+ </select>
+<!-- <div class="field-group"> -->
+<!-- <input id="dataSrc" ddh-reset="" class="span12" type="text" data-ng-model="definitionData.dbInfo" ng-disabled="true"> -->
+<!-- </div> -->
</div>
<div class="form-row" >
<label for="textinputID-2a">Form Help Text</label>
@@ -210,4 +213,4 @@
<!-- <button class="btn btn-alt btn-small" type="button" ng-click="next()" ng-show="$scope.isEdit" >Next</button>
--> </div>
-</div> \ No newline at end of file
+</div>