diff options
author | 2018-07-25 16:13:16 -0400 | |
---|---|---|
committer | 2018-07-25 16:13:56 -0400 | |
commit | 40a17c1d7e5f0edca350a49210e16223a875d290 (patch) | |
tree | ad3a6b61fe17444dde4bf88f4dfd1cba2636f065 /ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk | |
parent | 39191aaa6cf9f9d164c995e580c7df418b59b5c9 (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>
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk')
3 files changed, 24 insertions, 23 deletions
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 +} |