AccumuloStore extends Store { public void preInitialise(final String graphId, final Schema schema, final StoreProperties properties) throws StoreException { setProperties(properties); final String deprecatedTableName = getProperties().getTable(); if (null == graphId && null != deprecatedTableName) { super.initialise(deprecatedTableName, schema, getProperties()); } else if (null != deprecatedTableName && !deprecatedTableName.equals(graphId)) { throw new IllegalArgumentException( "The table in store.properties should no longer be used. " + "Please use a graphId instead or for now just set the graphId to be the same value as the store.properties table."); } else { super.initialise(graphId, schema, getProperties()); } final String keyPackageClass = getProperties().getKeyPackageClass(); try { this.keyPackage = Class.forName(keyPackageClass).asSubclass(AccumuloKeyPackage.class).newInstance(); } catch (final InstantiationException | IllegalAccessException | ClassNotFoundException e) { throw new StoreException("Unable to construct an instance of key package: " + keyPackageClass, e); } this.keyPackage.setSchema(getSchema()); }  @Override void initialise(final String graphId, final Schema schema, final StoreProperties properties); void preInitialise(final String graphId, final Schema schema, final StoreProperties properties); Connector getConnection(); String getTableName(); void updateConfiguration(final Configuration conf, final GraphFilters graphFilters, final User user); @Override void validateSchemas(); @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST_OF_RETURN_VALUE", justification = "The properties should always be AccumuloProperties") @Override AccumuloProperties getProperties(); @Override Set<StoreTrait> getTraits(); void addElements(final Iterable<? extends Element> elements); AccumuloKeyPackage getKeyPackage(); List<String> getTabletServers(); static final Set<StoreTrait> TRAITS; static final String FAILED_TO_CREATE_AN_ACCUMULO_FROM_ELEMENT_OF_TYPE_WHEN_TRYING_TO_INSERT_ELEMENTS; }
@Test public void shouldAllowRangeScanOperationsWhenVertexSerialiserDoesPreserveObjectOrdering() throws StoreException { final AccumuloStore store = new AccumuloStore(); final Serialiser serialiser = new StringSerialiser(); store.preInitialise(BYTE_ENTITY_GRAPH, new Schema.Builder() .vertexSerialiser(serialiser) .build(), PROPERTIES); final boolean isGetElementsInRangesSupported = store.isSupported(GetElementsInRanges.class); final boolean isSummariseGroupOverRangesSupported = store.isSupported(SummariseGroupOverRanges.class); assertTrue(isGetElementsInRangesSupported); assertTrue(isSummariseGroupOverRangesSupported); }
@Test public void shouldNotAllowRangeScanOperationsWhenVertexSerialiserDoesNotPreserveObjectOrdering() throws StoreException { final AccumuloStore store = new AccumuloStore(); final Serialiser serialiser = new CompactRawLongSerialiser(); store.preInitialise( BYTE_ENTITY_GRAPH, new Schema.Builder() .vertexSerialiser(serialiser) .build(), PROPERTIES); final boolean isGetElementsInRangesSupported = store.isSupported(GetElementsInRanges.class); final boolean isSummariseGroupOverRangesSupported = store.isSupported(SummariseGroupOverRanges.class); assertFalse(isGetElementsInRangesSupported); assertFalse(isSummariseGroupOverRangesSupported); }
@Test public void shouldPassSchemaValidationWhenTimestampPropertyDoesNotHaveAnAggregator() throws Exception { final AccumuloStore store = new AccumuloStore(); final Schema schema = new Schema.Builder() .entity(TestGroups.ENTITY, new SchemaEntityDefinition.Builder() .vertex(TestTypes.ID_STRING) .property(TestPropertyNames.TIMESTAMP, TestTypes.TIMESTAMP) .aggregate(false) .build()) .edge(TestGroups.EDGE, new SchemaEdgeDefinition.Builder() .source(TestTypes.ID_STRING) .destination(TestTypes.ID_STRING) .directed(TestTypes.DIRECTED_EITHER) .property(TestPropertyNames.TIMESTAMP, TestTypes.TIMESTAMP_2) .aggregate(false) .build()) .type(TestTypes.ID_STRING, String.class) .type(TestTypes.DIRECTED_EITHER, new TypeDefinition.Builder() .clazz(Boolean.class) .build()) .type(TestTypes.TIMESTAMP, new TypeDefinition.Builder() .clazz(Long.class) .build()) .type(TestTypes.TIMESTAMP_2, new TypeDefinition.Builder() .clazz(Long.class) .build()) .timestampProperty(TestPropertyNames.TIMESTAMP) .build(); store.preInitialise("graphId", schema, PROPERTIES); }