Skip to content

Bumped edireader library version, upgraded processor bundle version to be independent from Nifi version, fixed tests on Windows, fixed static analysis code unconventional #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

## Directory-based project format:
.idea/
.vscode/
# if you remove the above rule, at least ignore the following:

# User-specific stuff:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ documents into XML using the
```bash
> cd nifi-edireader-processor
> mvn package
> cp nifi-edireader-nar/target/nifi-edireader-nar-1.9.2.nar /NIFI_INSTALL/lib/
> cp nifi-edireader-nar/target/nifi-edireader-nar-2.0.0.nar /NIFI_INSTALL/lib/
```

## License
Expand Down
6 changes: 3 additions & 3 deletions nifi-edireader-nar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<artifactId>nifi-edireader-bundle</artifactId>
<groupId>org.apache.nifi</groupId>
<version>1.9.2</version>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>nifi-edireader-nar</artifactId>
<version>1.9.2</version>
<version>2.0.0</version>
<packaging>nar</packaging>
<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
Expand All @@ -21,7 +21,7 @@
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-edireader-processors</artifactId>
<version>1.9.2</version>
<version>2.0.0</version>
</dependency>
</dependencies>
</project>
4 changes: 2 additions & 2 deletions nifi-edireader-processors/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>nifi-edireader-bundle</artifactId>
<groupId>org.apache.nifi</groupId>
<version>1.9.2</version>
<version>2.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -31,7 +31,7 @@
<dependency>
<groupId>com.berryworks</groupId>
<artifactId>edireader</artifactId>
<version>5.4.17</version>
<version>5.6.5</version>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.berryworks.edireader.EDIParserFactory;

import com.berryworks.edireader.error.MissingMandatoryElementException;
import org.apache.nifi.annotation.documentation.CapabilityDescription;
import org.apache.nifi.annotation.documentation.Tags;
import org.apache.nifi.components.PropertyDescriptor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private static String generateFileName(String elementSeparator, String isa, Stri

public Map<String, String> writer() {

Map results = new HashMap();
Map<String, String> results = new HashMap<>();

transactions.forEach(t -> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public List<FlowFile> splitData(ProcessSession session, FlowFile flowFile) throw
break;
}
}
scanner.close();
return flowFiles;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;

Expand Down Expand Up @@ -68,10 +67,13 @@ public void testOnTriggerPrettyJson() throws IOException {

MockFlowFile result = results.get(0);

byte[] bytes = Files.readAllBytes(Paths.get(output));
// Change line ending of the output file to be inline with the operating system line separator
File outputFile = FileUtils.getFile(output);
String outputContent = FileUtils.readFileToString(outputFile, Charset.defaultCharset());
outputContent = outputContent.replaceAll("\n", System.getProperty("line.separator"));

// Test attributes and content
result.assertContentEquals(bytes);
result.assertContentEquals(outputContent.getBytes(Charset.defaultCharset()));
}

@Test
Expand All @@ -91,10 +93,13 @@ public void testOnTriggerPrettyJsonDouble() throws IOException {

MockFlowFile result = results.get(0);

byte[] bytes = Files.readAllBytes(Paths.get(output));
// Change line ending of the output file to be inline with the operating system line separator
File outputFile = FileUtils.getFile(output);
String outputContent = FileUtils.readFileToString(outputFile, Charset.defaultCharset());
outputContent = outputContent.replaceAll("\n", System.getProperty("line.separator"));

// Test attributes and content
result.assertContentEquals(bytes);
result.assertContentEquals(outputContent.getBytes(Charset.defaultCharset()));
}

@Test
Expand All @@ -117,7 +122,7 @@ public void testOnTriggerBadEdiFile() throws IOException {
}

private String ediFile(String fileName) {
return this.getClass().getResource(fileName).getPath();
return new File(this.getClass().getResource(fileName).getPath()).toPath().toString();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ public void testOnTriggerError() throws IOException {
}

private String ediFile(String fileName) {
return this.getClass().getResource(fileName).getPath();
return new File(this.getClass().getResource(fileName).getPath()).toPath().toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ public void testOnTriggerFailure() throws IOException {
}

private String ediFile(String fileName) {
return this.getClass().getResource(fileName).getPath();
return new File(this.getClass().getResource(fileName).getPath()).toPath().toString();
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</parent>

<artifactId>nifi-edireader-bundle</artifactId>
<version>1.9.2</version>
<version>2.0.0</version>
<packaging>pom</packaging>

<properties>
Expand Down