Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into gh-2435-FederatedS…
Browse files Browse the repository at this point in the history
…tore-changeGraphId-table-name-fix
  • Loading branch information
GCHQDev404 committed Jun 4, 2021
2 parents c103f82 + c9a925e commit a57a2a1
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -72,7 +72,7 @@
<datasketches.version>0.12.0</datasketches.version>
<commons-codec.version>1.6</commons-codec.version>
<commons-collections.version>3.2.2</commons-collections.version>
<commons-io.version>2.4</commons-io.version>
<commons-io.version>2.7</commons-io.version>
<commons-lang3.version>3.3.2</commons-lang3.version>
<commons-logging.version>1.1.3</commons-logging.version>
<commons-math.version>2.1</commons-math.version>
Expand Down
Expand Up @@ -61,6 +61,11 @@ public String getDescription() {
return graphFactory.getGraph().getDescription();
}

@Override
public String getGraphId() {
return graphFactory.getGraph().getGraphId();
}

@Override
public Set<Class> getFilterFunctions() {
return ReflectionUtil.getSubTypes(Predicate.class);
Expand Down
Expand Up @@ -54,6 +54,17 @@ public interface IGraphConfigurationController {
)
String getDescription();

@RequestMapping(
path = "/graphId",
method = GET,
produces = TEXT_PLAIN_VALUE
)
@ApiOperation(
value = "Gets the graph Id",
response = String.class
)
String getGraphId();

@RequestMapping(
path = "/filterFunctions",
method = GET,
Expand Down
Expand Up @@ -88,6 +88,25 @@ public void shouldReturnDescription() {
assertEquals("test graph", description);
}

@Test
public void shouldReturnGraphId() {
// Given
when(graphFactory.getGraph()).thenReturn(new Graph.Builder()
.config(new GraphConfig("id"))
.addSchema(new Schema())
.storeProperties(new MapStoreProperties())
.description("test graph")
.build());

// When
GraphConfigurationController controller = new GraphConfigurationController(graphFactory);

final String graphId = controller.getGraphId();

// Then
assertEquals("id", graphId);
}

@Test
public void shouldGetFilterFunctions() {
// Given
Expand Down
Expand Up @@ -117,6 +117,28 @@ public void shouldReturn200WhenReturningDescriptionIfUnset() {
assertEquals(null, response.getBody());
}

@Test
public void shouldReturn200WhenReturningGraphId() {
// Given
Graph emptyGraph = new Graph.Builder()
.config(new GraphConfig.Builder()
.graphId("id")
.description("test description")
.build())
.storeProperties(new MapStoreProperties())
.addSchema(new Schema())
.build();

when(graphFactory.getGraph()).thenReturn(emptyGraph);

// When
ResponseEntity<String> response = get("/graph/config/graphId", String.class);

// Then
checkResponse(response, 200);
assertEquals("id", response.getBody());
}

@Test
public void shouldReturn200WithListOfAllFilterFunctions() {
// Given
Expand Down

0 comments on commit a57a2a1

Please sign in to comment.