Skip to content
Snippets Groups Projects
Commit 3f0aa9b3 authored by Andrea Burattin's avatar Andrea Burattin
Browse files

Renamed source for CSV

parent f1cbd234
Branches
Tags
No related merge requests found
...@@ -25,10 +25,10 @@ import beamline.exceptions.SourceException; ...@@ -25,10 +25,10 @@ import beamline.exceptions.SourceException;
* *
* @author Andrea Burattin * @author Andrea Burattin
*/ */
public class CSVLogSource extends BeamlineAbstractSource { public class CSVXesLogSource extends BeamlineAbstractSource {
private static final long serialVersionUID = 205574514393782145L; private static final long serialVersionUID = 205574514393782145L;
private CSVLogSource.ParserConfiguration parserConfiguration; private CSVXesLogSource.ParserConfiguration parserConfiguration;
private String filename; private String filename;
private int caseIdColumn; private int caseIdColumn;
private int activityNameColumn; private int activityNameColumn;
...@@ -44,7 +44,7 @@ public class CSVLogSource extends BeamlineAbstractSource { ...@@ -44,7 +44,7 @@ public class CSVLogSource extends BeamlineAbstractSource {
* @param parserConfiguration the parser configuration to be used for * @param parserConfiguration the parser configuration to be used for
* parsing the CSV file * parsing the CSV file
*/ */
public CSVLogSource(String filename, int caseIdColumn, int activityNameColumn, CSVLogSource.ParserConfiguration parserConfiguration) { public CSVXesLogSource(String filename, int caseIdColumn, int activityNameColumn, CSVXesLogSource.ParserConfiguration parserConfiguration) {
this.filename = filename; this.filename = filename;
this.caseIdColumn = caseIdColumn; this.caseIdColumn = caseIdColumn;
this.activityNameColumn = activityNameColumn; this.activityNameColumn = activityNameColumn;
...@@ -60,8 +60,8 @@ public class CSVLogSource extends BeamlineAbstractSource { ...@@ -60,8 +60,8 @@ public class CSVLogSource extends BeamlineAbstractSource {
* @param activityNameColumn the id of the column containing the activity * @param activityNameColumn the id of the column containing the activity
* name (counting starts from 0) * name (counting starts from 0)
*/ */
public CSVLogSource(String filename, int caseIdColumn, int activityNameColumn) { public CSVXesLogSource(String filename, int caseIdColumn, int activityNameColumn) {
this(filename, caseIdColumn, activityNameColumn, new CSVLogSource.ParserConfiguration()); this(filename, caseIdColumn, activityNameColumn, new CSVXesLogSource.ParserConfiguration());
} }
@Override @Override
......
...@@ -26,7 +26,7 @@ import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; ...@@ -26,7 +26,7 @@ import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import beamline.events.BEvent; import beamline.events.BEvent;
import beamline.sources.CSVLogSource; import beamline.sources.CSVXesLogSource;
import beamline.sources.MQTTXesSource; import beamline.sources.MQTTXesSource;
import beamline.sources.XesLogSource; import beamline.sources.XesLogSource;
...@@ -36,7 +36,7 @@ public class SourcesTest { ...@@ -36,7 +36,7 @@ public class SourcesTest {
public void test_csv_source_1() throws Exception { public void test_csv_source_1() throws Exception {
List<String> acts = new LinkedList<>(); List<String> acts = new LinkedList<>();
List<String> caseIds = new LinkedList<>(); List<String> caseIds = new LinkedList<>();
CSVLogSource source = new CSVLogSource("src/test/resources/sources/source.csv", 0, 1); CSVXesLogSource source = new CSVXesLogSource("src/test/resources/sources/source.csv", 0, 1);
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
DataStream<BEvent> stream = env.addSource(source); DataStream<BEvent> stream = env.addSource(source);
...@@ -56,11 +56,11 @@ public class SourcesTest { ...@@ -56,11 +56,11 @@ public class SourcesTest {
public void test_csv_source_2() throws Exception { public void test_csv_source_2() throws Exception {
List<String> acts = new LinkedList<>(); List<String> acts = new LinkedList<>();
List<String> caseIds = new LinkedList<>(); List<String> caseIds = new LinkedList<>();
CSVLogSource source = new CSVLogSource( CSVXesLogSource source = new CSVXesLogSource(
"src/test/resources/sources/source_2.csv", "src/test/resources/sources/source_2.csv",
0, 0,
1, 1,
new CSVLogSource.ParserConfiguration().withSeparator('|')); new CSVXesLogSource.ParserConfiguration().withSeparator('|'));
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
DataStream<BEvent> stream = env.addSource(source); DataStream<BEvent> stream = env.addSource(source);
...@@ -78,7 +78,7 @@ public class SourcesTest { ...@@ -78,7 +78,7 @@ public class SourcesTest {
@Test @Test
public void test_csv_source_3() { public void test_csv_source_3() {
CSVLogSource source = new CSVLogSource("DOESNT_EXIST", 0, 1); CSVXesLogSource source = new CSVXesLogSource("DOESNT_EXIST", 0, 1);
assertThrowsExactly(JobExecutionException.class, () -> { assertThrowsExactly(JobExecutionException.class, () -> {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.addSource(source).map(e -> e).print(); env.addSource(source).map(e -> e).print();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment