use of uk.gov.gchq.gaffer.graph.GraphConfig in project Gaffer by gchq.
the class GetWalksIT method shouldGetPathsWithSimpleGraphHook_1.
@Test
public void shouldGetPathsWithSimpleGraphHook_1() throws Exception {
// Given
final AddOperationsToChain graphHook = new AddOperationsToChain();
graphHook.setEnd(Lists.newArrayList(new Limit.Builder<>().resultLimit(1).build()));
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(Lists.newArrayList(results)).hasSize(1);
}
use of uk.gov.gchq.gaffer.graph.GraphConfig in project Gaffer by gchq.
the class FederatedRemoveGraphHandlerTest method shouldNotRemoveGraphConfiguredWithNoAccessWritePredicate.
@Test
public void shouldNotRemoveGraphConfiguredWithNoAccessWritePredicate() throws Exception {
FederatedStore store = new FederatedStore();
final FederatedStoreProperties federatedStoreProperties = new FederatedStoreProperties();
federatedStoreProperties.setCacheProperties(CACHE_SERVICE_CLASS_STRING);
store.initialise(FEDERATEDSTORE_GRAPH_ID, null, federatedStoreProperties);
final AccessPredicate noAccessPredicate = new NoAccessPredicate();
store.addGraphs(testUser.getOpAuths(), "other", false, false, null, noAccessPredicate, new GraphSerialisable.Builder().config(new GraphConfig(EXPECTED_GRAPH_ID)).schema(new Schema.Builder().build()).properties(PROPERTIES).build());
assertEquals(1, store.getGraphs(testUser, null, ignore).size());
new FederatedRemoveGraphHandler().doOperation(new RemoveGraph.Builder().graphId(EXPECTED_GRAPH_ID).build(), new Context(testUser), store);
Collection<Graph> graphs = store.getGraphs(testUser, null, ignore);
assertThat(graphs).hasSize(1);
}
Aggregations