diff options
author | Lo, WEI-TING(wl849v) <wl849v@att.com> | 2018-03-19 17:37:22 -0400 |
---|---|---|
committer | Lo, WEI-TING(wl849v) <wl849v@att.com> | 2018-03-19 17:37:22 -0400 |
commit | a932df953215fa4fe25d0dee962291eaa64d1846 (patch) | |
tree | 5106087e4723b93d6d3690ad37f560f6a7257e31 /ecomp-sdk/epsdk-analytics | |
parent | dcdf1bb1838de59e16c63ab37b29fb913efe2f69 (diff) |
Effort to make portal resilient
Issue-ID: PORTAL-210
Includes music library that contatins session management
Change-Id: Icacab904e1f948068348fcc19cd77965cb5b446e
Signed-off-by: Lo, WEI-TING(wl849v) <wl849v@att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-analytics')
11 files changed, 1216 insertions, 13 deletions
diff --git a/ecomp-sdk/epsdk-analytics/pom.xml b/ecomp-sdk/epsdk-analytics/pom.xml index 5f10690d..09ebf15f 100644 --- a/ecomp-sdk/epsdk-analytics/pom.xml +++ b/ecomp-sdk/epsdk-analytics/pom.xml @@ -31,17 +31,17 @@ <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> - <version>2.9.2</version> + <version>2.8.10</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> - <version>2.9.2</version> + <version>2.8.10</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> - <version>2.9.2</version> + <version>2.8.10</version> </dependency> <!-- Raptor required Libraries --> <!-- for static charts --> diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java index 0f7ffac9..0b8f1121 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java @@ -113,7 +113,7 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; public class ReportDefinition extends ReportWrapper implements Serializable { - private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportDefinition.class); + private static transient final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportDefinition.class); private ReportSchedule reportSchedule = null; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java index f4b54a18..5ffb1326 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java @@ -40,6 +40,7 @@ package org.onap.portalsdk.analytics.model.definition; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; +import java.io.Serializable; import java.io.Writer; import java.sql.Connection; import java.sql.PreparedStatement; @@ -77,9 +78,14 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.util.SecurityCodecUtil; import org.owasp.esapi.ESAPI; -public class ReportSchedule extends RaptorObject { +public class ReportSchedule extends RaptorObject implements Serializable{ - private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportSchedule.class); + /** + * + */ + private static final long serialVersionUID = 6936844475227328201L; + + private static transient final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportSchedule.class); private String reportID = null; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java index 7da22187..de8df881 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java @@ -89,7 +89,7 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; public class FormField extends org.onap.portalsdk.analytics.RaptorObject implements Serializable { - private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FormField.class); + private static transient final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FormField.class); private static final String HTML_FORM = "formd"; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/VisualManager.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/VisualManager.java index 7036b254..ee0b2b4e 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/VisualManager.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/VisualManager.java @@ -37,12 +37,18 @@ */ package org.onap.portalsdk.analytics.model.runtime; +import java.io.Serializable; import java.util.HashMap; import org.onap.portalsdk.analytics.RaptorObject; import org.onap.portalsdk.analytics.util.AppConstants; -public class VisualManager extends RaptorObject { +public class VisualManager extends RaptorObject implements Serializable{ + /** + * + */ + private static final long serialVersionUID = -5503994112113552952L; + private HashMap hiddenCols = new HashMap(); private String sortByColId = ""; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/controller/FileServletController.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/controller/FileServletController.java index b6c985a5..94ee29fd 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/controller/FileServletController.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/controller/FileServletController.java @@ -64,7 +64,7 @@ import org.springframework.web.servlet.ModelAndView;; public class FileServletController { - private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FileServletController.class); + private static transient final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FileServletController.class); private DataAccessService dataAccessService; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ColumnHeader.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ColumnHeader.java index 0abd35ca..4a140d15 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ColumnHeader.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ColumnHeader.java @@ -37,7 +37,14 @@ */ package org.onap.portalsdk.analytics.view; -public class ColumnHeader extends org.onap.portalsdk.analytics.RaptorObject { +import java.io.Serializable; + +public class ColumnHeader extends org.onap.portalsdk.analytics.RaptorObject implements Serializable{ + /** + * + */ + private static final long serialVersionUID = -5667833660934169723L; + private String columnTitle = ""; private String columnWidth = ""; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ColumnVisual.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ColumnVisual.java index 9ce62ef4..f6623bb1 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ColumnVisual.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ColumnVisual.java @@ -37,9 +37,16 @@ */ package org.onap.portalsdk.analytics.view; +import java.io.Serializable; + import org.onap.portalsdk.analytics.RaptorObject; -public class ColumnVisual extends RaptorObject { +public class ColumnVisual extends RaptorObject implements Serializable { + /** + * + */ + private static final long serialVersionUID = -6102940391623735541L; + private String colId = null; private String colDisplay = null; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/DataRow.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/DataRow.java index cd4a0a76..619df67e 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/DataRow.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/DataRow.java @@ -37,11 +37,16 @@ */ package org.onap.portalsdk.analytics.view; +import java.io.Serializable; import java.util.ArrayList; import java.util.Vector; -public class DataRow/* extends Vector*/ { +public class DataRow implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 701793162902559746L; private ArrayList dataValueList = new ArrayList(); private HtmlFormatter rowFormatter = null; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/DataValue.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/DataValue.java index e95e2de0..c4627ca4 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/DataValue.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/DataValue.java @@ -37,7 +37,14 @@ */ package org.onap.portalsdk.analytics.view; -public class DataValue extends org.onap.portalsdk.analytics.RaptorObject { +import java.io.Serializable; + +public class DataValue extends org.onap.portalsdk.analytics.RaptorObject implements Serializable { + /** + * + */ + private static final long serialVersionUID = 1264128118175701859L; + private String displayValue = ""; private String displayCalculatedValue = ""; diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/ReportLoaderTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/ReportLoaderTest.java new file mode 100644 index 00000000..6c1698dd --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/model/ReportLoaderTest.java @@ -0,0 +1,1165 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model; + +import static org.junit.Assert.*; + +import java.io.FileInputStream; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Vector; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Matchers; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.onap.portalsdk.analytics.error.RaptorException; +import org.onap.portalsdk.analytics.error.ReportSQLException; +import org.onap.portalsdk.analytics.model.base.ReportWrapper; +import org.onap.portalsdk.analytics.model.runtime.ReportRuntime; +import org.onap.portalsdk.analytics.system.AppUtils; +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; +import org.onap.portalsdk.analytics.util.Utils; +import org.onap.portalsdk.analytics.xmlobj.MockitoTestSuite; +import org.onap.portalsdk.core.util.SecurityCodecUtil; +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.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +@RunWith(PowerMockRunner.class) +@PrepareForTest({ Globals.class, DbUtils.class, Utils.class, AppUtils.class, ESAPI.class, Encoder.class, + SecurityCodecUtil.class, Codec.class }) +public class ReportLoaderTest { + + @Mock + Connection connection; + @Mock + PreparedStatement stmt; + @Mock + ResultSet rs; + + @Mock + InputStream inputStream; + + @Mock + InputStreamReader in; + + MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); + HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); + HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); + + @SuppressWarnings("static-access") + @Test(expected = org.onap.portalsdk.analytics.error.RaptorException.class) + public void loadCustomReportXMLTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(DbUtils.class); + PowerMockito.mockStatic(Globals.class); + Mockito.when(DbUtils.getConnection()).thenReturn(connection); + Mockito.when(Globals.getLoadCustomReportXml()).thenReturn("testSql"); + Mockito.when(connection.prepareStatement(Matchers.anyString())).thenReturn(stmt); + Mockito.when(stmt.executeQuery()).thenReturn(rs); + Mockito.when(Globals.isWeblogicServer()).thenReturn(true); + reportLoader.loadCustomReportXML("1"); + } + + @SuppressWarnings("static-access") + @Test(expected = org.onap.portalsdk.analytics.error.RaptorException.class) + public void loadCustomReportXML1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(DbUtils.class); + PowerMockito.mockStatic(Globals.class); + Mockito.when(DbUtils.getConnection()).thenReturn(connection); + Mockito.when(Globals.getLoadCustomReportXml()).thenReturn("testSql"); + Mockito.when(connection.prepareStatement(Matchers.anyString())).thenReturn(stmt); + Mockito.when(stmt.executeQuery()).thenReturn(rs); + Mockito.when(Globals.isWeblogicServer()).thenReturn(true); + Mockito.when(rs.next()).thenReturn(true); + java.sql.Clob clob = PowerMockito.mock(java.sql.Clob.class); + Mockito.when(rs.getClob(1)).thenReturn(clob); + Mockito.when(clob.getAsciiStream()).thenReturn(inputStream); + PowerMockito.whenNew(InputStreamReader.class).withArguments(Matchers.any(InputStream.class)).thenReturn(in); + reportLoader.loadCustomReportXML("1"); + } + + @SuppressWarnings("static-access") + @Test(expected = org.onap.portalsdk.analytics.error.RaptorException.class) + public void loadCustomReportXML2Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(DbUtils.class); + PowerMockito.mockStatic(Globals.class); + Mockito.when(DbUtils.getConnection()).thenReturn(connection); + Mockito.when(Globals.getLoadCustomReportXml()).thenReturn("testSql"); + Mockito.when(connection.prepareStatement(Matchers.anyString())).thenReturn(stmt); + Mockito.when(stmt.executeQuery()).thenReturn(rs); + Mockito.when(Globals.isWeblogicServer()).thenReturn(false); + Mockito.when(rs.next()).thenReturn(true); + java.sql.Clob clob = PowerMockito.mock(java.sql.Clob.class); + Mockito.when(rs.getClob(1)).thenReturn(clob); + Mockito.when(clob.getAsciiStream()).thenReturn(inputStream); + PowerMockito.whenNew(InputStreamReader.class).withArguments(Matchers.any(InputStream.class)).thenReturn(in); + Mockito.when(in.read(Matchers.any(char[].class))).thenReturn(1); + reportLoader.loadCustomReportXML("1"); + } + + @SuppressWarnings("static-access") + @Test + public void loadCustomReportXML3Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(DbUtils.class); + PowerMockito.mockStatic(Globals.class); + Mockito.when(DbUtils.getConnection()).thenReturn(connection); + Mockito.when(Globals.getLoadCustomReportXml()).thenReturn("testSql"); + Mockito.when(connection.prepareStatement(Matchers.anyString())).thenReturn(stmt); + Mockito.when(stmt.executeQuery()).thenReturn(rs); + Mockito.when(Globals.isWeblogicServer()).thenReturn(false); + Mockito.when(rs.next()).thenReturn(true); + java.sql.Clob clob = PowerMockito.mock(java.sql.Clob.class); + Mockito.when(rs.getClob(1)).thenReturn(clob); + Mockito.when(clob.getAsciiStream()).thenReturn(inputStream); + PowerMockito.whenNew(InputStreamReader.class).withArguments(Matchers.any(InputStream.class)).thenReturn(in); + Mockito.when(in.read(Matchers.any(char[].class))).thenReturn(1); + Mockito.when(Globals.isPostgreSQL()).thenReturn(true); + reportLoader.loadCustomReportXML("1"); + } + + @SuppressWarnings("static-access") + @Test + public void loadCustomReportXML4Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(DbUtils.class); + PowerMockito.mockStatic(Globals.class); + Mockito.when(DbUtils.getConnection()).thenReturn(connection); + Mockito.when(Globals.getLoadCustomReportXml()).thenReturn("testSql"); + Mockito.when(connection.prepareStatement(Matchers.anyString())).thenReturn(stmt); + Mockito.when(stmt.executeQuery()).thenReturn(rs); + Mockito.when(Globals.isWeblogicServer()).thenReturn(false); + Mockito.when(rs.next()).thenReturn(true); + java.sql.Clob clob = PowerMockito.mock(java.sql.Clob.class); + Mockito.when(rs.getClob(1)).thenReturn(clob); + Mockito.when(clob.getAsciiStream()).thenReturn(inputStream); + PowerMockito.whenNew(InputStreamReader.class).withArguments(Matchers.any(InputStream.class)).thenReturn(in); + Mockito.when(in.read(Matchers.any(char[].class))).thenReturn(1); + Mockito.when(Globals.isMySQL()).thenReturn(true); + reportLoader.loadCustomReportXML("1"); + } + + @SuppressWarnings("static-access") + @Test(expected = org.onap.portalsdk.analytics.error.RaptorException.class) + public void updateCustomReportRecTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + ReportWrapper rw = PowerMockito.mock(ReportWrapper.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + + Mockito.when(Globals.getUpdateCustomReportRec()).thenReturn("testSql"); + Mockito.when(rw.getReportName()).thenReturn("name"); + Mockito.when(rw.getReportDescr()).thenReturn("desr"); + Mockito.when(rw.isPublic()).thenReturn(true); + Mockito.when(rw.isMenuApproved()).thenReturn(true); + Mockito.when(rw.getMenuID()).thenReturn("id"); + Mockito.when(rw.getOwnerID()).thenReturn("test"); + Mockito.when(rw.getUpdateID()).thenReturn("test"); + Mockito.when(rw.getUpdateDate()).thenReturn("test"); + Mockito.when(rw.isDashboardType()).thenReturn(true); + Mockito.when(rw.getReportType()).thenReturn("test"); + Mockito.when(rw.getReportID()).thenReturn("1"); + Mockito.when(Globals.getDBUpdateReportXml()).thenReturn("test"); + Mockito.when(Globals.getTimeFormat()).thenReturn("testformat"); + PowerMockito.mockStatic(Utils.class); + Mockito.when(Utils.oracleSafe(Matchers.anyString())).thenReturn("test"); + Mockito.when(Globals.isMySQL()).thenReturn(false); + Mockito.when(connection.prepareStatement(Matchers.anyString(), Matchers.anyInt(), Matchers.anyInt())) + .thenReturn(stmt); + Mockito.when(stmt.executeQuery()).thenReturn(rs); + reportLoader.updateCustomReportRec(connection, rw, "test"); + } + + @SuppressWarnings("static-access") + @Test + public void updateCustomReportRec1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + ReportWrapper rw = PowerMockito.mock(ReportWrapper.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + + Mockito.when(Globals.getUpdateCustomReportRec()).thenReturn("testSql"); + Mockito.when(rw.getReportName()).thenReturn("name"); + Mockito.when(rw.getReportDescr()).thenReturn("desr"); + Mockito.when(rw.isPublic()).thenReturn(true); + Mockito.when(rw.isMenuApproved()).thenReturn(true); + Mockito.when(rw.getMenuID()).thenReturn("id"); + Mockito.when(rw.getOwnerID()).thenReturn("test"); + Mockito.when(rw.getUpdateID()).thenReturn("test"); + Mockito.when(rw.getUpdateDate()).thenReturn("test"); + Mockito.when(rw.isDashboardType()).thenReturn(true); + Mockito.when(rw.getReportType()).thenReturn("test"); + Mockito.when(rw.getReportID()).thenReturn("1"); + Mockito.when(Globals.getDBUpdateReportXml()).thenReturn("test"); + Mockito.when(Globals.getTimeFormat()).thenReturn("testformat"); + PowerMockito.mockStatic(Utils.class); + Mockito.when(Utils.oracleSafe(Matchers.anyString())).thenReturn("test"); + Mockito.when(Globals.isMySQL()).thenReturn(false); + Mockito.when(connection.prepareStatement(Matchers.anyString(), Matchers.anyInt(), Matchers.anyInt())) + .thenReturn(stmt); + Mockito.when(stmt.executeQuery()).thenReturn(rs); + Mockito.when(Globals.isPostgreSQL()).thenReturn(true); + Mockito.when(rs.next()).thenReturn(true); + reportLoader.updateCustomReportRec(connection, rw, "test"); + } + + @SuppressWarnings("static-access") + @Test(expected = org.onap.portalsdk.analytics.error.RaptorException.class) + public void updateCustomReportRec2Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + ReportWrapper rw = PowerMockito.mock(ReportWrapper.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + + Mockito.when(Globals.getUpdateCustomReportRec()).thenReturn("testSql"); + Mockito.when(rw.getReportName()).thenReturn("name"); + Mockito.when(rw.getReportDescr()).thenReturn("desr"); + Mockito.when(rw.isPublic()).thenReturn(true); + Mockito.when(rw.isMenuApproved()).thenReturn(true); + Mockito.when(rw.getMenuID()).thenReturn("id"); + Mockito.when(rw.getOwnerID()).thenReturn("test"); + Mockito.when(rw.getUpdateID()).thenReturn("test"); + Mockito.when(rw.getUpdateDate()).thenReturn("test"); + Mockito.when(rw.isDashboardType()).thenReturn(true); + Mockito.when(rw.getReportType()).thenReturn("test"); + Mockito.when(rw.getReportID()).thenReturn("1"); + Mockito.when(Globals.getDBUpdateReportXml()).thenReturn("test"); + Mockito.when(Globals.getTimeFormat()).thenReturn("testformat"); + PowerMockito.mockStatic(Utils.class); + Mockito.when(Utils.oracleSafe(Matchers.anyString())).thenReturn("test"); + Mockito.when(Globals.isMySQL()).thenReturn(false); + Mockito.when(connection.prepareStatement(Matchers.anyString(), Matchers.anyInt(), Matchers.anyInt())) + .thenReturn(stmt); + Mockito.when(stmt.executeQuery()).thenReturn(rs); + Mockito.when(Globals.isPostgreSQL()).thenReturn(true); + Mockito.when(rs.next()).thenReturn(false); + reportLoader.updateCustomReportRec(connection, rw, "test"); + } + + @SuppressWarnings("static-access") + @Test(expected = org.onap.portalsdk.analytics.error.RaptorException.class) + public void updateCustomReportRec3Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + ReportWrapper rw = PowerMockito.mock(ReportWrapper.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + + Mockito.when(Globals.getUpdateCustomReportRec()).thenReturn("testSql"); + Mockito.when(rw.getReportName()).thenReturn("name"); + Mockito.when(rw.getReportDescr()).thenReturn("desr"); + Mockito.when(rw.isPublic()).thenReturn(true); + Mockito.when(rw.isMenuApproved()).thenReturn(true); + Mockito.when(rw.getMenuID()).thenReturn("id"); + Mockito.when(rw.getOwnerID()).thenReturn("test"); + Mockito.when(rw.getUpdateID()).thenReturn("test"); + Mockito.when(rw.getUpdateDate()).thenReturn("test"); + Mockito.when(rw.isDashboardType()).thenReturn(true); + Mockito.when(rw.getReportType()).thenReturn("test"); + Mockito.when(rw.getReportID()).thenReturn("1"); + Mockito.when(Globals.getDBUpdateReportXml()).thenReturn("test"); + Mockito.when(Globals.getTimeFormat()).thenReturn("testformat"); + PowerMockito.mockStatic(Utils.class); + Mockito.when(Utils.oracleSafe(Matchers.anyString())).thenReturn("test"); + Mockito.when(Globals.isMySQL()).thenReturn(true); + Mockito.when(connection.prepareStatement(Matchers.anyString(), Matchers.anyInt(), Matchers.anyInt())) + .thenReturn(stmt); + Mockito.when(stmt.executeQuery()).thenReturn(rs); + Mockito.when(Globals.isPostgreSQL()).thenReturn(false); + Mockito.when(rs.next()).thenReturn(false); + reportLoader.updateCustomReportRec(connection, rw, "test"); + } + + @SuppressWarnings("static-access") + @Test + public void updateCustomReportRec4Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + ReportWrapper rw = PowerMockito.mock(ReportWrapper.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + + Mockito.when(Globals.getUpdateCustomReportRec()).thenReturn("testSql"); + Mockito.when(rw.getReportName()).thenReturn("name"); + Mockito.when(rw.getReportDescr()).thenReturn("desr"); + Mockito.when(rw.isPublic()).thenReturn(true); + Mockito.when(rw.isMenuApproved()).thenReturn(true); + Mockito.when(rw.getMenuID()).thenReturn("id"); + Mockito.when(rw.getOwnerID()).thenReturn("test"); + Mockito.when(rw.getUpdateID()).thenReturn("test"); + Mockito.when(rw.getUpdateDate()).thenReturn("test"); + Mockito.when(rw.isDashboardType()).thenReturn(true); + Mockito.when(rw.getReportType()).thenReturn("test"); + Mockito.when(rw.getReportID()).thenReturn("1"); + Mockito.when(Globals.getDBUpdateReportXml()).thenReturn("test"); + Mockito.when(Globals.getTimeFormat()).thenReturn("testformat"); + PowerMockito.mockStatic(Utils.class); + Mockito.when(Utils.oracleSafe(Matchers.anyString())).thenReturn("test"); + Mockito.when(Globals.isMySQL()).thenReturn(true); + Mockito.when(connection.prepareStatement(Matchers.anyString(), Matchers.anyInt(), Matchers.anyInt())) + .thenReturn(stmt); + Mockito.when(connection.prepareStatement(Matchers.anyString())).thenReturn(stmt); + + Mockito.when(stmt.executeQuery()).thenReturn(rs); + Mockito.when(Globals.isPostgreSQL()).thenReturn(false); + Mockito.when(rs.next()).thenReturn(true); + Mockito.when(rs.getBinaryStream("report_xml")).thenReturn(inputStream); + Mockito.when(Globals.getDBUpdateReportXmlMySql()).thenReturn("test"); + reportLoader.updateCustomReportRec(connection, rw, "test"); + } + + // @SuppressWarnings("static-access") + // @Test + // public void isDashboardTypeTest() throws Exception + // { + // ReportLoader reportLoader = new ReportLoader(); + // reportLoader.isDashboardType("test"); + // } + @SuppressWarnings("static-access") + @Test + public void isReportsAlreadyScheduledTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getIsReportAlreadyScheduled()).thenReturn("testSql"); + Mockito.when(DbUtils.getConnection()).thenReturn(connection); + Mockito.when(connection.prepareStatement(Matchers.anyString())).thenReturn(stmt); + Mockito.when(stmt.executeQuery()).thenReturn(rs); + reportLoader.isReportsAlreadyScheduled("1"); + + } + + @SuppressWarnings("static-access") + @Test + public void isReportsAlreadyScheduled1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getIsReportAlreadyScheduled()).thenReturn("testSql"); + Mockito.when(DbUtils.getConnection()).thenReturn(connection); + Mockito.when(connection.prepareStatement(Matchers.anyString())).thenReturn(stmt); + Mockito.when(stmt.executeQuery()).thenReturn(rs); + Mockito.when(rs.next()).thenReturn(true); + reportLoader.isReportsAlreadyScheduled("1"); + + } + + @SuppressWarnings({ "static-access", "unchecked" }) + @Test(expected = org.onap.portalsdk.analytics.error.ReportSQLException.class) + public void isReportsAlreadyScheduled2Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getIsReportAlreadyScheduled()).thenReturn("testSql"); + Mockito.when(DbUtils.getConnection()).thenReturn(connection); + Mockito.when(connection.prepareStatement(Matchers.anyString())).thenThrow(SQLException.class); + Mockito.when(stmt.executeQuery()).thenReturn(rs); + Mockito.when(rs.next()).thenReturn(true); + reportLoader.isReportsAlreadyScheduled("1"); + + } + + @SuppressWarnings("static-access") + @Test(expected = org.onap.portalsdk.analytics.error.ReportSQLException.class) + public void isReportsAlreadyScheduled3Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getIsReportAlreadyScheduled()).thenReturn("testSql"); + Mockito.when(DbUtils.getConnection()).thenReturn(connection); + Mockito.when(connection.prepareStatement(Matchers.anyString())).thenReturn(stmt); + Mockito.when(stmt.executeQuery()).thenReturn(rs); + Mockito.when(rs.next()).thenReturn(true); + Mockito.doThrow(SQLException.class).when(rs).close(); + reportLoader.isReportsAlreadyScheduled("1"); + + } + + @SuppressWarnings("static-access") + @Test + public void createCustomReportRecTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + ReportWrapper rw = PowerMockito.mock(ReportWrapper.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + + Mockito.when(Globals.getCreateCustomReportRec()).thenReturn("testSql"); + Mockito.when(rw.getReportName()).thenReturn("name"); + Mockito.when(rw.getReportDescr()).thenReturn("desr"); + Mockito.when(rw.isPublic()).thenReturn(true); + Mockito.when(rw.isMenuApproved()).thenReturn(true); + Mockito.when(rw.getMenuID()).thenReturn("id"); + Mockito.when(rw.getOwnerID()).thenReturn("test"); + Mockito.when(rw.getUpdateID()).thenReturn("test"); + Mockito.when(rw.getUpdateDate()).thenReturn("test"); + Mockito.when(rw.isDashboardType()).thenReturn(true); + Mockito.when(rw.getReportType()).thenReturn("test"); + Mockito.when(rw.getReportID()).thenReturn("1"); + PowerMockito.mockStatic(Utils.class); + Mockito.when(rw.getCreateID()).thenReturn("test"); + Mockito.when(rw.getFolderId()).thenReturn("1"); + Mockito.when(rw.getCreateDate()).thenReturn("11/11/2010"); + Mockito.when(Utils.oracleSafe(Matchers.anyString())).thenReturn("test"); + Mockito.when(Globals.getTimeFormat()).thenReturn("test"); + Mockito.when(Globals.getDBUpdateReportXml()).thenReturn("test"); + Mockito.when(Globals.getTimeFormat()).thenReturn("testformat"); + PowerMockito.mockStatic(Utils.class); + Mockito.when(Utils.oracleSafe(Matchers.anyString())).thenReturn("test"); + Mockito.when(Globals.isMySQL()).thenReturn(false); + Mockito.when(connection.prepareStatement(Matchers.anyString(), Matchers.anyInt(), Matchers.anyInt())) + .thenReturn(stmt); + Mockito.when(stmt.executeQuery()).thenReturn(rs); + Mockito.when(Globals.isPostgreSQL()).thenReturn(true); + Mockito.when(rs.next()).thenReturn(true); + reportLoader.createCustomReportRec(connection, rw, "test"); + } + + @SuppressWarnings("static-access") + @Test + public void getUserReportNamesTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Mockito.when(Globals.getTheUserReportNames()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(1); + Mockito.when(ds.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.getUserReportNames(mockedRequest); + } + + @SuppressWarnings("static-access") + @Test + public void getReportOwnerIDTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getTheReportOwnerId()).thenReturn("test"); + Mockito.when(DbUtils.getConnection()).thenReturn(connection); + Mockito.when(connection.prepareStatement(Matchers.anyString())).thenReturn(stmt); + Mockito.when(rs.next()).thenReturn(true); + Mockito.when(stmt.executeQuery()).thenReturn(rs); + Mockito.when(rs.getString(1)).thenReturn("test"); + reportLoader.getReportOwnerID("1"); + + } + + @SuppressWarnings("static-access") + @Test(expected = org.onap.portalsdk.analytics.error.ReportSQLException.class) + public void getReportOwnerID1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getTheReportOwnerId()).thenReturn("test"); + Mockito.when(DbUtils.getConnection()).thenReturn(connection); + Mockito.when(connection.prepareStatement(Matchers.anyString())).thenThrow(SQLException.class); + Mockito.when(rs.next()).thenReturn(true); + Mockito.when(stmt.executeQuery()).thenReturn(rs); + Mockito.when(rs.getString(1)).thenReturn("test"); + reportLoader.getReportOwnerID("1"); + } + + @SuppressWarnings("static-access") + @Test(expected = org.onap.portalsdk.analytics.error.ReportSQLException.class) + public void getReportOwnerID2Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getTheReportOwnerId()).thenReturn("test"); + Mockito.when(DbUtils.getConnection()).thenReturn(connection); + Mockito.when(connection.prepareStatement(Matchers.anyString())).thenReturn(stmt); + Mockito.when(rs.next()).thenReturn(true); + Mockito.when(stmt.executeQuery()).thenReturn(rs); + Mockito.when(rs.getString(1)).thenReturn("test"); + Mockito.doThrow(SQLException.class).when(rs).close(); + reportLoader.getReportOwnerID("1"); + } + + @SuppressWarnings("static-access") + @Test + public void deleteReportRecordTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(DbUtils.startTransaction()).thenReturn(connection); + Mockito.when(Globals.getDeleteReportRecordLog()).thenReturn("test"); + PowerMockito.mockStatic(ESAPI.class); + PowerMockito.mockStatic(SecurityCodecUtil.class); + Mockito.when(mockedRequest.getParameter("action")).thenReturn("test"); + ReportRuntime rr = PowerMockito.mock(ReportRuntime.class); + Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr); + Encoder encoder = PowerMockito.mock(Encoder.class); + Mockito.when(ESAPI.encoder()).thenReturn(encoder); + Codec codec = PowerMockito.mock(Codec.class); + Mockito.when(SecurityCodecUtil.getCodec()).thenReturn(codec); + Mockito.when(encoder.encodeForSQL(Matchers.any(Codec.class), Matchers.anyString())).thenReturn("select *"); + reportLoader.deleteReportRecord("test"); + } + + @SuppressWarnings("static-access") + @Test + public void deleteReportRecord1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(DbUtils.startTransaction()).thenReturn(connection); + Mockito.when(Globals.getDeleteReportRecordLog()).thenReturn("test"); + Mockito.when(Globals.getDeleteReportRecordUsers()).thenReturn("test"); + Mockito.when(Globals.getDeleteReportRecordSchedule()).thenReturn("test"); + Mockito.when(Globals.getDeleteReportRecordAccess()).thenReturn("test"); + Mockito.when(Globals.getDeleteReportRecordEmail()).thenReturn("test"); + Mockito.when(Globals.getDeleteReportRecordFavorite()).thenReturn("test"); + Mockito.when(Globals.getDeleteReportRecordReport()).thenReturn("test"); + PowerMockito.mockStatic(ESAPI.class); + PowerMockito.mockStatic(SecurityCodecUtil.class); + Mockito.when(mockedRequest.getParameter("action")).thenReturn("test"); + ReportRuntime rr = PowerMockito.mock(ReportRuntime.class); + Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr); + Encoder encoder = PowerMockito.mock(Encoder.class); + Mockito.when(ESAPI.encoder()).thenReturn(encoder); + Codec codec = PowerMockito.mock(Codec.class); + Mockito.when(SecurityCodecUtil.getCodec()).thenReturn(codec); + Mockito.when(encoder.encodeForSQL(Matchers.any(Codec.class), Matchers.anyString())).thenReturn("select *"); + reportLoader.deleteReportRecord("test"); + } + + @SuppressWarnings("static-access") + @Test + public void loadQuickLinksTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(DbUtils.class); + PowerMockito.mockStatic(Globals.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Vector vc = new Vector(); + vc.add("test"); + Mockito.when(AppUtils.getUserRoles(mockedRequest)).thenReturn(vc); + Mockito.when(Globals.getLoadQuickLinks()).thenReturn("testsql"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(1); + reportLoader.loadQuickLinks(mockedRequest, "1", true); + } + + @SuppressWarnings("static-access") + @Test + public void getQuickLinksJSONTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Vector vc = new Vector(); + vc.add("test"); + Mockito.when(AppUtils.getUserRoles(mockedRequest)).thenReturn(vc); + Mockito.when(Globals.getLoadQuickLinks()).thenReturn("test"); + PowerMockito.mockStatic(ESAPI.class); + PowerMockito.mockStatic(SecurityCodecUtil.class); + Mockito.when(mockedRequest.getParameter("action")).thenReturn("test"); + ReportRuntime rr = PowerMockito.mock(ReportRuntime.class); + Mockito.when(mockedRequest.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).thenReturn(rr); + Encoder encoder = PowerMockito.mock(Encoder.class); + Mockito.when(ESAPI.encoder()).thenReturn(encoder); + Codec codec = PowerMockito.mock(Codec.class); + Mockito.when(SecurityCodecUtil.getCodec()).thenReturn(codec); + Mockito.when(encoder.encodeForSQL(Matchers.any(Codec.class), Matchers.anyString())).thenReturn("select *"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(1); + reportLoader.getQuickLinksJSON(mockedRequest, "1", true); + } + + @SuppressWarnings("static-access") + @Test + public void loadFolderReportsTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Vector vc = new Vector(); + vc.add("test"); + Mockito.when(AppUtils.getUserRoles(mockedRequest)).thenReturn(vc); + Mockito.when(Globals.getLoadFolderReports()).thenReturn("test"); + Mockito.when(Globals.getLoadFolderReportsUser()).thenReturn("test"); + Mockito.when(Globals.getLoadFolderReportsPublicSql()).thenReturn("test"); + + Mockito.when(AppUtils.isSuperUser(mockedRequest)).thenReturn(true); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(1); + Mockito.when( ds.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.loadFolderReports(mockedRequest, "1", true, "folderId", true, true); + } + + @SuppressWarnings("static-access") + @Test + public void loadFolderReports1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Vector vc = new Vector(); + vc.add("test"); + Mockito.when(AppUtils.getUserRoles(mockedRequest)).thenReturn(vc); + Mockito.when(Globals.getLoadFolderReports()).thenReturn("test"); + Mockito.when(Globals.getLoadFolderReportsUser()).thenReturn("test"); + Mockito.when(Globals.getLoadFolderReportsPublicSql()).thenReturn("test"); + + Mockito.when(AppUtils.isSuperUser(mockedRequest)).thenReturn(false); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(1); + Mockito.when( ds.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.loadFolderReports(mockedRequest, "1", true, "folderId", false, true); + } + + @SuppressWarnings("static-access") + @Test + public void loadFolderReports2Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Vector vc = new Vector(); + vc.add("test"); + Mockito.when(AppUtils.getUserRoles(mockedRequest)).thenReturn(vc); + Mockito.when(Globals.getLoadFolderReports()).thenReturn("test"); + Mockito.when(Globals.getLoadFolderReportsUser()).thenReturn("test"); + Mockito.when(Globals.getLoadFolderReportsPublicSql()).thenReturn("test"); + + Mockito.when(AppUtils.isSuperUser(mockedRequest)).thenReturn(false); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(1); + Mockito.when( ds.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.loadFolderReports(mockedRequest, "1", true, "folderId", false, false); + } + + @SuppressWarnings("static-access") + @Test + public void loadQuickDownloadLinksTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getLoadQuickDownloadLinks()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(1); + Mockito.when(ds.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.loadQuickDownloadLinks("test", mockedRequest); + } + + @SuppressWarnings("static-access") + @Test + public void loadQuickDownloadLinks1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getLoadQuickDownloadLinks()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(0); + Mockito.when(ds.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.loadQuickDownloadLinks("test", mockedRequest); + } + + @SuppressWarnings("static-access") + @Test + public void loadReportsToScheduleTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Vector vc = new Vector(); + vc.add("test"); + Mockito.when(AppUtils.getUserRoles(mockedRequest)).thenReturn(vc); + Mockito.when(Globals.getLoadReportsToSchedule()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(1); + Mockito.when(ds.getItem(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.loadReportsToSchedule(mockedRequest); + } + + @SuppressWarnings("static-access") + @Test + public void loadReportsToSchedule1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Vector vc = new Vector(); + vc.add("test"); + Mockito.when(AppUtils.getUserRoles(mockedRequest)).thenReturn(vc); + Mockito.when(Globals.getLoadReportsToSchedule()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(0); + Mockito.when(ds.getItem(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.loadReportsToSchedule(mockedRequest); + } + + @SuppressWarnings("static-access") + @Test + public void loadReportsToAddInDashboardTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Vector vc = new Vector(); + vc.add("test"); + Mockito.when(AppUtils.getUserRoles(mockedRequest)).thenReturn(vc); + Mockito.when(Globals.getLoadReportsToAddInDashboard()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(1); + Mockito.when(ds.getItem(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.loadReportsToAddInDashboard(mockedRequest); + } + @SuppressWarnings("static-access") + @Test + public void loadReportsToAddInDashboard1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Vector vc = new Vector(); + vc.add("test"); + Mockito.when(AppUtils.getUserRoles(mockedRequest)).thenReturn(vc); + Mockito.when(Globals.getLoadReportsToAddInDashboard()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(0); + Mockito.when(ds.getItem(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.loadReportsToAddInDashboard(mockedRequest); + } + + @SuppressWarnings("static-access") + @Test + public void loadReportsToAddInDashboard2Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Vector vc = new Vector(); + Mockito.when(AppUtils.getUserRoles(mockedRequest)).thenReturn(vc); + Mockito.when(Globals.getLoadReportsToAddInDashboard()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(0); + Mockito.when(ds.getItem(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.loadReportsToAddInDashboard(mockedRequest); + } + + + @SuppressWarnings("static-access") + @Test + public void loadMyRecentLinksTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Vector vc = new Vector(); + vc.add("test"); + Mockito.when(AppUtils.getUserRoles(mockedRequest)).thenReturn(vc); + Mockito.when(Globals.getLoadMyRecentLinks()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(1); + Mockito.when(ds.getItem(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.loadMyRecentLinks("test",mockedRequest); + } + + @SuppressWarnings("static-access") + @Test + public void loadMyRecentLinks1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Vector vc = new Vector(); + Mockito.when(AppUtils.getUserRoles(mockedRequest)).thenReturn(vc); + Mockito.when(Globals.getLoadMyRecentLinks()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(0); + Mockito.when(ds.getItem(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.loadMyRecentLinks("test",mockedRequest); + } + + @SuppressWarnings("static-access") + @Test + public void createReportLogEntryTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getCreateReportLogEntry()).thenReturn("test"); + Mockito.when(Globals.getEnableReportLog()).thenReturn(true); + reportLoader.createReportLogEntry(connection, "test", "test", "test", "executionTime", "form_fields"); + } + + @SuppressWarnings("static-access") + @Test + public void createReportLogEntry1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getCreateReportLogEntry()).thenReturn("test"); + Mockito.when(Globals.getEnableReportLog()).thenReturn(true); + reportLoader.createReportLogEntry(null, "test", "test", "test", "executionTime", "form_fields"); + } + + @SuppressWarnings("static-access") + @Test + public void createReportLogEntryForExecutionTimeTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getCreateReportLogEntryExecTime()).thenReturn("test"); + Mockito.when(Globals.getEnableReportLog()).thenReturn(true); + reportLoader.createReportLogEntryForExecutionTime(connection, "test", "test", "test", "executionTime", "form_fields"); + } + + @SuppressWarnings("static-access") + @Test + public void createReportLogEntryForExecutionTime1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getCreateReportLogEntryExecTime()).thenReturn("test"); + Mockito.when(Globals.getEnableReportLog()).thenReturn(true); + reportLoader.createReportLogEntryForExecutionTime(null, "test", "test", "test", "executionTime", "form_fields"); + } + + @SuppressWarnings("static-access") + @Test + public void clearReportLogEntriesTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getClearReportLogEntries()).thenReturn("test"); + Mockito.when(DbUtils.getConnection()).thenReturn(connection); + Mockito.when(connection.prepareStatement(Matchers.anyString())).thenReturn(stmt); + reportLoader.clearReportLogEntries("1","2"); + } + + @SuppressWarnings("static-access") + @Test(expected = org.onap.portalsdk.analytics.error.ReportSQLException.class) + public void clearReportLogEntries1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getClearReportLogEntries()).thenReturn("test"); + Mockito.when(DbUtils.getConnection()).thenReturn(connection); + Mockito.when(connection.prepareStatement(Matchers.anyString())).thenReturn(stmt); + Mockito.doThrow(SQLException.class).when(stmt).close(); + reportLoader.clearReportLogEntries("1","2"); + } + + @SuppressWarnings("static-access") + @Test(expected = org.onap.portalsdk.analytics.error.ReportSQLException.class) + public void clearReportLogEntries2Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getClearReportLogEntries()).thenReturn("test"); + Mockito.when(DbUtils.getConnection()).thenReturn(connection); + Mockito.when(connection.prepareStatement(Matchers.anyString())).thenThrow(SQLException.class); + reportLoader.clearReportLogEntries("1","2"); + } + + @SuppressWarnings("static-access") + @Test + public void loadReportLogEntriesTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getLoadReportLogEntries()).thenReturn("test"); + Mockito.when(AppUtils.getRaptorActionURL()).thenReturn("test"); + Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(1); + Mockito.when(ds.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.loadReportLogEntries("1"); + } + + @SuppressWarnings("static-access") + @Test + public void loadReportLogEntries1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getLoadReportLogEntries()).thenReturn("test"); + Mockito.when(AppUtils.getRaptorActionURL()).thenReturn("test"); + Mockito.when(AppUtils.getImgFolderURL()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(0); + Mockito.when(ds.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.loadReportLogEntries("1"); + } + + @SuppressWarnings("static-access") + @Test + public void doesUserCanScheduleReportTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Mockito.when(AppUtils.isAdminUser(mockedRequest)).thenReturn(true); + reportLoader.doesUserCanScheduleReport(mockedRequest, "1"); + } + + @SuppressWarnings("static-access") + @Test + public void doesUserCanScheduleReport1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Mockito.when(AppUtils.isAdminUser(mockedRequest)).thenReturn(false); + Mockito.when(Globals.getDoesUserCanScheduleReport()).thenReturn("test"); + Mockito.when(Globals.getScheduleLimit()).thenReturn(1); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(1); + Mockito.when(Globals.getDoesUserCanSchedule()).thenReturn("1"); + + reportLoader.doesUserCanScheduleReport(mockedRequest, "1"); + } + + @SuppressWarnings("static-access") + @Test + public void doesUserCanScheduleReport2Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Mockito.when(AppUtils.isAdminUser(mockedRequest)).thenReturn(false); + Mockito.when(Globals.getDoesUserCanScheduleReport()).thenReturn("test"); + Mockito.when(Globals.getScheduleLimit()).thenReturn(1); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(0); + Mockito.when(Globals.getDoesUserCanSchedule()).thenReturn("1"); + + reportLoader.doesUserCanScheduleReport(mockedRequest, "1"); + } + @SuppressWarnings("static-access") + @Test + public void doesUserCanScheduleReport3Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(AppUtils.getUserID(mockedRequest)).thenReturn("test"); + Mockito.when(AppUtils.isAdminUser(mockedRequest)).thenReturn(false); + Mockito.when(Globals.getDoesUserCanScheduleReport()).thenReturn("test"); + Mockito.when(Globals.getScheduleLimit()).thenReturn(1); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(0); + Mockito.when(Globals.getDoesUserCanSchedule()).thenReturn("1"); + reportLoader.doesUserCanScheduleReport(mockedRequest, null); + } + + @SuppressWarnings("static-access") + @Test + public void getSystemDateTimeTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getTheSystemDateTime()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(1); + Mockito.when(ds.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.getSystemDateTime(); + } + + @SuppressWarnings("static-access") + @Test + public void getSystemDateTime1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getTheSystemDateTime()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(0); + Mockito.when(ds.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.getSystemDateTime(); + } + + @SuppressWarnings("static-access") + @Test + public void getNextDaySystemDateTimeTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getTheNextDayDateTime()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(1); + Mockito.when(ds.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.getNextDaySystemDateTime(); + } + + @SuppressWarnings("static-access") + @Test + public void getNextDaySystemDateTime1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getTheNextDayDateTime()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(0); + Mockito.when(ds.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.getNextDaySystemDateTime(); + } + + @SuppressWarnings("static-access") + @Test + public void getNext15MinutesOfSystemDateTimeTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getTheNextFifteenMinDateTime()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(1); + Mockito.when(ds.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.getNext15MinutesOfSystemDateTime(); + } + + @SuppressWarnings("static-access") + @Test + public void getNext15MinutesOfSystemDateTime1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getTheNextFifteenMinDateTime()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(0); + Mockito.when(ds.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.getNext15MinutesOfSystemDateTime(); + } + + @SuppressWarnings("static-access") + @Test + public void getNext30MinutesOfSystemDateTimeTest() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getTheNextThirtyMinDateTime()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(1); + Mockito.when(ds.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.getNext15MinutesOfSystemDateTime(); + } + + @SuppressWarnings("static-access") + @Test + public void getNext30MinutesOfSystemDateTime1Test() throws Exception { + ReportLoader reportLoader = new ReportLoader(); + PowerMockito.mockStatic(AppUtils.class); + PowerMockito.mockStatic(Globals.class); + PowerMockito.mockStatic(DbUtils.class); + Mockito.when(Globals.getTheNextThirtyMinDateTime()).thenReturn("test"); + DataSet ds = PowerMockito.mock(DataSet.class); + Mockito.when(DbUtils.executeQuery(Matchers.anyString())).thenReturn(ds); + Mockito.when(ds.getRowCount()).thenReturn(0); + Mockito.when(ds.getString(Matchers.anyInt(), Matchers.anyInt())).thenReturn("test"); + reportLoader.getNext30MinutesOfSystemDateTime(); + } +} |