use of uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary in project Gaffer by gchq.
the class GraphTest method shouldBuildGraphFromConfigAndSetIdsToGraphsWhenGraphSchemaAndStorePropertiesIdsAreNull.
@Test
public void shouldBuildGraphFromConfigAndSetIdsToGraphsWhenGraphSchemaAndStorePropertiesIdsAreNull() {
// Given
final StoreProperties libraryStoreProperties = new StoreProperties();
libraryStoreProperties.setStoreClass(TestStoreImpl.class.getName());
final StoreProperties graphStoreProperties = new StoreProperties();
graphStoreProperties.setStoreClass(TestStoreImpl.class.getName());
final Schema librarySchema = new Schema.Builder().build();
final Schema graphSchema = new Schema.Builder().build();
final String graphId1 = "graphId1";
final HashMapGraphLibrary library = new HashMapGraphLibrary();
library.addSchema(SCHEMA_ID_1, librarySchema);
library.addProperties(STORE_PROPERTIES_ID_1, libraryStoreProperties);
// When
final GraphConfig config = new GraphConfig.Builder().graphId(graphId1).library(library).build();
final Graph graph1 = new Graph.Builder().config(config).addToLibrary(true).parentStorePropertiesId("storePropertiesId1").storeProperties(graphStoreProperties).addParentSchemaIds(SCHEMA_ID_1).addSchemas(graphSchema).build();
// Then
assertEquals(graphId1, graph1.getGraphId());
JsonAssert.assertEquals(library.getSchema(SCHEMA_ID_1).toJson(false), librarySchema.toJson(false));
// Check that the schemaId = schemaId1 as both the supplied schema id is null
// Check that the storePropsId = storePropertiesId1 as the supplied storeProps id is null
assertThat(graphId1).isEqualTo(library.getIds(graphId1).getFirst()).isEqualTo(library.getIds(graphId1).getSecond());
}
use of uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary in project Gaffer by gchq.
the class SchemaTest method shouldAddMergedSchemaToLibrary.
@Test
public void shouldAddMergedSchemaToLibrary() {
// Given
final HashMapGraphLibrary graphLibrary = new HashMapGraphLibrary();
final Schema schema1ToMerge = new Schema.Builder().build();
final Schema schema2ToMerge = new Schema.Builder().build();
final Schema schema = new Schema.Builder().merge(schema1ToMerge).merge(schema2ToMerge).build();
// When
graphLibrary.addSchema("TEST_SCHEMA_ID_merged", schema);
// Then - no exceptions
}
use of uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary in project Gaffer by gchq.
the class AddStorePropertiesToLibraryHandlerTest method shouldSupportAddToGraphLibrary.
@Test
public void shouldSupportAddToGraphLibrary() throws Exception {
HashMapGraphLibrary library = new HashMapGraphLibrary();
store.setGraphLibrary(library);
store.initialise(TEST_STORE_ID, new Schema(), new StoreProperties());
assertTrue(store.isSupported(AddSchemaToLibrary.class));
}
use of uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary in project Gaffer by gchq.
the class AddSchemaToLibraryHandlerTest method shouldSupportAddToGraphLibrary.
@Test
public void shouldSupportAddToGraphLibrary() throws Exception {
// given
HashMapGraphLibrary library = new HashMapGraphLibrary();
store.setGraphLibrary(library);
// when
store.initialise(TEST_STORE_ID, new Schema(), new StoreProperties());
// then
assertTrue(store.isSupported(AddSchemaToLibrary.class));
}
use of uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary in project Gaffer by gchq.
the class FederatedStoreGraphVisibilityTest method setUp.
@BeforeEach
public void setUp() throws Exception {
HashMapGraphLibrary.clear();
CacheServiceLoader.shutdown();
fedProperties = new FederatedStoreProperties();
fedProperties.setCacheProperties(CACHE_SERVICE_CLASS_STRING);
addingUser = testUser();
nonAddingUser = blankUser();
authNonAddingUser = authUser();
library = new HashMapGraphLibrary();
}
Aggregations