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 d6dadcc
Showing 1 changed file with 10 additions and 9 deletions.
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 d6dadcc

Please sign in to comment.