Skip to content

Commit

Permalink
#10: Remove exportOntologies (/ontologies endpoint) from DomainModelC…
Browse files Browse the repository at this point in the history
…ontroller, and corresponding unit test. TODO: remove "download ontologies.json" link from UI that calls this.
  • Loading branch information
kenmeacham committed Apr 19, 2023
1 parent 6d1fecc commit 9e34d61
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,15 +365,6 @@ public ResponseEntity<?> export(@PathVariable String graphName) throws Unexpecte
return ResponseEntity.status(HttpStatus.OK).headers(headers).contentType(MediaType.TEXT_PLAIN).body(resource);
}

@RequestMapping(value = "/ontologies", method = RequestMethod.GET)
public ResponseEntity<?> exportOntologies() throws UnexpectedException {

logger.info("Called REST method to GET serialised ontologies.json");
File f = new File(this.getClass().getResource("/static/data/ontologies.json").getPath());

return returnFile(Paths.get(f.getAbsolutePath()), f.getName());
}

private ResponseEntity<?> returnFile(Path p, String filename) {

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,27 +610,4 @@ public void testExportInvalidModel() {
assertThat().statusCode(HttpStatus.SC_NOT_FOUND);
}

/**
* Testing exporting ontologies.json
* Asserts OK 200 status
* Asserts domain-network, domain-network-testing ontologies returned only
* test is dependent on static/data/ontologies.json
*/
@Test
public void testExportOntologies() {
String[] domainModels = {
"domain-network.nq"
};

given().
filter(adminSession).
when().
get("/domains/ontologies").
then().
assertThat().statusCode(HttpStatus.SC_OK).
and().
parser("text/plain", Parser.JSON).
and().
assertThat().body("ontology", contains(domainModels));
}
}

0 comments on commit 9e34d61

Please sign in to comment.