Skip to content

Commit 3e2a404

Browse files
committed
closes #145
1 parent d904ecc commit 3e2a404

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

src/main/java/com/aventstack/extentreports/reporter/ConfigurableReporter.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,14 @@ protected void init(String[] configFilePath, BasicConfiguration userConfig) {
120120
}
121121

122122
protected void loadInternalReporterConfiguration(String[] configFilePath) {
123+
if (configFilePath == null || configFilePath.length == 0)
124+
return;
125+
123126
ClassLoader loader = getClass().getClassLoader();
124-
Arrays.stream(configFilePath).map(x -> loader.getResourceAsStream(x)).filter(x -> x != null).findFirst()
127+
Arrays.stream(configFilePath)
128+
.map(x -> loader.getResourceAsStream(x))
129+
.filter(x -> x != null)
130+
.findFirst()
125131
.ifPresent(x -> loadConfig(x));
126132
}
127133

src/main/java/com/aventstack/extentreports/reporter/ExtentKlovReporter.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import com.aventstack.extentreports.model.context.TestAttributeTestContextStore;
3737
import com.aventstack.extentreports.model.service.LogService;
3838
import com.aventstack.extentreports.model.service.TestService;
39+
import com.aventstack.extentreports.reporter.configuration.ExtentKlovReporterConfiguration;
3940
import com.aventstack.extentreports.utils.IntUtil;
4041
import com.aventstack.extentreports.utils.MongoUtil;
4142
import com.mongodb.MongoClient;
@@ -64,6 +65,8 @@ public class ExtentKlovReporter extends ConfigurableReporter {
6465
private static final String DB_NAME = "klov";
6566
private static final String DEFAULT_PROJECT_NAME = "Default";
6667

68+
private ExtentKlovReporterConfiguration config = new ExtentKlovReporterConfiguration(this);
69+
6770
private String url;
6871
private List<Test> testList;
6972
private ReportStatusStats stats;
@@ -250,14 +253,23 @@ public ExtentKlovReporter initKlovServerConnection(String url) {
250253
return this;
251254
}
252255

256+
public void loadInitializationParams(InputStream is) {
257+
init(null, config);
258+
loadConfig(is);
259+
loadInitializationParams();
260+
}
261+
253262
public void loadInitializationParams(String propertiesPath) throws FileNotFoundException {
263+
init(null, config);
254264
File f = new File(propertiesPath);
255-
InputStream stream = new FileInputStream(f);
256-
loadConfig(stream);
257-
loadInitializationParams();
265+
if (f.exists()) {
266+
InputStream stream = new FileInputStream(f);
267+
loadInitializationParams(stream);
268+
}
258269
}
259270

260271
public void loadInitializationParams(Properties props) {
272+
init(null, config);
261273
loadConfig(props);
262274
loadInitializationParams();
263275
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.aventstack.extentreports.reporter.configuration;
2+
3+
import com.aventstack.extentreports.reporter.AbstractReporter;
4+
5+
public class ExtentKlovReporterConfiguration extends RichViewReporterConfiguration {
6+
7+
public ExtentKlovReporterConfiguration(AbstractReporter reporter) {
8+
super(reporter);
9+
}
10+
11+
}

0 commit comments

Comments
 (0)