-
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
1 changed file
with
42 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,7 +220,7 @@ void testPOSIXExportRequestFileValidToken() { | |
Assertions.assertTrue(true); | ||
return; | ||
} | ||
export("EGAF00000000014", false); | ||
export("EGAF00000000014", false, validToken); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("test/my.sec.pem"), "passw0rd".toCharArray()); | ||
try (InputStream byteArrayInputStream = new FileInputStream("[email protected]/files/body.enc"); | ||
Crypt4GHInputStream crypt4GHInputStream = new Crypt4GHInputStream(byteArrayInputStream, privateKey)) { | ||
|
@@ -236,7 +236,7 @@ void testPOSIXExportRequestDatasetValidToken() { | |
Assertions.assertTrue(true); | ||
return; | ||
} | ||
export("EGAD00010000919", true); | ||
export("EGAD00010000919", true, validToken); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("test/my.sec.pem"), "passw0rd".toCharArray()); | ||
try (InputStream byteArrayInputStream = new FileInputStream("[email protected]/files/body.enc"); | ||
Crypt4GHInputStream crypt4GHInputStream = new Crypt4GHInputStream(byteArrayInputStream, privateKey)) { | ||
|
@@ -252,7 +252,7 @@ void testS3ExportRequestFileValidToken() { | |
Assertions.assertTrue(true); | ||
return; | ||
} | ||
export("EGAF00000000014", false); | ||
export("EGAF00000000014", false, validToken); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("test/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)) { | ||
|
@@ -277,6 +277,37 @@ void testS3ExportRequestDatasetValidToken() { | |
} | ||
} | ||
|
||
@SneakyThrows | ||
@Test | ||
void testS3ExportRequestReferenceValidToken() { | ||
if (System.getenv("OUTBOX_TYPE").equals("POSIX")) { | ||
Assertions.assertTrue(true); | ||
return; | ||
} | ||
export("GDI-NO-10001", true, validToken); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("test/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); | ||
Assertions.assertEquals("2aef808fb42fa7b1ba76cb16644773f9902a3fdc2569e8fdc049f38280c4577e", DigestUtils.sha256Hex(bytes)); | ||
} | ||
} | ||
|
||
@SneakyThrows | ||
@Test | ||
void testPOSIXExportRequestReferenceValidToken() { | ||
if (System.getenv("OUTBOX_TYPE").equals("S3")) { | ||
Assertions.assertTrue(true); | ||
return; | ||
} | ||
export("GDI-NO-10001", true, validToken); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("test/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); | ||
Assertions.assertEquals("2aef808fb42fa7b1ba76cb16644773f9902a3fdc2569e8fdc049f38280c4577e", DigestUtils.sha256Hex(bytes)); | ||
} | ||
} | ||
|
||
@SneakyThrows | ||
@Test | ||
|
@@ -344,14 +375,14 @@ void testS3ExportRequestDatasetValidVisaToken() { | |
|
||
@SneakyThrows | ||
@Test | ||
void testS3ExportRequestReferenceValidToken() { | ||
if (System.getenv("OUTBOX_TYPE").equals("POSIX")) { | ||
void testPOSIXExportRequestReferenceValidVisaToken() { | ||
if (System.getenv("OUTBOX_TYPE").equals("S3")) { | ||
Assertions.assertTrue(true); | ||
return; | ||
} | ||
export("GDI-NO-10001", true); | ||
export("GDI-NO-10001", true, validVisaToken); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("test/my.sec.pem"), "passw0rd".toCharArray()); | ||
try (InputStream byteArrayInputStream = getMinioClient().getObject(GetObjectArgs.builder().bucket("lega").object("[email protected]/body.enc").build()); | ||
try (InputStream byteArrayInputStream = new FileInputStream("[email protected]/files/body.enc"); | ||
Crypt4GHInputStream crypt4GHInputStream = new Crypt4GHInputStream(byteArrayInputStream, privateKey)) { | ||
byte[] bytes = IOUtils.toByteArray(crypt4GHInputStream); | ||
Assertions.assertEquals("2aef808fb42fa7b1ba76cb16644773f9902a3fdc2569e8fdc049f38280c4577e", DigestUtils.sha256Hex(bytes)); | ||
|
@@ -360,20 +391,19 @@ void testS3ExportRequestReferenceValidToken() { | |
|
||
@SneakyThrows | ||
@Test | ||
void testPOSIXExportRequestReferenceValidToken() { | ||
if (System.getenv("OUTBOX_TYPE").equals("S3")) { | ||
void testS3ExportRequestReferenceValidVisaToken() { | ||
if (System.getenv("OUTBOX_TYPE").equals("POSIX")) { | ||
Assertions.assertTrue(true); | ||
return; | ||
} | ||
export("GDI-NO-10001", true); | ||
export("GDI-NO-10001", true, validVisaToken); | ||
PrivateKey privateKey = KeyUtils.getInstance().readPrivateKey(new File("test/my.sec.pem"), "passw0rd".toCharArray()); | ||
try (InputStream byteArrayInputStream = new FileInputStream("[email protected]/files/body.enc"); | ||
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); | ||
Assertions.assertEquals("2aef808fb42fa7b1ba76cb16644773f9902a3fdc2569e8fdc049f38280c4577e", DigestUtils.sha256Hex(bytes)); | ||
} | ||
} | ||
|
||
@SneakyThrows | ||
void export(String id, boolean dataset, String token) { | ||
String mqConnectionString = "amqps://admin:guest@localhost:5671/sda"; | ||
|