Search in sources :

Example 16 with StringConcat

use of uk.gov.gchq.koryphe.impl.binaryoperator.StringConcat in project Gaffer by gchq.

the class TableUtilsTest method shouldFailTableValidationWhenTableDoesntHaveCoprocessor.

@Test
public void shouldFailTableValidationWhenTableDoesntHaveCoprocessor() throws Exception {
    // Given
    final SingleUseMiniHBaseStore store = new SingleUseMiniHBaseStore();
    final Schema schema = new Schema.Builder().type(TestTypes.ID_STRING, new TypeDefinition.Builder().aggregateFunction(new StringConcat()).clazz(String.class).build()).type(TestTypes.DIRECTED_TRUE, Boolean.class).edge(TestGroups.EDGE, new SchemaEdgeDefinition.Builder().source(TestTypes.ID_STRING).destination(TestTypes.ID_STRING).directed(TestTypes.DIRECTED_TRUE).build()).build();
    final HBaseProperties props = HBaseProperties.loadStoreProperties(StreamUtil.storeProps(TableUtilsTest.class));
    store.initialise(GRAPH_ID, schema, props);
    // Remove coprocessor
    final TableName tableName = store.getTableName();
    try (final Admin admin = store.getConnection().getAdmin()) {
        final HTableDescriptor descriptor = admin.getTableDescriptor(tableName);
        descriptor.removeCoprocessor(GafferCoprocessor.class.getName());
        admin.modifyTable(tableName, descriptor);
    } catch (final StoreException | IOException e) {
        throw new RuntimeException(e);
    }
    // When / Then
    assertThatExceptionOfType(StoreException.class).isThrownBy(() -> TableUtils.ensureTableExists(store)).extracting("message").isNotNull();
}
Also used : StringConcat(uk.gov.gchq.koryphe.impl.binaryoperator.StringConcat) Schema(uk.gov.gchq.gaffer.store.schema.Schema) SingleUseMiniHBaseStore(uk.gov.gchq.gaffer.hbasestore.SingleUseMiniHBaseStore) IOException(java.io.IOException) Admin(org.apache.hadoop.hbase.client.Admin) TypeDefinition(uk.gov.gchq.gaffer.store.schema.TypeDefinition) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor) StoreException(uk.gov.gchq.gaffer.store.StoreException) TableName(org.apache.hadoop.hbase.TableName) GafferCoprocessor(uk.gov.gchq.gaffer.hbasestore.coprocessor.GafferCoprocessor) HBaseProperties(uk.gov.gchq.gaffer.hbasestore.HBaseProperties) Test(org.junit.jupiter.api.Test)

Aggregations

StringConcat (uk.gov.gchq.koryphe.impl.binaryoperator.StringConcat)16 Test (org.junit.jupiter.api.Test)11 Schema (uk.gov.gchq.gaffer.store.schema.Schema)10 TypeDefinition (uk.gov.gchq.gaffer.store.schema.TypeDefinition)6 StoreException (uk.gov.gchq.gaffer.store.StoreException)4 AccumuloStore (uk.gov.gchq.gaffer.accumulostore.AccumuloStore)3 MiniAccumuloStore (uk.gov.gchq.gaffer.accumulostore.MiniAccumuloStore)3 SingleUseMiniAccumuloStore (uk.gov.gchq.gaffer.accumulostore.SingleUseMiniAccumuloStore)3 ElementAggregator (uk.gov.gchq.gaffer.data.element.function.ElementAggregator)3 SchemaEntityDefinition (uk.gov.gchq.gaffer.store.schema.SchemaEntityDefinition)3 ValidationResult (uk.gov.gchq.koryphe.ValidationResult)3 Exists (uk.gov.gchq.koryphe.impl.predicate.Exists)3 BeforeEach (org.junit.jupiter.api.BeforeEach)2 AccumuloRuntimeException (uk.gov.gchq.gaffer.accumulostore.key.AccumuloRuntimeException)2 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)2 ExampleAggregateFunction (uk.gov.gchq.gaffer.function.ExampleAggregateFunction)2 ExampleTuple2BinaryOperator (uk.gov.gchq.gaffer.function.ExampleTuple2BinaryOperator)2 HBaseProperties (uk.gov.gchq.gaffer.hbasestore.HBaseProperties)2 SingleUseMiniHBaseStore (uk.gov.gchq.gaffer.hbasestore.SingleUseMiniHBaseStore)2 StringSerialiser (uk.gov.gchq.gaffer.serialisation.implementation.StringSerialiser)2