Search in sources :

Example 76 with StoreProperties

use of uk.gov.gchq.gaffer.store.StoreProperties in project Gaffer by gchq.

the class AbstractGraphLibraryTest method shouldThrowExceptionWhenNewStorePropertiesAreAddedWithSamePropertiesIdAndDifferentProperties.

@Test
public void shouldThrowExceptionWhenNewStorePropertiesAreAddedWithSamePropertiesIdAndDifferentProperties() {
    // Given
    final StoreProperties tempStoreProperties = storeProperties.clone();
    tempStoreProperties.set("randomKey", "randomValue");
    // When
    graphLibrary.addProperties(TEST_PROPERTIES_ID, storeProperties);
    // Then
    assertThatExceptionOfType(OverwritingException.class).isThrownBy(() -> graphLibrary.addProperties(TEST_PROPERTIES_ID, tempStoreProperties)).withMessageContaining("already exists with a different store properties");
}
Also used : StoreProperties(uk.gov.gchq.gaffer.store.StoreProperties) Test(org.junit.jupiter.api.Test)

Example 77 with StoreProperties

use of uk.gov.gchq.gaffer.store.StoreProperties in project Gaffer by gchq.

the class AbstractGraphLibraryTest method shouldUpdateStoreProperties.

@Test
public void shouldUpdateStoreProperties() {
    // Given
    graphLibrary.addOrUpdateProperties(TEST_PROPERTIES_ID, storeProperties);
    StoreProperties tempStoreProperties = storeProperties.clone();
    tempStoreProperties.set("testKey", "testValue");
    // Then
    assertEquals(storeProperties.getProperties(), graphLibrary.getProperties(TEST_PROPERTIES_ID).getProperties());
    // When
    graphLibrary.addOrUpdateProperties(TEST_PROPERTIES_ID, tempStoreProperties);
    // Then
    assertEquals(tempStoreProperties.getProperties(), graphLibrary.getProperties(TEST_PROPERTIES_ID).getProperties());
}
Also used : StoreProperties(uk.gov.gchq.gaffer.store.StoreProperties) Test(org.junit.jupiter.api.Test)

Example 78 with StoreProperties

use of uk.gov.gchq.gaffer.store.StoreProperties in project Gaffer by gchq.

the class AddStorePropertiesToLibraryTest method setUp.

@BeforeAll
public static void setUp() throws Exception {
    storeProperties = new StoreProperties();
    op = new Builder().storeProperties(storeProperties).parentPropertiesId(VALUE_1).id(TEST_ID).build();
}
Also used : Builder(uk.gov.gchq.gaffer.store.operation.add.AddStorePropertiesToLibrary.Builder) StoreProperties(uk.gov.gchq.gaffer.store.StoreProperties) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 79 with StoreProperties

use of uk.gov.gchq.gaffer.store.StoreProperties in project Gaffer by gchq.

the class AddStorePropertiesToLibraryHandlerTest method shouldAddSchemaWithGraphLibrary.

@Test
public void shouldAddSchemaWithGraphLibrary() throws Exception {
    HashMapGraphLibrary library = new HashMapGraphLibrary();
    store.setGraphLibrary(library);
    store.initialise(TEST_STORE_ID, new Schema(), new StoreProperties());
    store.execute(new Builder().storeProperties(props).id(TEST_PROPS_ID).build(), new Context(StoreUser.blankUser()));
    StoreProperties actualProps = library.getProperties(TEST_PROPS_ID);
    assertEquals(props.getProperties(), actualProps.getProperties());
}
Also used : Context(uk.gov.gchq.gaffer.store.Context) HashMapGraphLibrary(uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary) Schema(uk.gov.gchq.gaffer.store.schema.Schema) Builder(uk.gov.gchq.gaffer.store.operation.add.AddStorePropertiesToLibrary.Builder) StoreProperties(uk.gov.gchq.gaffer.store.StoreProperties) Test(org.junit.jupiter.api.Test)

Example 80 with StoreProperties

use of uk.gov.gchq.gaffer.store.StoreProperties in project Gaffer by gchq.

the class AddStorePropertiesToLibraryHandlerTest method shouldNotSupportAddToGraphLibraryII.

@Test
public void shouldNotSupportAddToGraphLibraryII() throws Exception {
    store.setGraphLibrary(new NoGraphLibrary());
    store.initialise(TEST_STORE_ID, new Schema(), new StoreProperties());
    assertFalse(store.isSupported(AddSchemaToLibrary.class));
}
Also used : NoGraphLibrary(uk.gov.gchq.gaffer.store.library.NoGraphLibrary) Schema(uk.gov.gchq.gaffer.store.schema.Schema) AddSchemaToLibrary(uk.gov.gchq.gaffer.store.operation.add.AddSchemaToLibrary) StoreProperties(uk.gov.gchq.gaffer.store.StoreProperties) Test(org.junit.jupiter.api.Test)

Aggregations

StoreProperties (uk.gov.gchq.gaffer.store.StoreProperties)170 Test (org.junit.jupiter.api.Test)136 Schema (uk.gov.gchq.gaffer.store.schema.Schema)102 Store (uk.gov.gchq.gaffer.store.Store)74 Context (uk.gov.gchq.gaffer.store.Context)47 TestStore (uk.gov.gchq.gaffer.integration.store.TestStore)42 OperationChain (uk.gov.gchq.gaffer.operation.OperationChain)39 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)26 Graph (uk.gov.gchq.gaffer.graph.Graph)26 Operation (uk.gov.gchq.gaffer.operation.Operation)24 GetElements (uk.gov.gchq.gaffer.operation.impl.get.GetElements)21 OperationView (uk.gov.gchq.gaffer.operation.graph.OperationView)20 User (uk.gov.gchq.gaffer.user.User)18 NamedOperation (uk.gov.gchq.gaffer.named.operation.NamedOperation)17 BeforeEach (org.junit.jupiter.api.BeforeEach)16 GraphHook (uk.gov.gchq.gaffer.graph.hook.GraphHook)16 SchemaEdgeDefinition (uk.gov.gchq.gaffer.store.schema.SchemaEdgeDefinition)16 ExportToOtherGraph (uk.gov.gchq.gaffer.operation.export.graph.ExportToOtherGraph)14 HashSet (java.util.HashSet)13 FunctionAuthoriser (uk.gov.gchq.gaffer.graph.hook.FunctionAuthoriser)13