Search in sources :

Example 6 with NoAccessPredicate

use of uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate 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);
}
Also used : Context(uk.gov.gchq.gaffer.store.Context) NoAccessPredicate(uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate) FederatedStoreProperties(uk.gov.gchq.gaffer.federatedstore.FederatedStoreProperties) Schema(uk.gov.gchq.gaffer.store.schema.Schema) GraphConfig(uk.gov.gchq.gaffer.graph.GraphConfig) Graph(uk.gov.gchq.gaffer.graph.Graph) RemoveGraph(uk.gov.gchq.gaffer.federatedstore.operation.RemoveGraph) GraphSerialisable(uk.gov.gchq.gaffer.graph.GraphSerialisable) NoAccessPredicate(uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate) AccessPredicate(uk.gov.gchq.gaffer.access.predicate.AccessPredicate) RemoveGraph(uk.gov.gchq.gaffer.federatedstore.operation.RemoveGraph) FederatedStore(uk.gov.gchq.gaffer.federatedstore.FederatedStore) Test(org.junit.jupiter.api.Test)

Aggregations

NoAccessPredicate (uk.gov.gchq.gaffer.access.predicate.NoAccessPredicate)6 GraphConfig (uk.gov.gchq.gaffer.graph.GraphConfig)4 GraphSerialisable (uk.gov.gchq.gaffer.graph.GraphSerialisable)4 Context (uk.gov.gchq.gaffer.store.Context)4 Test (org.junit.jupiter.api.Test)3 UnrestrictedAccessPredicate (uk.gov.gchq.gaffer.access.predicate.UnrestrictedAccessPredicate)3 BeforeEach (org.junit.jupiter.api.BeforeEach)2 NamedOperationDetail (uk.gov.gchq.gaffer.named.operation.NamedOperationDetail)2 GetTraits (uk.gov.gchq.gaffer.store.operation.GetTraits)2 Schema (uk.gov.gchq.gaffer.store.schema.Schema)2 SchemaEdgeDefinition (uk.gov.gchq.gaffer.store.schema.SchemaEdgeDefinition)2 Before (org.junit.Before)1 AccessPredicate (uk.gov.gchq.gaffer.access.predicate.AccessPredicate)1 FederatedStore (uk.gov.gchq.gaffer.federatedstore.FederatedStore)1 FederatedStoreProperties (uk.gov.gchq.gaffer.federatedstore.FederatedStoreProperties)1 RemoveGraph (uk.gov.gchq.gaffer.federatedstore.operation.RemoveGraph)1 Graph (uk.gov.gchq.gaffer.graph.Graph)1 CacheOperationFailedException (uk.gov.gchq.gaffer.named.operation.cache.exception.CacheOperationFailedException)1 SchemaEntityDefinition (uk.gov.gchq.gaffer.store.schema.SchemaEntityDefinition)1