From bf0e06db97e71f71c07fc6f91c7e23b7b5c26939 Mon Sep 17 00:00:00 2001 From: kaklakariada Date: Sun, 27 Jun 2021 11:25:26 +0200 Subject: [PATCH 1/6] Add missing plugin feature --- api/src/main/java/org/itsallcode/whiterabbit/api/Plugin.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/src/main/java/org/itsallcode/whiterabbit/api/Plugin.java b/api/src/main/java/org/itsallcode/whiterabbit/api/Plugin.java index 4e86e64f..c0f09842 100644 --- a/api/src/main/java/org/itsallcode/whiterabbit/api/Plugin.java +++ b/api/src/main/java/org/itsallcode/whiterabbit/api/Plugin.java @@ -1,5 +1,6 @@ package org.itsallcode.whiterabbit.api; +import org.itsallcode.whiterabbit.api.features.Holidays; import org.itsallcode.whiterabbit.api.features.MonthDataStorage; import org.itsallcode.whiterabbit.api.features.PluginFeature; import org.itsallcode.whiterabbit.api.features.ProjectReportExporter; @@ -14,6 +15,7 @@ * */ public interface Plugin From 2bfd6e55ea76af43909d85aafdde270bac100089 Mon Sep 17 00:00:00 2001 From: kaklakariada Date: Sun, 27 Jun 2021 11:26:32 +0200 Subject: [PATCH 2/6] Fix supports() method of AbstractPlugin always returning true --- .../whiterabbit/api/AbstractPlugin.java | 9 +- .../whiterabbit/api/AbstractPluginTest.java | 84 +++++++++++++++++++ .../HolidayCalculatorPluginTest.java | 31 +++++++ 3 files changed, 121 insertions(+), 3 deletions(-) create mode 100644 api/src/test/java/org/itsallcode/whiterabbit/api/AbstractPluginTest.java create mode 100644 plugins/holiday-calculator/src/test/java/org/itsallcode/whiterabbit/plugin/holidaycalculator/HolidayCalculatorPluginTest.java diff --git a/api/src/main/java/org/itsallcode/whiterabbit/api/AbstractPlugin.java b/api/src/main/java/org/itsallcode/whiterabbit/api/AbstractPlugin.java index 638eb523..b3609aac 100644 --- a/api/src/main/java/org/itsallcode/whiterabbit/api/AbstractPlugin.java +++ b/api/src/main/java/org/itsallcode/whiterabbit/api/AbstractPlugin.java @@ -35,7 +35,7 @@ public void close() @Override public boolean supports(Class featureType) { - return featureType.isAssignableFrom(featureType); + return this.featureType.isAssignableFrom(featureType); } protected abstract S createInstance(); @@ -43,9 +43,12 @@ public boolean supports(Class featureType) @Override public T getFeature(Class featureType) { - if (featureType.isAssignableFrom(this.featureType)) + if (this.supports(featureType)) { - return featureType.cast(createInstance()); + if (this.supports(featureType)) + { + return featureType.cast(createInstance()); + } } throw new IllegalArgumentException("Feature " + featureType.getName() + " not supported by plugin " + getId()); } diff --git a/api/src/test/java/org/itsallcode/whiterabbit/api/AbstractPluginTest.java b/api/src/test/java/org/itsallcode/whiterabbit/api/AbstractPluginTest.java new file mode 100644 index 00000000..3d0532d9 --- /dev/null +++ b/api/src/test/java/org/itsallcode/whiterabbit/api/AbstractPluginTest.java @@ -0,0 +1,84 @@ +package org.itsallcode.whiterabbit.api; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import org.itsallcode.whiterabbit.api.features.PluginFeature; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class AbstractPluginTest +{ + private static final String PLUGIN_ID = "testing-plugin"; + + @Mock + SupportedFeature supportedFeatureMock; + + private TestingAbstractPlugin plugin; + + @BeforeEach + void setUp() + { + plugin = new TestingAbstractPlugin(); + } + + @Test + void supportsReturnsTrueForSupportedFeature() + { + assertThat(plugin.supports(SupportedFeature.class)).isTrue(); + } + + @Test + void supportsReturnsFalseForUnsupportedFeature() + { + assertThat(plugin.supports(UnsupportedFeature.class)).isFalse(); + } + + @Test + void gettingUnsupportedFeatureThrowsException() + { + assertThatThrownBy(() -> plugin.getFeature(UnsupportedFeature.class)) + .isInstanceOf(IllegalArgumentException.class).hasMessage( + "Feature " + UnsupportedFeature.class.getName() + " not supported by plugin " + PLUGIN_ID); + } + + @Test + void gettingSupportedFeatureWorks() + { + assertThat(plugin.getFeature(SupportedFeature.class)).isSameAs(supportedFeatureMock); + } + + @Test + void getPluginId() + { + assertThat(plugin.getId()).isEqualTo(PLUGIN_ID); + } + + private interface SupportedFeature extends PluginFeature + { + + } + + private interface UnsupportedFeature extends PluginFeature + { + + } + + private class TestingAbstractPlugin extends AbstractPlugin + { + protected TestingAbstractPlugin() + { + super(PLUGIN_ID, SupportedFeature.class); + } + + @Override + protected SupportedFeature createInstance() + { + return supportedFeatureMock; + } + } +} diff --git a/plugins/holiday-calculator/src/test/java/org/itsallcode/whiterabbit/plugin/holidaycalculator/HolidayCalculatorPluginTest.java b/plugins/holiday-calculator/src/test/java/org/itsallcode/whiterabbit/plugin/holidaycalculator/HolidayCalculatorPluginTest.java new file mode 100644 index 00000000..346c07f5 --- /dev/null +++ b/plugins/holiday-calculator/src/test/java/org/itsallcode/whiterabbit/plugin/holidaycalculator/HolidayCalculatorPluginTest.java @@ -0,0 +1,31 @@ +package org.itsallcode.whiterabbit.plugin.holidaycalculator; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.itsallcode.whiterabbit.api.features.Holidays; +import org.itsallcode.whiterabbit.api.features.ProjectReportExporter; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class HolidayCalculatorPluginTest +{ + private HolidayCalculatorPlugin holidayCalculatorPlugin; + + @BeforeEach + void setUp() + { + holidayCalculatorPlugin = new HolidayCalculatorPlugin(); + } + + @Test + void pluginSupportsHolidaysFeature() + { + assertThat(holidayCalculatorPlugin.supports(Holidays.class)).isTrue(); + } + + @Test + void pluginDoesNotSupportProjectReportExporterFeature() + { + assertThat(holidayCalculatorPlugin.supports(ProjectReportExporter.class)).isFalse(); + } +} From c5e71fece60fe7c04c6b8c75b57b1e653afdd7e5 Mon Sep 17 00:00:00 2001 From: kaklakariada Date: Sun, 27 Jun 2021 11:37:00 +0200 Subject: [PATCH 3/6] Add changelog entry --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ff4b39a..5f31bc64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 See [Release](https://github.com/itsallcode/white-rabbit/releases/tag/v1.7.0) / [Milestone](https://github.com/itsallcode/white-rabbit/milestone/9?closed=1) +### Fixed + +* [#191](https://github.com/itsallcode/white-rabbit/pull/191): Starting WR with all plugins enabled failed with exception `IllegalStateException: Found multiple plugins supporting org.itsallcode.whiterabbit.api.features.MonthDataStorage`. + ### Added * [#158](https://github.com/itsallcode/white-rabbit/issues/158): PMSmart plugin: Support optional configuration `pmsmart.transfer.comments` to skip transfer of comments. From d61381f1f91ac962e559d5ae8074f970f21a1b35 Mon Sep 17 00:00:00 2001 From: kaklakariada Date: Sun, 27 Jun 2021 11:52:55 +0200 Subject: [PATCH 4/6] Format sources, reduce visibility --- .../whiterabbit/plugin/csv/CSVConfig.java | 24 +++++---- .../plugin/csv/CSVProjectReportExporter.java | 50 ++++++++++++------- .../plugin/csv/DirectoryStreamProvider.java | 11 ++-- .../plugin/csv/OutStreamProvider.java | 3 +- 4 files changed, 54 insertions(+), 34 deletions(-) diff --git a/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/CSVConfig.java b/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/CSVConfig.java index 2f3759e8..889ea5af 100644 --- a/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/CSVConfig.java +++ b/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/CSVConfig.java @@ -1,33 +1,37 @@ package org.itsallcode.whiterabbit.plugin.csv; -import org.itsallcode.whiterabbit.api.PluginConfiguration; - import java.nio.file.Path; import java.nio.file.Paths; -public class CSVConfig { +import org.itsallcode.whiterabbit.api.PluginConfiguration; + +class CSVConfig +{ private final boolean filterForWeekDays; private final Path outPath; private final String separator; - public boolean getFilterForWeekDays() { + boolean getFilterForWeekDays() + { return filterForWeekDays; } - public Path getOutPath() { + Path getOutPath() + { return outPath; } - public String getSeparator() { + String getSeparator() + { return separator; } - public CSVConfig(PluginConfiguration config) { + CSVConfig(PluginConfiguration config) + { final String defaultPath = System.getProperty("user.home"); this.outPath = Paths.get(config.getOptionalValue("destination").orElse(defaultPath)); this.separator = config.getOptionalValue("separator").orElse(","); - this.filterForWeekDays = - config.getOptionalValue("filter_for_weekdays") - .orElse("false").equalsIgnoreCase("true"); + this.filterForWeekDays = config.getOptionalValue("filter_for_weekdays") + .orElse("false").equalsIgnoreCase("true"); } } diff --git a/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/CSVProjectReportExporter.java b/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/CSVProjectReportExporter.java index 11944e8a..441c095b 100644 --- a/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/CSVProjectReportExporter.java +++ b/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/CSVProjectReportExporter.java @@ -17,33 +17,38 @@ import org.itsallcode.whiterabbit.api.model.ProjectReportActivity; import org.itsallcode.whiterabbit.api.model.ProjectReportDay; -class CSVProjectReportExporter implements ProjectReportExporter { +class CSVProjectReportExporter implements ProjectReportExporter +{ private final OutStreamProvider outStreamProvider; private final CSVConfig csvConfig; - CSVProjectReportExporter(CSVConfig csvConfig, OutStreamProvider outStreamProvider) { + CSVProjectReportExporter(CSVConfig csvConfig, OutStreamProvider outStreamProvider) + { this.csvConfig = csvConfig; this.outStreamProvider = outStreamProvider; } @Override - public void export(ProjectReport report, ProgressMonitor progressMonitor) { + public void export(ProjectReport report, ProgressMonitor progressMonitor) + { progressMonitor.setTaskName("Exporting..."); - if (progressMonitor.isCanceled()) { + if (progressMonitor.isCanceled()) + { return; } final String separator = csvConfig.getSeparator(); - final List filteredDays = - report.getDays().stream() - .filter(Objects::nonNull) - .filter(day -> !csvConfig.getFilterForWeekDays() || day.getType() == DayType.WORK) - .collect(Collectors.toList()); + final List filteredDays = report.getDays().stream() + .filter(Objects::nonNull) + .filter(day -> !csvConfig.getFilterForWeekDays() || day.getType() == DayType.WORK) + .collect(Collectors.toList()); - try (final PrintStream os = new PrintStream(outStreamProvider.getStream(report.getMonth().toString()))) { + try (final PrintStream os = new PrintStream(outStreamProvider.getStream(report.getMonth().toString()))) + { os.println(MessageFormat.format("Date{0}Project{0}TimePerProject{0}TimePerDay{0}Comment", separator)); - for (final ProjectReportDay day : filteredDays) { + for (final ProjectReportDay day : filteredDays) + { final String dayComment = formatEmptyString(day.getComment()); final Duration dayWorkingTime = day.getProjects() == null ? Duration.ZERO : getDayWorkingTime(day); final String dayDurationStr = formatDuration(dayWorkingTime); @@ -51,8 +56,10 @@ public void export(ProjectReport report, ProgressMonitor progressMonitor) { os.println(MessageFormat.format("{0}{1}{1}{1}{2}{1}{3}", day.getDate(), separator, dayDurationStr, dayComment)); - if (day.getProjects() != null) { - for (final ProjectReportActivity project : day.getProjects()) { + if (day.getProjects() != null) + { + for (final ProjectReportActivity project : day.getProjects()) + { final String projectWorkingTime = formatDuration(project.getWorkingTime()); final String projectLabel = formatEmptyString(project.getProject().getLabel()); final String activityComment = formatEmptyString(project.getComment()); @@ -61,22 +68,27 @@ public void export(ProjectReport report, ProgressMonitor progressMonitor) { } } } - } catch (IOException ex) { + } + catch (final IOException ex) + { throw new UncheckedIOException("Error exporting report to CSV:" + ex, ex); } } - private Duration getDayWorkingTime(ProjectReportDay day) { + private Duration getDayWorkingTime(ProjectReportDay day) + { return day.getProjects().stream().reduce(Duration.ZERO, - (subtotal, element) -> element == null ? - subtotal : element.getWorkingTime().plus(subtotal), Duration::plus); + (subtotal, element) -> element == null ? subtotal : element.getWorkingTime().plus(subtotal), + Duration::plus); } - private String formatEmptyString(String value) { + private String formatEmptyString(String value) + { return value == null ? "" : value; } - private String formatDuration(Duration duration) { + private String formatDuration(Duration duration) + { final long minutes = TimeUnit.SECONDS.toMinutes(duration.getSeconds()); final long absMinutes = Math.abs(minutes); final String positive = String.format("%02d:%02d", absMinutes / 60, absMinutes % 60); diff --git a/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/DirectoryStreamProvider.java b/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/DirectoryStreamProvider.java index 7cf411af..99d1d2f3 100644 --- a/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/DirectoryStreamProvider.java +++ b/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/DirectoryStreamProvider.java @@ -5,16 +5,19 @@ import java.nio.file.Files; import java.nio.file.Path; -public class DirectoryStreamProvider implements OutStreamProvider { +class DirectoryStreamProvider implements OutStreamProvider +{ private final Path outPath; - DirectoryStreamProvider(Path outPath) { - this.outPath= outPath; + DirectoryStreamProvider(Path outPath) + { + this.outPath = outPath; } @Override - public OutputStream getStream(String name) throws IOException { + public OutputStream getStream(String name) throws IOException + { final String outFile = String.format("%s_working_time.csv", name); return Files.newOutputStream(outPath.resolve(outFile)); } diff --git a/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/OutStreamProvider.java b/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/OutStreamProvider.java index d4ab2dde..9f395127 100644 --- a/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/OutStreamProvider.java +++ b/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/OutStreamProvider.java @@ -3,6 +3,7 @@ import java.io.IOException; import java.io.OutputStream; -public interface OutStreamProvider { +interface OutStreamProvider +{ OutputStream getStream(String name) throws IOException; } From 340fc3c06264d962f804be4cc0e673a02ae845bc Mon Sep 17 00:00:00 2001 From: kaklakariada Date: Sun, 27 Jun 2021 11:53:25 +0200 Subject: [PATCH 5/6] Bugfix: use correct feature type --- .../plugin/csv/CSVExporterPlugin.java | 7 +-- .../plugin/csv/CSVExporterPluginTest.java | 46 +++++++++++++++++++ .../HolidayCalculatorPlugin.java | 5 +- .../HolidayCalculatorPluginTest.java | 31 +++++++++++-- 4 files changed, 80 insertions(+), 9 deletions(-) create mode 100644 plugins/csv/src/test/java/org/itsallcode/whiterabbit/plugin/csv/CSVExporterPluginTest.java diff --git a/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/CSVExporterPlugin.java b/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/CSVExporterPlugin.java index 85e2f0b2..c24014a3 100644 --- a/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/CSVExporterPlugin.java +++ b/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/CSVExporterPlugin.java @@ -1,12 +1,13 @@ package org.itsallcode.whiterabbit.plugin.csv; import org.itsallcode.whiterabbit.api.AbstractPlugin; +import org.itsallcode.whiterabbit.api.features.ProjectReportExporter; -public class CSVExporterPlugin extends AbstractPlugin +class CSVExporterPlugin extends AbstractPlugin { - public CSVExporterPlugin() + CSVExporterPlugin() { - super("csv", CSVProjectReportExporter.class); + super("csv", ProjectReportExporter.class); } @Override diff --git a/plugins/csv/src/test/java/org/itsallcode/whiterabbit/plugin/csv/CSVExporterPluginTest.java b/plugins/csv/src/test/java/org/itsallcode/whiterabbit/plugin/csv/CSVExporterPluginTest.java new file mode 100644 index 00000000..e37cdd50 --- /dev/null +++ b/plugins/csv/src/test/java/org/itsallcode/whiterabbit/plugin/csv/CSVExporterPluginTest.java @@ -0,0 +1,46 @@ +package org.itsallcode.whiterabbit.plugin.csv; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.itsallcode.whiterabbit.api.PluginConfiguration; +import org.itsallcode.whiterabbit.api.features.Holidays; +import org.itsallcode.whiterabbit.api.features.ProjectReportExporter; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class CSVExporterPluginTest +{ + @Mock + private PluginConfiguration configMock; + + private CSVExporterPlugin plugin; + + @BeforeEach + void setUp() + { + plugin = new CSVExporterPlugin(); + } + + @Test + void pluginSupportsProjectReportExporterFeature() + { + assertThat(plugin.supports(ProjectReportExporter.class)).isTrue(); + } + + @Test + void pluginDoesNotSupportHolidaysFeature() + { + assertThat(plugin.supports(Holidays.class)).isFalse(); + } + + @Test + void getFeature() + { + plugin.init(configMock); + assertThat(plugin.getFeature(ProjectReportExporter.class)).isNotNull(); + } +} diff --git a/plugins/holiday-calculator/src/main/java/org/itsallcode/whiterabbit/plugin/holidaycalculator/HolidayCalculatorPlugin.java b/plugins/holiday-calculator/src/main/java/org/itsallcode/whiterabbit/plugin/holidaycalculator/HolidayCalculatorPlugin.java index 03393757..f712d282 100644 --- a/plugins/holiday-calculator/src/main/java/org/itsallcode/whiterabbit/plugin/holidaycalculator/HolidayCalculatorPlugin.java +++ b/plugins/holiday-calculator/src/main/java/org/itsallcode/whiterabbit/plugin/holidaycalculator/HolidayCalculatorPlugin.java @@ -1,12 +1,13 @@ package org.itsallcode.whiterabbit.plugin.holidaycalculator; import org.itsallcode.whiterabbit.api.AbstractPlugin; +import org.itsallcode.whiterabbit.api.features.Holidays; -public class HolidayCalculatorPlugin extends AbstractPlugin +public class HolidayCalculatorPlugin extends AbstractPlugin { public HolidayCalculatorPlugin() { - super("holidaycalculator", CalculatedHolidays.class); + super("holidaycalculator", Holidays.class); } @Override diff --git a/plugins/holiday-calculator/src/test/java/org/itsallcode/whiterabbit/plugin/holidaycalculator/HolidayCalculatorPluginTest.java b/plugins/holiday-calculator/src/test/java/org/itsallcode/whiterabbit/plugin/holidaycalculator/HolidayCalculatorPluginTest.java index 346c07f5..54feee8c 100644 --- a/plugins/holiday-calculator/src/test/java/org/itsallcode/whiterabbit/plugin/holidaycalculator/HolidayCalculatorPluginTest.java +++ b/plugins/holiday-calculator/src/test/java/org/itsallcode/whiterabbit/plugin/holidaycalculator/HolidayCalculatorPluginTest.java @@ -1,31 +1,54 @@ package org.itsallcode.whiterabbit.plugin.holidaycalculator; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; +import java.nio.file.Path; + +import org.itsallcode.whiterabbit.api.PluginConfiguration; import org.itsallcode.whiterabbit.api.features.Holidays; import org.itsallcode.whiterabbit.api.features.ProjectReportExporter; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.io.TempDir; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +@ExtendWith(MockitoExtension.class) class HolidayCalculatorPluginTest { - private HolidayCalculatorPlugin holidayCalculatorPlugin; + @Mock + private PluginConfiguration configMock; + + @TempDir + Path dataDir; + + private HolidayCalculatorPlugin plugin; @BeforeEach void setUp() { - holidayCalculatorPlugin = new HolidayCalculatorPlugin(); + plugin = new HolidayCalculatorPlugin(); } @Test void pluginSupportsHolidaysFeature() { - assertThat(holidayCalculatorPlugin.supports(Holidays.class)).isTrue(); + assertThat(plugin.supports(Holidays.class)).isTrue(); } @Test void pluginDoesNotSupportProjectReportExporterFeature() { - assertThat(holidayCalculatorPlugin.supports(ProjectReportExporter.class)).isFalse(); + assertThat(plugin.supports(ProjectReportExporter.class)).isFalse(); + } + + @Test + void getFeature() + { + when(configMock.getDataDir()).thenReturn(dataDir); + plugin.init(configMock); + assertThat(plugin.getFeature(Holidays.class)).isNotNull(); } } From 49db282daf3906eb48c60c18b6e824666f3e5288 Mon Sep 17 00:00:00 2001 From: kaklakariada Date: Sun, 27 Jun 2021 12:01:10 +0200 Subject: [PATCH 6/6] Log CSV exporter target file --- .../whiterabbit/plugin/csv/CSVExporterPlugin.java | 4 ++-- .../whiterabbit/plugin/csv/DirectoryStreamProvider.java | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/CSVExporterPlugin.java b/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/CSVExporterPlugin.java index c24014a3..6d9af0a0 100644 --- a/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/CSVExporterPlugin.java +++ b/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/CSVExporterPlugin.java @@ -3,9 +3,9 @@ import org.itsallcode.whiterabbit.api.AbstractPlugin; import org.itsallcode.whiterabbit.api.features.ProjectReportExporter; -class CSVExporterPlugin extends AbstractPlugin +public class CSVExporterPlugin extends AbstractPlugin { - CSVExporterPlugin() + public CSVExporterPlugin() { super("csv", ProjectReportExporter.class); } diff --git a/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/DirectoryStreamProvider.java b/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/DirectoryStreamProvider.java index 99d1d2f3..4371a728 100644 --- a/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/DirectoryStreamProvider.java +++ b/plugins/csv/src/main/java/org/itsallcode/whiterabbit/plugin/csv/DirectoryStreamProvider.java @@ -5,9 +5,12 @@ import java.nio.file.Files; import java.nio.file.Path; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + class DirectoryStreamProvider implements OutStreamProvider { - + private static final Logger LOG = LogManager.getLogger(DirectoryStreamProvider.class); private final Path outPath; DirectoryStreamProvider(Path outPath) @@ -19,6 +22,8 @@ class DirectoryStreamProvider implements OutStreamProvider public OutputStream getStream(String name) throws IOException { final String outFile = String.format("%s_working_time.csv", name); - return Files.newOutputStream(outPath.resolve(outFile)); + final Path path = outPath.resolve(outFile); + LOG.info("Writing output to {}", path); + return Files.newOutputStream(path); } }