summaryrefslogtreecommitdiffstats
path: root/integration-tests/src/test/java/org
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-12-10 20:47:01 +0000
committerMichael Morris <michael.morris@est.tech>2021-12-17 14:13:37 +0000
commitd4959a269640e6af60814a8257a121d797c7baa6 (patch)
tree779409fffc67baf3316daaa632ed192c1bd8bf8b /integration-tests/src/test/java/org
parentdf3156cf3602be7de77aa1acf8af758628a9ac00 (diff)
Fix MongoSocketOpenException-issue
Change-Id: Iebeb7d8a67ddc397d833795cd20205a364709f11 Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3816
Diffstat (limited to 'integration-tests/src/test/java/org')
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/api/ExtentManager.java77
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/api/ExtentTestManager.java60
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/ExtentManager.java52
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/ExtentTestManager.java21
4 files changed, 72 insertions, 138 deletions
diff --git a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/api/ExtentManager.java b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/api/ExtentManager.java
index e1961a2dd4..e3dc9d8348 100644
--- a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/api/ExtentManager.java
+++ b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/api/ExtentManager.java
@@ -22,7 +22,6 @@ package org.onap.sdc.backend.ci.tests.api;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
-import com.aventstack.extentreports.reporter.ExtentXReporter;
import com.aventstack.extentreports.reporter.configuration.Protocol;
import com.aventstack.extentreports.reporter.configuration.Theme;
import java.io.File;
@@ -37,55 +36,23 @@ public class ExtentManager {
private static final String VERSIONS_INFO_FILE_NAME = "versions.info";
private static ExtentReports extent;
private static ExtentHtmlReporter htmlReporter;
- private static ExtentXReporter extentxReporter;
-
- public enum suiteNameXml {
-
- TESTNG_FAILED_XML_NAME("testng-failed.xml");
-
- suiteNameXml(String value) {
- this.value = value;
- }
-
- private String value;
-
- public String getValue() {
- return value;
- }
-
- }
-
- public synchronized static ExtentReports setReporter(String filePath, String htmlFile, Boolean isAppend) throws Exception {
- String dbIp = Utils.getConfig().getReportDBhost();
- int dbPort = Utils.getConfig().getReportDBport();
+ private static synchronized ExtentReports setReporter(String filePath, String htmlFile, Boolean isAppend) throws Exception {
if (extent == null) {
- extentxReporter = new ExtentXReporter(dbIp, dbPort);
extent = new ExtentReports();
initAndSetExtentHtmlReporter(filePath, htmlFile, isAppend);
-
- if (extentxReporter.config().getReportObjectId() != null) {
- setExtentXReporter(isAppend);
- } else {
- extentxReporter.stop();
- }
}
return extent;
}
- public synchronized static void setExtentXReporter(Boolean isAppend) {
- extentxReporter.setAppendExisting(isAppend);
- extent.attachReporter(extentxReporter);
- }
-
- public synchronized static void initAndSetExtentHtmlReporter(String filePath, String htmlFile, Boolean isAppend) throws Exception {
+ private static synchronized void initAndSetExtentHtmlReporter(String filePath, String htmlFile, Boolean isAppend) throws Exception {
htmlReporter = new ExtentHtmlReporter(filePath + htmlFile);
setConfiguration(htmlReporter);
htmlReporter.setAppendExisting(isAppend);
extent.attachReporter(htmlReporter);
}
- public synchronized static ExtentReports getReporter() {
+ public static synchronized ExtentReports getReporter() {
return extent;
}
@@ -98,9 +65,9 @@ public class ExtentManager {
String suiteName = getSuiteName(context);
if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())) {
- if (config.isUseBrowserMobProxy()) {
- setTrafficCaptue(config);
- }
+ if (config.isUseBrowserMobProxy()) {
+ setTrafficCaptue(config);
+ }
setReporter(filepath, htmlFile, true);
String suiteNameFromVersionInfoFile = FileHandling.getKeyByValueFromPropertyFormatFile(filepath + VERSIONS_INFO_FILE_NAME, "suiteName");
@@ -115,16 +82,15 @@ public class ExtentManager {
}
- public static void reporterDataDefinition(String onboardVersion, String osVersion, String envData, String suiteNameFromVersionInfoFile)
+ private static void reporterDataDefinition(String onboardVersion, String osVersion, String envData, String suiteNameFromVersionInfoFile)
throws Exception {
extent.setSystemInfo("Onboard Version", onboardVersion);
extent.setSystemInfo("OS Version", osVersion);
-// extent.setSystemInfo("Host Name Address", RestCDUtils.getExecutionHostAddress());
extent.setSystemInfo("ExecutedOn", envData);
extent.setSystemInfo("SuiteName", suiteNameFromVersionInfoFile);
}
- public static String getSuiteName(ITestContext context) {
+ private static String getSuiteName(ITestContext context) {
String suitePath = context.getSuite().getXmlSuite().getFileName();
if (suitePath != null) {
File file = new File(suitePath);
@@ -134,29 +100,38 @@ public class ExtentManager {
return null;
}
- public synchronized static ExtentHtmlReporter setConfiguration(ExtentHtmlReporter htmlReporter) throws Exception {
+ private static synchronized ExtentHtmlReporter setConfiguration(ExtentHtmlReporter htmlReporter) throws Exception {
htmlReporter.config().setTheme(Theme.STANDARD);
htmlReporter.config().setEncoding("UTF-8");
htmlReporter.config().setProtocol(Protocol.HTTPS);
htmlReporter.config().setDocumentTitle("SDC Automation Report");
htmlReporter.config().setChartVisibilityOnOpen(true);
-// htmlReporter.config().setReportName(AutomationUtils.getATTVersion());
htmlReporter.config().setReportName("SDC Automation Report");
htmlReporter.config().setChartVisibilityOnOpen(false);
-// htmlReporter.config().setJS(icon);
return htmlReporter;
}
- public static void closeReporter() {
- extent.flush();
- }
-
- public static void setTrafficCaptue(Config config) {
+ private static void setTrafficCaptue(Config config) {
boolean mobProxyStatus = config.isUseBrowserMobProxy();
if (mobProxyStatus) {
config.setCaptureTraffic(true);
}
}
-}
+ enum suiteNameXml {
+
+ TESTNG_FAILED_XML_NAME("testng-failed.xml");
+
+ private String value;
+
+ suiteNameXml(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ }
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/api/ExtentTestManager.java b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/api/ExtentTestManager.java
index a3fc563c10..00dd3fcdaa 100644
--- a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/api/ExtentTestManager.java
+++ b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/api/ExtentTestManager.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file 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.
@@ -22,44 +22,32 @@ package org.onap.sdc.backend.ci.tests.api;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
-
import java.util.HashMap;
-public class ExtentTestManager implements SomeInterface{
+import java.util.Map;
- private static HashMap<Long, ExtentTest> extentTestMap = new HashMap<Long, ExtentTest>();
- private static ExtentReports extent = ExtentManager.getReporter();
-
- public ExtentTestManager(){
- }
-
- @Override
- public synchronized ExtentTest getTest() {
- return extentTestMap.get(Thread.currentThread().getId());
- }
+public class ExtentTestManager implements SomeInterface {
- public static synchronized void endTest() {
-// extent.endTest(extentTestMap.get(Thread.currentThread().getId()));
- extent.flush();
- }
+ private static final Map<Long, ExtentTest> extentTestMap = new HashMap<>();
+ private static final ExtentReports extent = ExtentManager.getReporter();
- public static synchronized ExtentTest startTest(String testName) {
- return startTest(testName, "");
- }
+ public static synchronized void endTest() {
+ extent.flush();
+ }
- public static synchronized ExtentTest startTest(String testName, String desc) {
- ExtentTest test = extent.createTest(testName, desc);
- extentTestMap.put(Thread.currentThread().getId(), test);
+ public static synchronized void startTest(String testName) {
+ extentTestMap.put(Thread.currentThread().getId(), extent.createTest(testName));
+ }
- return test;
- }
-
- public static synchronized <T> void assignCategory(Class<T> clazz){
- String[] parts = clazz.getName().split("\\.");
- String lastOne1 = parts[parts.length-1];
- String lastOne2 = parts[parts.length-2];
- extentTestMap.get(Thread.currentThread().getId()).assignCategory(lastOne2 + "-" + lastOne1);
- }
-
-
-}
+ public static synchronized <T> void assignCategory(Class<T> clazz) {
+ String[] parts = clazz.getName().split("\\.");
+ String lastOne1 = parts[parts.length - 1];
+ String lastOne2 = parts[parts.length - 2];
+ extentTestMap.get(Thread.currentThread().getId()).assignCategory(lastOne2 + "-" + lastOne1);
+ }
+ @Override
+ public synchronized ExtentTest getTest() {
+ return extentTestMap.get(Thread.currentThread().getId());
+ }
+
+}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/ExtentManager.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/ExtentManager.java
index 1d515da14a..cc524b6582 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/ExtentManager.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/ExtentManager.java
@@ -23,7 +23,6 @@ package org.onap.sdc.frontend.ci.tests.execute.setup;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
-import com.aventstack.extentreports.reporter.ExtentXReporter;
import com.aventstack.extentreports.reporter.configuration.Protocol;
import com.aventstack.extentreports.reporter.configuration.Theme;
import java.io.File;
@@ -44,46 +43,15 @@ public class ExtentManager {
private static final String VERSIONS_INFO_FILE_NAME = "versions.info";
private static ExtentReports extent;
private static ExtentHtmlReporter htmlReporter;
- private static ExtentXReporter extentxReporter;
-
- public enum suiteNameXml {
-
- TESTNG_FAILED_XML_NAME("testng-failed.xml");
-
- suiteNameXml(String value) {
- this.value = value;
- }
-
- private String value;
-
- public String getValue() {
- return value;
- }
-
- }
private static synchronized ExtentReports setReporter(String filePath, String htmlFile, Boolean isAppend) throws Exception {
- String dbIp = DriverFactory.getConfig().getReportDBhost();
- int dbPort = DriverFactory.getConfig().getReportDBport();
-
if (extent == null) {
- extentxReporter = new ExtentXReporter(dbIp, dbPort);
extent = new ExtentReports();
initAndSetExtentHtmlReporter(filePath, htmlFile, isAppend);
- if (extentxReporter.config().getReportObjectId() != null) {
- setExtentXReporter(isAppend);
- } else {
- extentxReporter.stop();
- }
}
return extent;
}
- private static synchronized void setExtentXReporter(Boolean isAppend) {
- extentxReporter.setAppendExisting(isAppend);
- extent.attachReporter(extentxReporter);
- }
-
private static synchronized void initAndSetExtentHtmlReporter(String filePath, String htmlFile, Boolean isAppend) throws Exception {
htmlReporter = new ExtentHtmlReporter(filePath + htmlFile);
setConfiguration(htmlReporter);
@@ -157,14 +125,26 @@ public class ExtentManager {
return htmlReporter;
}
- public static void closeReporter() {
- extent.flush();
- }
-
private static void setTrafficCaptue(Config config) {
boolean mobProxyStatus = config.isUseBrowserMobProxy();
if (mobProxyStatus) {
config.setCaptureTraffic(true);
}
}
+
+ public enum suiteNameXml {
+
+ TESTNG_FAILED_XML_NAME("testng-failed.xml");
+
+ private String value;
+
+ suiteNameXml(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ }
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/ExtentTestManager.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/ExtentTestManager.java
index 2d194ba5e7..1d891e559b 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/ExtentTestManager.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/setup/ExtentTestManager.java
@@ -22,18 +22,17 @@ package org.onap.sdc.frontend.ci.tests.execute.setup;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
-import org.onap.sdc.backend.ci.tests.api.SomeInterface;
-
import java.util.HashMap;
+import java.util.Map;
+import org.onap.sdc.backend.ci.tests.api.SomeInterface;
public class ExtentTestManager implements SomeInterface {
- private final HashMap<Long, ExtentTest> extentTestByThreadIdMap = new HashMap<>();
- private final ExtentReports extent = ExtentManager.getReporter();
private static final ExtentTestManager INSTANCE = new ExtentTestManager();
+ private final Map<Long, ExtentTest> extentTestByThreadIdMap = new HashMap<>();
+ private final ExtentReports extent = ExtentManager.getReporter();
private ExtentTestManager() {
-
}
public static ExtentTestManager getInstance() {
@@ -49,15 +48,8 @@ public class ExtentTestManager implements SomeInterface {
extent.flush();
}
- public synchronized ExtentTest startTest(final String testName) {
- return startTest(testName, "");
- }
-
- public synchronized ExtentTest startTest(final String testName, final String desc) {
- final ExtentTest test = extent.createTest(testName, desc);
- extentTestByThreadIdMap.put(Thread.currentThread().getId(), test);
-
- return test;
+ public synchronized void startTest(final String testName) {
+ extentTestByThreadIdMap.put(Thread.currentThread().getId(), extent.createTest(testName));
}
public synchronized <T> void assignCategory(Class<T> clazz) {
@@ -67,4 +59,3 @@ public class ExtentTestManager implements SomeInterface {
extentTestByThreadIdMap.get(Thread.currentThread().getId()).assignCategory(lastOne2 + "-" + lastOne1);
}
}
-