Skip to content

Commit

Permalink
Set manifest after topaz is started.
Browse files Browse the repository at this point in the history
  • Loading branch information
BogdanIrimie committed Nov 23, 2023
1 parent 2602cc9 commit 5a0053b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 37 deletions.
56 changes: 28 additions & 28 deletions src/test/java/DirectoryClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,20 @@ void testGetRelations() {
assertEquals(10, getRelationsResponse.getResultsList().size());
}

// @Test
// @Tag("IntegrationTest")
// void testCheckRelationAdmin() {
// // Arrange & Act
// CheckRelationResponse checkRelationResponse = directoryClient.checkRelation(
// "group",
// "admin",
// "member",
// "user",
// "[email protected]");
//
// // Assert
// assertTrue(checkRelationResponse.getCheck());
// }
@Test
@Tag("IntegrationTest")
void testCheckRelationAdmin() {
// Arrange & Act
CheckRelationResponse checkRelationResponse = directoryClient.checkRelation(
"group",
"admin",
"member",
"user",
"[email protected]");

// Assert
assertTrue(checkRelationResponse.getCheck());
}

@Test
@Tag("IntegrationTest")
Expand All @@ -173,20 +173,20 @@ void testCheckRelationViewer() {
assertFalse(checkRelationResponse.getCheck());
}

// @Test
// @Tag("IntegrationTest")
// void testCheckAdmin() {
// // Arrange & Act
// CheckResponse checkResponse = directoryClient.check(
// "group",
// "admin",
// "member",
// "user",
// "[email protected]");
//
// // Assert
// assertTrue(checkResponse.getCheck());
// }
@Test
@Tag("IntegrationTest")
void testCheckAdmin() {
// Arrange & Act
CheckResponse checkResponse = directoryClient.check(
"group",
"admin",
"member",
"user",
"[email protected]");

// Assert
assertTrue(checkResponse.getCheck());
}

@Test
@Tag("IntegrationTest")
Expand Down
19 changes: 10 additions & 9 deletions src/test/java/utils/Topaz.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public void run() throws IOException, InterruptedException, URISyntaxException {
backupCfg();
configure();
start();
setManifest();
loadData();
}

Expand All @@ -46,8 +47,17 @@ public void stop() throws IOException, InterruptedException {
process.waitFor();
restoreDb();
restoreCfg();
// delete temp directory used to store downloaded files
deleteDirectory(new File("temp"));
}
public void setManifest() throws IOException, URISyntaxException, InterruptedException {
downloadFile("https://raw.githubusercontent.com/aserto-dev/topaz/main/assets/citadel/manifest.yaml", "temp/manifest.yaml");

ProcessBuilder pb = new ProcessBuilder("topaz","manifest", "set", "-i", "temp/manifest.yaml");
pb.inheritIO();
Process process = pb.start();
process.waitFor();
}

private void loadData() throws IOException, URISyntaxException, InterruptedException {
downloadFile("https://raw.githubusercontent.com/aserto-dev/topaz/main/assets/citadel/citadel_objects.json", "temp/citadel_objects.json");
Expand All @@ -59,15 +69,6 @@ private void loadData() throws IOException, URISyntaxException, InterruptedExcep
process.waitFor();
}

private void removeTempFile(String... files) {
for (String file: files) {
File tempFile = new File(file);
if(tempFile.exists()) {
tempFile.delete();
}
}
}

private void deleteDirectory(File directoryToBeDeleted) {
File[] allContents = directoryToBeDeleted.listFiles();
if (allContents != null) {
Expand Down

0 comments on commit 5a0053b

Please sign in to comment.