Skip to content
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
19 changes: 17 additions & 2 deletions .github/workflows/maven_build_and_verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ env:
SIGNING_ENABLED: ${{ github.event.inputs.signJarArtifacts }}

jobs:
build:

build-ubuntu:
name: Build on Ubuntu
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -127,3 +127,18 @@ jobs:

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3

build-windows:
name: Build on Windows
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'corretto'
cache: maven
- name: Build with Maven
run: mvn -B clean io.github.git-commit-id:git-commit-id-maven-plugin:revision io.github.git-commit-id:git-commit-id-maven-plugin:validateRevision install --file pom.xml
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Add retries to Neptune clone creation
- Fix missing csv headers from `export-pg-from-queries`
- Disable DFE for all Gremlin queries
- Fix invalid S3 paths when using Windows

## Neptune Export v1.1.11 (Release Date: Mar 10, 2025):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public File createDownloadFile(String parent) {

public S3ObjectInfo withNewKeySuffix(String suffix) {
File file = StringUtils.isNotEmpty(key) ? new File(key, suffix) : new File(suffix);
return new S3ObjectInfo( String.format("s3://%s/%s", bucket, file.getPath()));
return new S3ObjectInfo( String.format("s3://%s/%s", bucket, file.getPath().replace(File.separatorChar, '/')));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should leave a comment in the code describing why we are leaving the use of File here, since it might not make sense in the future.

}

