Search in sources :

Example 1 with JavaSerialiser

use of uk.gov.gchq.gaffer.serialisation.implementation.JavaSerialiser in project Gaffer by gchq.

the class BloomFilterIT method setup.

@Before
public void setup() {
    Schema schema = new Schema.Builder().type(TestTypes.PROP_INTEGER, Integer.class).vertexSerialiser(new JavaSerialiser()).edge(TestGroups.EDGE, new SchemaEdgeDefinition.Builder().property(AccumuloPropertyNames.INT, TestTypes.PROP_INTEGER).build()).entity(TestGroups.ENTITY, new SchemaEntityDefinition.Builder().property(AccumuloPropertyNames.INT, TestTypes.PROP_INTEGER).build()).build();
    byteEntityRangeFactory = new ByteEntityRangeFactory(schema);
    byteEntityElementConverter = new ByteEntityAccumuloElementConverter(schema);
    Gaffer1RangeFactory = new ClassicRangeFactory(schema);
    gafferV1ElementConverter = new ClassicAccumuloElementConverter(schema);
}
Also used : ByteEntityRangeFactory(uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityRangeFactory) ClassicRangeFactory(uk.gov.gchq.gaffer.accumulostore.key.core.impl.classic.ClassicRangeFactory) JavaSerialiser(uk.gov.gchq.gaffer.serialisation.implementation.JavaSerialiser) ClassicAccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.core.impl.classic.ClassicAccumuloElementConverter) Schema(uk.gov.gchq.gaffer.store.schema.Schema) SchemaEdgeDefinition(uk.gov.gchq.gaffer.store.schema.SchemaEdgeDefinition) ByteEntityAccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter) Before(org.junit.Before)

Example 2 with JavaSerialiser

use of uk.gov.gchq.gaffer.serialisation.implementation.JavaSerialiser in project Gaffer by gchq.

the class ByteEntityBloomElementFunctorTest method setup.

@Before
public void setup() {
    schema = new Schema.Builder().vertexSerialiser(new JavaSerialiser()).edge(TestGroups.EDGE).entity(TestGroups.ENTITY).build();
    elementConverter = new ByteEntityAccumuloElementConverter(schema);
}
Also used : JavaSerialiser(uk.gov.gchq.gaffer.serialisation.implementation.JavaSerialiser) Schema(uk.gov.gchq.gaffer.store.schema.Schema) ByteEntityAccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter) Before(org.junit.Before)

Example 3 with JavaSerialiser

use of uk.gov.gchq.gaffer.serialisation.implementation.JavaSerialiser in project Gaffer by gchq.

the class Gaffer1BloomElementFunctorTest method setup.

@Before
public void setup() {
    schema = new Schema.Builder().vertexSerialiser(new JavaSerialiser()).edge(TestGroups.EDGE).entity(TestGroups.ENTITY).build();
    elementConverter = new ClassicAccumuloElementConverter(schema);
}
Also used : JavaSerialiser(uk.gov.gchq.gaffer.serialisation.implementation.JavaSerialiser) ClassicAccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.core.impl.classic.ClassicAccumuloElementConverter) Schema(uk.gov.gchq.gaffer.store.schema.Schema) Before(org.junit.Before)

Example 4 with JavaSerialiser

use of uk.gov.gchq.gaffer.serialisation.implementation.JavaSerialiser in project Gaffer by gchq.

the class SchemaOptimiserTest method shouldAddDefaultSerialisers.

@Test
public void shouldAddDefaultSerialisers() {
    //Given
    final SerialisationFactory serialisationFactory = mock(SerialisationFactory.class);
    final SchemaOptimiser optimiser = new SchemaOptimiser(serialisationFactory);
    final boolean isOrdered = true;
    final StringSerialiser stringSerialiser = mock(StringSerialiser.class);
    final StringSerialiser intSerialiser = mock(StringSerialiser.class);
    final JavaSerialiser javaSerialiser = mock(JavaSerialiser.class);
    given(serialisationFactory.getSerialiser(String.class, true)).willReturn(stringSerialiser);
    given(serialisationFactory.getSerialiser(Integer.class, false)).willReturn(intSerialiser);
    given(serialisationFactory.getSerialiser(Serializable.class, true)).willReturn(javaSerialiser);
    given(javaSerialiser.canHandle(Mockito.any(Class.class))).willReturn(true);
    schema = new Schema.Builder().merge(schema).type("obj", Serializable.class).entity(TestGroups.ENTITY_2, new SchemaEntityDefinition.Builder().vertex("obj").build()).build();
    // When
    final Schema optimisedSchema = optimiser.optimise(schema, isOrdered);
    // Then
    assertSame(stringSerialiser, optimisedSchema.getType("string").getSerialiser());
    assertSame(intSerialiser, optimisedSchema.getType("int").getSerialiser());
    assertSame(javaSerialiser, optimisedSchema.getVertexSerialiser());
    verify(serialisationFactory, never()).getSerialiser(String.class, false);
    verify(serialisationFactory, never()).getSerialiser(Serializable.class, false);
}
Also used : StringSerialiser(uk.gov.gchq.gaffer.serialisation.implementation.StringSerialiser) Serializable(java.io.Serializable) JavaSerialiser(uk.gov.gchq.gaffer.serialisation.implementation.JavaSerialiser) SerialisationFactory(uk.gov.gchq.gaffer.serialisation.implementation.SerialisationFactory) Test(org.junit.Test)

Example 5 with JavaSerialiser

use of uk.gov.gchq.gaffer.serialisation.implementation.JavaSerialiser in project Gaffer by gchq.

the class SchemaTest method testCorrectSerialiserRetrievableFromConfig.

@Test
public void testCorrectSerialiserRetrievableFromConfig() throws NotSerializableException {
    Schema store = new Schema.Builder().type(TestTypes.PROP_STRING, new TypeDefinition.Builder().clazz(String.class).serialiser(new JavaSerialiser()).build()).edge(TestGroups.EDGE, new SchemaEdgeDefinition.Builder().property(TestPropertyNames.PROP_1, TestTypes.PROP_STRING).build()).build();
    assertEquals(JavaSerialiser.class, store.getElement(TestGroups.EDGE).getPropertyTypeDef(TestPropertyNames.PROP_1).getSerialiser().getClass());
}
Also used : JavaSerialiser(uk.gov.gchq.gaffer.serialisation.implementation.JavaSerialiser) Test(org.junit.Test)

Aggregations

JavaSerialiser (uk.gov.gchq.gaffer.serialisation.implementation.JavaSerialiser)7 Before (org.junit.Before)4 Schema (uk.gov.gchq.gaffer.store.schema.Schema)4 ByteEntityAccumuloElementConverter (uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter)3 ClassicAccumuloElementConverter (uk.gov.gchq.gaffer.accumulostore.key.core.impl.classic.ClassicAccumuloElementConverter)3 Test (org.junit.Test)2 ByteEntityRangeFactory (uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityRangeFactory)2 ClassicRangeFactory (uk.gov.gchq.gaffer.accumulostore.key.core.impl.classic.ClassicRangeFactory)2 SchemaEdgeDefinition (uk.gov.gchq.gaffer.store.schema.SchemaEdgeDefinition)2 Serializable (java.io.Serializable)1 HashSet (java.util.HashSet)1 Serialisation (uk.gov.gchq.gaffer.serialisation.Serialisation)1 SerialisationFactory (uk.gov.gchq.gaffer.serialisation.implementation.SerialisationFactory)1 StringSerialiser (uk.gov.gchq.gaffer.serialisation.implementation.StringSerialiser)1