-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
11 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,8 +181,8 @@ void testStreamingValidTokenValidFileRangePlain() { | |
@SneakyThrows | ||
@Test | ||
void testStreamingValidTokenValidFileFullEncrypted() { | ||
String publicKey = Files.readString(new File("test/crypt4gh/crypt4gh.pub.pem").toPath()); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("test/crypt4gh/crypt4gh.sec.pem"), "password".toCharArray()); | ||
String publicKey = Files.readString(new File("./test/crypt4gh/crypt4gh.pub.pem").toPath()); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("./test/crypt4gh/crypt4gh.sec.pem"), "password".toCharArray()); | ||
HttpResponse<byte[]> response = Unirest.get("http://localhost:8080/files/EGAF00000000014?destinationFormat=crypt4gh").header(HttpHeaders.AUTHORIZATION, "Bearer " + validToken).header("Public-Key", publicKey).asBytes(); | ||
int status = response.getStatus(); | ||
Assertions.assertEquals(HttpStatus.OK.value(), status); | ||
|
@@ -196,8 +196,8 @@ void testStreamingValidTokenValidFileFullEncrypted() { | |
@SneakyThrows | ||
@Test | ||
void testStreamingValidTokenValidFileRangeEncrypted() { | ||
String publicKey = Files.readString(new File("test/crypt4gh/crypt4gh.pub.pem").toPath()); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("test/crypt4gh/crypt4gh.sec.pem"), "password".toCharArray()); | ||
String publicKey = Files.readString(new File("./test/crypt4gh/crypt4gh.pub.pem").toPath()); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("./test/crypt4gh/crypt4gh.sec.pem"), "password".toCharArray()); | ||
HttpResponse<byte[]> response = Unirest.get("http://localhost:8080/files/EGAF00000000014?startCoordinate=100&endCoordinate=200&destinationFormat=crypt4gh").header(HttpHeaders.AUTHORIZATION, "Bearer " + validToken).header("Public-Key", publicKey).asBytes(); | ||
int status = response.getStatus(); | ||
Assertions.assertEquals(HttpStatus.OK.value(), status); | ||
|
@@ -216,7 +216,7 @@ void testPOSIXExportRequestFileValidToken() { | |
return; | ||
} | ||
export("EGAF00000000014", false); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("test/crypt4gh/my.sec.pem"), "passw0rd".toCharArray()); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("./test/crypt4gh/my.sec.pem"), "passw0rd".toCharArray()); | ||
try (InputStream byteArrayInputStream = new FileInputStream("[email protected]/files/body.enc"); | ||
Crypt4GHInputStream crypt4GHInputStream = new Crypt4GHInputStream(byteArrayInputStream, privateKey)) { | ||
byte[] bytes = IOUtils.toByteArray(crypt4GHInputStream); | ||
|
@@ -232,7 +232,7 @@ void testPOSIXExportRequestDatasetValidToken() { | |
return; | ||
} | ||
export("EGAD00010000919", true); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("test/crypt4gh/my.sec.pem"), "passw0rd".toCharArray()); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("./test/crypt4gh/my.sec.pem"), "passw0rd".toCharArray()); | ||
try (InputStream byteArrayInputStream = new FileInputStream("[email protected]/files/body.enc"); | ||
Crypt4GHInputStream crypt4GHInputStream = new Crypt4GHInputStream(byteArrayInputStream, privateKey)) { | ||
byte[] bytes = IOUtils.toByteArray(crypt4GHInputStream); | ||
|
@@ -248,7 +248,7 @@ void testS3ExportRequestFileValidToken() { | |
return; | ||
} | ||
export("EGAF00000000014", false); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("test/crypt4gh/my.sec.pem"), "passw0rd".toCharArray()); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("./test/crypt4gh/my.sec.pem"), "passw0rd".toCharArray()); | ||
try (InputStream byteArrayInputStream = getMinioClient().getObject(GetObjectArgs.builder().bucket("lega").object("[email protected]/body.enc").build()); | ||
Crypt4GHInputStream crypt4GHInputStream = new Crypt4GHInputStream(byteArrayInputStream, privateKey)) { | ||
byte[] bytes = IOUtils.toByteArray(crypt4GHInputStream); | ||
|
@@ -264,7 +264,7 @@ void testS3ExportRequestDatasetValidToken() { | |
return; | ||
} | ||
export("EGAD00010000919", true); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("test/crypt4ghmy.sec.pem"), "passw0rd".toCharArray()); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("./test/crypt4gh/my.sec.pem"), "passw0rd".toCharArray()); | ||
try (InputStream byteArrayInputStream = getMinioClient().getObject(GetObjectArgs.builder().bucket("lega").object("[email protected]/body.enc").build()); | ||
Crypt4GHInputStream crypt4GHInputStream = new Crypt4GHInputStream(byteArrayInputStream, privateKey)) { | ||
byte[] bytes = IOUtils.toByteArray(crypt4GHInputStream); | ||
|
@@ -295,7 +295,7 @@ void export(String id, boolean dataset) { | |
validToken, | ||
dataset ? "datasetId" : "fileId", | ||
id, | ||
FileUtils.readFileToString(new File("test/crypt4gh/my.pub.pem"), Charset.defaultCharset())); | ||
FileUtils.readFileToString(new File("./test/crypt4gh/my.pub.pem"), Charset.defaultCharset())); | ||
channel.basicPublish("", | ||
"exportRequests", | ||
properties, | ||
|