use of uk.gov.gchq.gaffer.serialisation.implementation.tostring.StringToStringSerialiser in project Gaffer by gchq.
the class SchemaTest method shouldThrowExceptionWhenMergeSchemasWithConflictingVertexSerialiser.
@Test
public void shouldThrowExceptionWhenMergeSchemasWithConflictingVertexSerialiser() {
// Given
final Serialiser vertexSerialiser1 = new StringSerialiser();
final Serialiser vertexSerialiser2 = new StringToStringSerialiser();
final Schema schema1 = new Schema.Builder().vertexSerialiser(vertexSerialiser1).build();
final Schema schema2 = new Schema.Builder().vertexSerialiser(vertexSerialiser2).build();
// When / Then
assertThatExceptionOfType(SchemaException.class).isThrownBy(() -> new Schema.Builder().merge(schema1).merge(schema2).build()).withMessageContaining("vertex serialiser");
}
use of uk.gov.gchq.gaffer.serialisation.implementation.tostring.StringToStringSerialiser in project Gaffer by gchq.
the class StoreTest method shouldFindInvalidSerialiser.
@Test
public void shouldFindInvalidSerialiser() throws Exception {
final Class<StringToStringSerialiser> invalidSerialiserClass = StringToStringSerialiser.class;
Schema invalidSchema = new Schema.Builder().edge(TestGroups.EDGE, new SchemaEdgeDefinition.Builder().source("string").destination("invalidString").directed("true").property(TestPropertyNames.PROP_1, "string").property(TestPropertyNames.PROP_2, "string").build()).type("string", new TypeDefinition.Builder().clazz(String.class).serialiser(new StringSerialiser()).build()).type("invalidString", new TypeDefinition.Builder().clazz(String.class).serialiser(invalidSerialiserClass.newInstance()).build()).type("true", Boolean.class).build();
final StoreProperties properties = mock(StoreProperties.class);
given(properties.getJobExecutorThreadCount()).willReturn(1);
final Class<ToBytesSerialiser> validSerialiserInterface = ToBytesSerialiser.class;
try {
new StoreImpl() {
@Override
protected Class<? extends Serialiser> getRequiredParentSerialiserClass() {
return validSerialiserInterface;
}
}.initialise("graphId", invalidSchema, properties);
fail("Should have thrown exception");
} catch (final SchemaException e) {
assertTrue(e.getMessage().contains(invalidSerialiserClass.getSimpleName()));
}
}
Aggregations