public S3ObjectInfo replaceOrAppendKey(String placeholder, String ifPresent, String ifAbsent) {
Expand All @@ -82,7 +82,7 @@ public S3ObjectInfo replaceOrAppendKey(String placeholder, String ifPresent, Str
new File(key.replace(placeholder, ifPresent)) :
new File(key, ifAbsent);

return new S3ObjectInfo( String.format("s3://%s/%s", bucket, file.getPath()));
return new S3ObjectInfo( String.format("s3://%s/%s", bucket, file.getPath().replace(File.separatorChar, '/')));
}

public S3ObjectInfo replaceOrAppendKey(String placeholder, String ifPresent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void createsDigestFilePathsForVeryLongFilenames() throws IOException {
Directories directories = Directories.createFor(DirectoryStructure.PropertyGraph, new File("home"), "export-id", "", "");
Path filePath = directories.createFilePath(path, longName, PropertyGraphExportFormat.csv);

assertEquals("/export/8044f12c352773b7ff400ef524da6e90db419e4a.csv", filePath.toString());
assertEquals(Paths.get("/export","8044f12c352773b7ff400ef524da6e90db419e4a.csv").toString(), filePath.toString());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThrows;

import static org.junit.Assume.assumeTrue;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand All @@ -38,6 +39,10 @@ public void resetTargetModule() {

@Test
public void shouldCreateStreamIfNameAndRegionAreProvided() {
// Ignoring test for Windows due to incompatibility
String osName = System.getProperty("os.name");
assumeTrue(!osName.startsWith("Windows"));

when(target.getStreamName()).thenReturn("test");
when(target.getRegion()).thenReturn("us-west-2");
KinesisConfig config = new KinesisConfig(target);
Expand Down Expand Up @@ -67,6 +72,10 @@ public void shouldNotCreateStreamIfRegionNotProvided() {

@Test
public void shouldUseProvidedCredentialsProvider() throws InterruptedException {
// Ignoring test for Windows due to incompatibility
String osName = System.getProperty("os.name");
assumeTrue(!osName.startsWith("Windows"));

when(target.getStreamName()).thenReturn("test");
when(target.getRegion()).thenReturn("us-west-2");
AwsCredentialsProvider credentialsProvider = spy(AnonymousCredentialsProvider.create());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,24 @@ public void testExportStats() throws JsonProcessingException {
String formattedStats = stats.formatStats(schema);

String expectedStats =
"Source:\n" +
" Nodes: 0\n" +
" Edges: 0\n" +
"Export:\n" +
" Nodes: 2\n" +
" Edges: 2\n" +
" Properties: 0\n" +
"Details:\n" +
" Nodes: \n" +
" node1: 1\n" +
" |_ prop1 {propertyCount=0, minCardinality=-1, maxCardinality=-1, recordCount=0, dataTypeCounts=[]}\n" +
" |_ prop2 {propertyCount=0, minCardinality=-1, maxCardinality=-1, recordCount=0, dataTypeCounts=[]}\n" +
" node2: 1\n" +
" Edges: \n" +
" edge2: 1\n" +
" edge1: 1\n" +
" |_ prop1 {propertyCount=0, minCardinality=-1, maxCardinality=-1, recordCount=0, dataTypeCounts=[]}\n" +
" |_ prop2 {propertyCount=0, minCardinality=-1, maxCardinality=-1, recordCount=0, dataTypeCounts=[]}\n";
"Source:" + System.lineSeparator() +
" Nodes: 0" + System.lineSeparator() +
" Edges: 0" + System.lineSeparator() +
"Export:" + System.lineSeparator() +
" Nodes: 2" + System.lineSeparator() +
" Edges: 2" + System.lineSeparator() +
" Properties: 0" + System.lineSeparator() +
"Details:" + System.lineSeparator() +
" Nodes: " + System.lineSeparator() +
" node1: 1" + System.lineSeparator() +
" |_ prop1 {propertyCount=0, minCardinality=-1, maxCardinality=-1, recordCount=0, dataTypeCounts=[]}" + System.lineSeparator() +
" |_ prop2 {propertyCount=0, minCardinality=-1, maxCardinality=-1, recordCount=0, dataTypeCounts=[]}" + System.lineSeparator() +
" node2: 1" + System.lineSeparator() +
" Edges: " + System.lineSeparator() +
" edge2: 1" + System.lineSeparator() +
" edge1: 1" + System.lineSeparator() +
" |_ prop1 {propertyCount=0, minCardinality=-1, maxCardinality=-1, recordCount=0, dataTypeCounts=[]}" + System.lineSeparator() +
" |_ prop2 {propertyCount=0, minCardinality=-1, maxCardinality=-1, recordCount=0, dataTypeCounts=[]}" + System.lineSeparator();

assertEquals(expectedStats, formattedStats);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public void shouldNotEscapeNewlineCharAfterPrintPropertiesToCSVAndRewrite() thro

@Test
public void shouldNotEscapeNewlineAfterPrintPropertiesToCSVAndRewrite() throws Exception {
testEscapeCharacterAfterPrintPropertiesAndRewrite("A" + System.lineSeparator() + "B", "\"A\nB\"",
testEscapeCharacterAfterPrintPropertiesAndRewrite("A" + System.lineSeparator() + "B", "\"A"+System.lineSeparator()+"B\"",
new PrinterOptions(CsvPrinterOptions.builder().build()));
}

Expand All @@ -158,8 +158,9 @@ public void shouldEscapeNewlineCharSetTrueAfterPrintPropertiesToCSVAndRewrite()

@Test
public void shouldEscapeNewlineSetTrueAfterPrintPropertiesToCSVAndRewrite() throws Exception {
final String escapedLineSeparator = System.lineSeparator().replace("\r", "\\r").replace("\n", "\\n");
testEscapeCharacterAfterPrintPropertiesAndRewrite("A" + System.lineSeparator() + "B",
"\"A\\nB\"",
"\"A"+escapedLineSeparator+"B\"",
new PrinterOptions(CsvPrinterOptions.builder().setEscapeNewline(true).build()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ public void appendsPreviouslyUnseenValuesToObjectWhenInferringSchema() throws IO
map(entry("fname", "fname5"), entry("lname", "lname5"), entry("age", 50))
);

String expectedOutput = "{\"fname\":\"fname1\"}\n" +
"{\"fname\":\"fname2\",\"lname\":\"lname2\"}\n" +
"{\"fname\":\"fname3\",\"age\":30}\n" +
"{\"lname\":\"lname4\",\"age\":40}\n" +
String expectedOutput = "{\"fname\":\"fname1\"}" + System.lineSeparator() +
"{\"fname\":\"fname2\",\"lname\":\"lname2\"}" + System.lineSeparator() +
"{\"fname\":\"fname3\",\"age\":30}" + System.lineSeparator() +
"{\"lname\":\"lname4\",\"age\":40}" + System.lineSeparator() +
"{\"fname\":\"fname5\",\"lname\":\"lname5\",\"age\":50}";

assertEquals(expectedOutput, stringWriter.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ public void appendsPreviouslyUnseenColumnsToEndOfRow() throws IOException {
map(entry("fname", "fname5"), entry("lname", "lname5"), entry("age", 50))
);

String expectedOutput = "\"fname1\"\n" +
"\"fname2\",\"lname2\"\n" +
"\"fname3\",,30\n" +
",\"lname4\",40\n" +
"\"fname5\",\"lname5\",50\n";
String expectedOutput = "\"fname1\"" + System.lineSeparator() +
"\"fname2\",\"lname2\"" + System.lineSeparator() +
"\"fname3\",,30" + System.lineSeparator() +
",\"lname4\",40" + System.lineSeparator() +
"\"fname5\",\"lname5\",50" + System.lineSeparator();

assertEquals(expectedOutput, stringWriter.toString());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
import org.junit.Test;

import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Date;

import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -77,7 +75,7 @@ public void shouldNotEscapeNewlineChar(){
@Test
public void shouldNotEscapeNewline(){
String result = DataType.String.format("A" + System.lineSeparator() + "B");
assertEquals("\"A\nB\"", result);
assertEquals("\"A" + System.lineSeparator() + "B\"", result);
}

@Test
Expand All @@ -88,8 +86,10 @@ public void shouldEscapeNewlineCharIfEscapeNewlineSetToTrue(){

@Test
public void shouldEscapeNewlineIfEscapeNewlineSetToTrue(){
final String escapedLineSeparator = System.lineSeparator().replace("\r", "\\r").replace("\n", "\\n");

String result = DataType.String.format("A" + System.lineSeparator() + "B", true);
assertEquals("\"A\\nB\"", result);
assertEquals("\"A"+escapedLineSeparator+"B\"", result);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@

public class NeptuneSparqlClientTest {

private static final String escapedLineSeparator = System.lineSeparator().replace("\r", "\\r").replace("\n", "\\n");

private SPARQLRepository mockSPARQLRepository;
private SailRepository sailRepository;
private final String testDataNTriples = "<http://aws.amazon.com/neptune/csv2rdf/resource/0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://aws.amazon.com/neptune/csv2rdf/class/Version> .\n" +
"<http://aws.amazon.com/neptune/csv2rdf/resource/0> <http://aws.amazon.com/neptune/csv2rdf/datatypeProperty/type> \"version\" .\n" +
"<http://aws.amazon.com/neptune/csv2rdf/resource/0> <http://aws.amazon.com/neptune/csv2rdf/datatypeProperty/code> \"0.77\" .\n" +
"<http://aws.amazon.com/neptune/csv2rdf/resource/0> <http://aws.amazon.com/neptune/csv2rdf/datatypeProperty/desc> \"Version: 0.77 Generated: 2017-10-06 16:24:52 UTC\\nGraph created by Kelvin R. Lawrence\\nPlease let me know of any errors you find in the graph.\" .\n";
"<http://aws.amazon.com/neptune/csv2rdf/resource/0> <http://aws.amazon.com/neptune/csv2rdf/datatypeProperty/desc> \"Version: 0.77 Generated: 2017-10-06 16:24:52 UTC"+escapedLineSeparator+"Graph created by Kelvin R. Lawrence"+escapedLineSeparator+"Please let me know of any errors you find in the graph.\" .\n";

private OutputWriter writer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public void shouldGetDefaultCredsIfConfigIsNull() {
@Test
public void shouldAttemptToUseProvidedPath() {
Throwable t = assertThrows(IllegalStateException.class, () -> getProfileCredentialsProvider(
null, tempFolder.getRoot().getAbsolutePath()+"/non-existent-file").resolveCredentials());
null, tempFolder.getRoot().toPath().resolve("non-existent-file").toString()).resolveCredentials());
assertEquals("Profile file '"+
tempFolder.getRoot().getAbsolutePath()+"/non-existent-file' does not exist.", t.getMessage());
tempFolder.getRoot().toPath().resolve("non-existent-file").toAbsolutePath()+"' does not exist.", t.getMessage());
}

@Test
Expand Down
Loading