private void validateSameAsFromCache(final Graph newGraph, final String graphId) { final Graph fromCache = federatedStoreCache.getGraphSerialisableFromCache(graphId).getGraph(graphLibrary); if (!newGraph.getStoreProperties().getProperties().equals(fromCache.getStoreProperties().getProperties())) { throw new RuntimeException(String.format(ERROR_ADDING_GRAPH_TO_CACHE, GraphConfigEnum.PROPERTIES.toString(), graphId)); } else { if (!JsonUtil.equals(newGraph.getSchema().toJson(false), fromCache.getSchema().toJson(false))) { throw new RuntimeException(String.format(ERROR_ADDING_GRAPH_TO_CACHE, GraphConfigEnum.SCHEMA.toString(), graphId)); } else { if (!newGraph.getGraphId().equals(fromCache.getGraphId())) { throw new RuntimeException(String.format(ERROR_ADDING_GRAPH_TO_CACHE, "GraphId", graphId)); } } } }
@Override public Schema run() throws OperationException { /// [graph] create a graph using our schema and store properties // --------------------------------------------------------- final Graph graph = new Graph.Builder() .graphId("graph1") .addSchemas(StreamUtil.openStreams(getClass(), "SchemaExample/schema")) .storeProperties(StreamUtil.openStream(getClass(), "mockaccumulostore.properties")) .build(); // --------------------------------------------------------- final Schema schema = graph.getSchema(); try { log("SCHEMA", new String(schema.toJson(true), CommonConstants.UTF_8)); } catch (final UnsupportedEncodingException e) { throw new RuntimeException(e); } return schema; }
public Schema run() throws OperationException { // [graph] create a graph using our schema and store properties // --------------------------------------------------------- final Graph graph = new Graph.Builder() .addSchemas(getSchemas()) .storeProperties(getStoreProperties()) .build(); // --------------------------------------------------------- final Schema schema = graph.getSchema(); try { log("SCHEMA", new String(schema.toJson(true), CommonConstants.UTF_8)); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } return schema; } }