use of uk.gov.gchq.gaffer.store.StoreProperties in project Gaffer by gchq.
the class ExportToOtherGraphHandlerTest method shouldValidateParentSchemaIdCanBeUsedWhenGraphIdAlreadyExistsAndIsSame.
@Test
public void shouldValidateParentSchemaIdCanBeUsedWhenGraphIdAlreadyExistsAndIsSame() {
// Given
graphLibrary.add(GRAPH_ID + 1, SCHEMA_ID, new Schema.Builder().build(), STORE_PROPS_ID, new StoreProperties());
graphLibrary.addSchema(SCHEMA_ID, new Schema.Builder().build());
final ExportToOtherGraph export = new ExportToOtherGraph.Builder().graphId(GRAPH_ID + 1).parentSchemaIds(SCHEMA_ID).build();
// When / Then`
validate(export);
}
use of uk.gov.gchq.gaffer.store.StoreProperties in project Gaffer by gchq.
the class ExportToOtherGraphHandlerTest method shouldValidateSchemaCannotBeUsedWhenGraphIdAlreadyExists.
@Test
public void shouldValidateSchemaCannotBeUsedWhenGraphIdAlreadyExists() {
// Given
graphLibrary.add(GRAPH_ID + 1, SCHEMA_ID, new Schema.Builder().edge("testEdge", new SchemaEdgeDefinition()).build(), STORE_PROPS_ID, new StoreProperties());
final ExportToOtherGraph export = new ExportToOtherGraph.Builder().graphId(GRAPH_ID + 1).schema(new Schema()).build();
// When / Then
final String expectedMessage = "Validation errors: \n" + String.format(GRAPH_S_ALREADY_EXISTS_SO_YOU_CANNOT_USE_A_DIFFERENT_S_DO_NOT_SET_THE_S_FIELD, "graphId1", SCHEMA_STRING, SCHEMA_STRING);
assertThatIllegalArgumentException().isThrownBy(() -> createGraph(export)).withMessage(expectedMessage);
}
use of uk.gov.gchq.gaffer.store.StoreProperties in project Gaffer by gchq.
the class ExportToOtherGraphHandlerTest method shouldValidatePropsCanBeUsedWhenGraphIdAlreadyExistsAndIsSame.
@Test
public void shouldValidatePropsCanBeUsedWhenGraphIdAlreadyExistsAndIsSame() {
// Given
StoreProperties storeProperties1 = new StoreProperties();
storeProperties1.set("testKey", "testValue");
graphLibrary.add(GRAPH_ID + 1, SCHEMA_ID, new Schema.Builder().build(), STORE_PROPS_ID, storeProperties1);
final ExportToOtherGraph export = new ExportToOtherGraph.Builder().graphId(GRAPH_ID + 1).storeProperties(storeProperties1).build();
// When / Then
validate(export);
}
use of uk.gov.gchq.gaffer.store.StoreProperties in project Gaffer by gchq.
the class ExportToOtherGraphHandlerTest method shouldThrowExceptionSchemaIdCannotBeFound.
@Test
public void shouldThrowExceptionSchemaIdCannotBeFound() {
// Given
final ExportToOtherGraph export = new ExportToOtherGraph.Builder().graphId(GRAPH_ID + 1).parentSchemaIds(SCHEMA_ID).storeProperties(new StoreProperties()).build();
// When / Then
final String expectedMessage = getErrorMessage(SCHEMA_COULD_NOT_BE_FOUND_IN_THE_GRAPH_LIBRARY_WITH_ID_S, "[schemaId]");
assertThatIllegalArgumentException().isThrownBy(() -> createGraph(export)).withMessage(expectedMessage);
}
use of uk.gov.gchq.gaffer.store.StoreProperties in project Gaffer by gchq.
the class ExportToOtherGraphHandlerTest method shouldValidatePropsCannotBeUsedWhenGraphIdAlreadyExists.
@Test
public void shouldValidatePropsCannotBeUsedWhenGraphIdAlreadyExists() {
// Given
StoreProperties storeProperties1 = new StoreProperties();
storeProperties1.set("testKey", "testValue");
graphLibrary.add(GRAPH_ID + 1, SCHEMA_ID, new Schema.Builder().build(), STORE_PROPS_ID, storeProperties1);
final ExportToOtherGraph export = new ExportToOtherGraph.Builder().graphId(GRAPH_ID + 1).storeProperties(new StoreProperties()).build();
// When / Then
final String expectedMessage = "Validation errors: \n" + String.format(GRAPH_S_ALREADY_EXISTS_SO_YOU_CANNOT_USE_A_DIFFERENT_S_DO_NOT_SET_THE_S_FIELD, "graphId1", STORE_PROPERTIES_STRING, STORE_PROPERTIES_STRING);
assertThatIllegalArgumentException().isThrownBy(() -> createGraph(export)).withMessage(expectedMessage);
}
Aggregations