@Test public void saveCreatesANewVertexWithCorrectLabelAndProperties() { ReadableProperty readableProperty = new ReadableProperty(null, null) { @Override public String getTypeId() { return null; } @Override public String getUniqueTypeId() { return "type-id"; } }; Vertex result = readableProperty.save(graph, "client-prop-name"); assertThat(result, likeVertex() .withProperty(CLIENT_PROPERTY_NAME, "client-prop-name") .withProperty(PROPERTY_TYPE_NAME, "type-id") .withLabel(DATABASE_LABEL) ); }
public Vertex save(Graph graph, String clientPropertyName) { Vertex propertyVertex = graph.addVertex(DATABASE_LABEL); propertyVertex.property(CLIENT_PROPERTY_NAME, clientPropertyName); propertyVertex.property(PROPERTY_TYPE_NAME, getUniqueTypeId()); return propertyVertex; }
ReadableProperty { public Vertex save(Graph graph, String clientPropertyName) { Vertex propertyVertex = graph.addVertex(DATABASE_LABEL); propertyVertex.property(CLIENT_PROPERTY_NAME, clientPropertyName); propertyVertex.property(PROPERTY_TYPE_NAME, getUniqueTypeId()); return propertyVertex; } }
ReadableProperty { public Vertex save(Graph graph, String clientPropertyName) { Vertex propertyVertex = graph.addVertex(DATABASE_LABEL); propertyVertex.property(CLIENT_PROPERTY_NAME, clientPropertyName); propertyVertex.property(PROPERTY_TYPE_NAME, getUniqueTypeId()); return propertyVertex; } ReadableProperty(Supplier<GraphTraversal<?, Try<JsonNode>>> getterJson,
                          Supplier<GraphTraversal<?, Try<Object>>> getterRaw); }
ReadableProperty { public Vertex save(Graph graph, String clientPropertyName) { Vertex propertyVertex = graph.addVertex(DATABASE_LABEL); propertyVertex.property(CLIENT_PROPERTY_NAME, clientPropertyName); propertyVertex.property(PROPERTY_TYPE_NAME, getUniqueTypeId()); return propertyVertex; } ReadableProperty(Supplier<GraphTraversal<?, Try<JsonNode>>> getterJson,
                          Supplier<GraphTraversal<?, Try<Object>>> getterRaw); GraphTraversal<?, Try<JsonNode>> traversalJson(); GraphTraversal<?, Try<Object>> traversalRaw(); abstract String getTypeId(); abstract String getUniqueTypeId(); Vertex save(Graph graph, String clientPropertyName); static ReadableProperty load(Vertex propertyVertex, String prefix); }
ReadableProperty { public Vertex save(Graph graph, String clientPropertyName) { Vertex propertyVertex = graph.addVertex(DATABASE_LABEL); propertyVertex.property(CLIENT_PROPERTY_NAME, clientPropertyName); propertyVertex.property(PROPERTY_TYPE_NAME, getUniqueTypeId()); return propertyVertex; } ReadableProperty(Supplier<GraphTraversal<?, Try<JsonNode>>> getterJson,
                          Supplier<GraphTraversal<?, Try<Object>>> getterRaw); GraphTraversal<?, Try<JsonNode>> traversalJson(); GraphTraversal<?, Try<Object>> traversalRaw(); abstract String getTypeId(); abstract String getUniqueTypeId(); Vertex save(Graph graph, String clientPropertyName); static ReadableProperty load(Vertex propertyVertex, String prefix); static final String DATABASE_LABEL; static final String DISPLAY_NAME_PROPERTY_NAME; static final String CLIENT_PROPERTY_NAME; static final String PROPERTY_TYPE_NAME; static final String HAS_NEXT_PROPERTY_RELATION_NAME; }