use of uk.gov.gchq.gaffer.graph.GraphConfig in project Gaffer by gchq.
the class ProxyStoreIT method setUpGraph.
@Before
public void setUpGraph() {
delegateRestApiGraph = new Graph.Builder().storeProperties(new MapStoreProperties()).config(new GraphConfig("myGraph")).addSchema(Schema.fromJson(StreamUtil.openStream(getClass(), "/schema/schema.json"))).build();
when(graphFactory.getGraph()).thenReturn(delegateRestApiGraph);
}
use of uk.gov.gchq.gaffer.graph.GraphConfig in project Gaffer by gchq.
the class OperationControllerTest method setUpController.
@BeforeEach
public void setUpController() {
store = mock(Store.class);
graphFactory = mock(GraphFactory.class);
userFactory = mock(UserFactory.class);
examplesFactory = mock(ExamplesFactory.class);
operationController = new OperationController(graphFactory, userFactory, examplesFactory);
when(store.getSchema()).thenReturn(new Schema());
when(store.getProperties()).thenReturn(new StoreProperties());
Graph graph = new Graph.Builder().config(new GraphConfig("id")).store(store).addSchema(new Schema()).build();
when(graphFactory.getGraph()).thenReturn(graph);
}
use of uk.gov.gchq.gaffer.graph.GraphConfig in project Gaffer by gchq.
the class GraphConfigurationControllerTest method shouldGetStoreTraits.
@Test
public void shouldGetStoreTraits() {
// Given
when(graphFactory.getGraph()).thenReturn(new Graph.Builder().config(new GraphConfig("id")).addSchema(new Schema()).storeProperties(// Will be a map store
new MapStoreProperties()).build());
GraphConfigurationController controller = new GraphConfigurationController(graphFactory);
// When
final Set<StoreTrait> traits = controller.getStoreTraits();
// Then
assertEquals(MapStore.TRAITS, traits);
}
use of uk.gov.gchq.gaffer.graph.GraphConfig in project Gaffer by gchq.
the class GraphConfigurationControllerTest method shouldReturnDescription.
@Test
public void shouldReturnDescription() {
// 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 description = controller.getDescription();
// Then
assertEquals("test graph", description);
}
use of uk.gov.gchq.gaffer.graph.GraphConfig in project Gaffer by gchq.
the class GetWalksIT method shouldGetPathsWithSimpleGraphHook_2.
@Test
public void shouldGetPathsWithSimpleGraphHook_2() throws Exception {
// Given
final AddOperationsToChain graphHook = new AddOperationsToChain();
final java.util.Map<String, List<Operation>> graphHookConfig = new HashMap<>();
graphHookConfig.put(GetElements.class.getName(), Lists.newArrayList(new Limit.Builder<>().resultLimit(1).build()));
graphHook.setAfter(graphHookConfig);
final GraphConfig config = new GraphConfig.Builder().addHook(graphHook).graphId("integrationTest").build();
createGraph(config);
addDefaultElements();
final GetElements operation = new GetElements.Builder().directedType(DirectedType.DIRECTED).view(new View.Builder().edge(TestGroups.EDGE, new ViewElementDefinition.Builder().properties(TestPropertyNames.COUNT).build()).build()).inOutType(SeededGraphFilters.IncludeIncomingOutgoingType.OUTGOING).build();
final GetWalks op = new GetWalks.Builder().input(seedA).operations(operation, operation).build();
// When
final Iterable<Walk> results = graph.execute(op, getUser());
// Then
assertThat(getPaths(results)).isEqualTo("ABC");
}
Aggregations