org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures Java Examples
The following examples show how to use
org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 6 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_STRING_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeString() throws Exception { final String id = "this-is-a-valid-id"; // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception assumeFalse(graph.features().vertex().willAllowId(id)); try { graph.addVertex(T.id, id); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_STRING_IDS)); } catch (Exception e) { validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
Example #2
Source File: VertexTest.java From tinkerpop with Apache License 2.0 | 6 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) public void shouldEvaluateEquivalentVertexHashCodeWithSuppliedIds() { final Vertex v = graph.addVertex(T.id, graphProvider.convertId("1", Vertex.class)); final Vertex u = graph.vertices(graphProvider.convertId("1", Vertex.class)).next(); assertEquals(v, u); final Set<Vertex> set = new HashSet<>(); set.add(v); set.add(v); set.add(u); set.add(u); set.add(graph.vertices(graphProvider.convertId("1", Vertex.class)).next()); set.add(graph.vertices(graphProvider.convertId("1", Vertex.class)).next()); assertEquals(1, set.size()); assertEquals(v.hashCode(), u.hashCode()); }
Example #3
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 6 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_STRING_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeString() throws Exception { final String id = "this-is-a-valid-id"; // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception assumeFalse(graph.features().edge().willAllowId(id)); try { final Vertex v = graph.addVertex(); v.addEdge("test", v, T.id, id); fail(String.format(INVALID_FEATURE_SPECIFICATION, EdgeFeatures.class.getSimpleName(), FEATURE_STRING_IDS)); } catch (Exception e) { validateException(Edge.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
Example #4
Source File: VertexTest.java From tinkerpop with Apache License 2.0 | 6 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_UPSERT, supported = false) public void shouldHaveExceptionConsistencyWhenAssigningSameIdOnEdge() { final Vertex v = graph.addVertex(); final Object o = graphProvider.convertId("1", Edge.class); v.addEdge("self", v, T.id, o, "weight", 1); try { v.addEdge("self", v, T.id, o, "weight", 1); fail("Assigning the same ID to an Element should throw an exception"); } catch (Exception ex) { validateException(Graph.Exceptions.edgeWithIdAlreadyExists(o), ex); } }
Example #5
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 6 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_NUMERIC_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeNumericInt() throws Exception { final int id = 123456; // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception assumeFalse(graph.features().edge().willAllowId(id)); try { final Vertex v = graph.addVertex(); v.addEdge("test", v, T.id, id); fail(String.format(INVALID_FEATURE_SPECIFICATION, EdgeFeatures.class.getSimpleName(), FEATURE_NUMERIC_IDS)); } catch (Exception e) { validateException(Edge.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
Example #6
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 6 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_NUMERIC_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeNumericLong() throws Exception { final long id = 123456l; // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception assumeFalse(graph.features().edge().willAllowId(id)); try { final Vertex v = graph.addVertex(); v.addEdge("test", v, T.id, id); fail(String.format(INVALID_FEATURE_SPECIFICATION, EdgeFeatures.class.getSimpleName(), FEATURE_NUMERIC_IDS)); } catch (Exception e) { validateException(Edge.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
Example #7
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 6 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_UUID_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeUuid() throws Exception { final UUID id = UUID.randomUUID(); // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception assumeFalse(graph.features().edge().willAllowId(id)); try { final Vertex v = graph.addVertex(); v.addEdge("test", v, T.id, id); fail(String.format(INVALID_FEATURE_SPECIFICATION, EdgeFeatures.class.getSimpleName(), FEATURE_UUID_IDS)); } catch (Exception e) { validateException(Edge.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
Example #8
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 6 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_ANY_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeAny() throws Exception { final Date id = new Date(); // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception assumeFalse(graph.features().edge().willAllowId(id)); try { final Vertex v = graph.addVertex(); v.addEdge("test", v, T.id, id); fail(String.format(INVALID_FEATURE_SPECIFICATION, EdgeFeatures.class.getSimpleName(), FEATURE_ANY_IDS)); } catch (Exception e) { validateException(Edge.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
Example #9
Source File: VertexTest.java From tinkerpop with Apache License 2.0 | 6 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES) @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ANY_IDS) public void shouldAddEdgeWithUserSuppliedAnyIdUsingAnyObject() { final UUID uuid = UUID.randomUUID(); // this is different from "FEATURE_CUSTOM_IDS" as TinkerGraph does not define a specific id class // (i.e. TinkerId) for the identifier. final CustomId customId = new CustomId("test", uuid); final Vertex v = graph.addVertex(); v.addEdge("self", v, T.id, customId); tryCommit(graph, graph -> { final Edge e = graph.edges(customId).next(); assertEquals(customId, e.id()); }); }
Example #10
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 6 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_ANY_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeAny() throws Exception { try { final Date id = new Date(); graph.addVertex(T.id, id); // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception if (!graph.features().vertex().willAllowId(id)) fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_ANY_IDS)); } catch (Exception e) { validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
Example #11
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 6 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_UUID_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeUuid() throws Exception { final UUID id = UUID.randomUUID(); // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception assumeFalse(graph.features().vertex().willAllowId(id)); try { graph.addVertex(T.id, id); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_UUID_IDS)); } catch (Exception e) { validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
Example #12
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 6 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_NUMERIC_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeNumericLong() throws Exception { final long id = 123456l; // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception assumeFalse(graph.features().vertex().willAllowId(id)); try { graph.addVertex(T.id, id); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_NUMERIC_IDS)); } catch (Exception e) { validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
Example #13
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 6 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_NUMERIC_IDS, supported = false) public void shouldSupportUserSuppliedIdsOfTypeNumericInt() throws Exception { final int id = 123456; // a graph can "allow" an id without internally supporting it natively and therefore doesn't need // to throw the exception assumeFalse(graph.features().vertex().willAllowId(id)); try { graph.addVertex(T.id, id); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_NUMERIC_IDS)); } catch (Exception e) { validateException(Vertex.Exceptions.userSuppliedIdsOfThisTypeNotSupported(), e); } }
Example #14
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_REMOVE_PROPERTY, supported = false) @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) public void shouldSupportRemovePropertyIfAPropertyCanBeRemoved() throws Exception { try { final Vertex v = graph.addVertex("name", "me"); v.property("name").remove(); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), VertexFeatures.FEATURE_REMOVE_PROPERTY)); } catch (Exception e) { validateException(Property.Exceptions.propertyRemovalNotSupported(), e); } }
Example #15
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = EdgeFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS, supported = false) @FeatureRequirement(featureClass = EdgeFeatures.class, feature = FEATURE_STRING_IDS, supported = false) public void shouldSupportStringIdsIfStringIdsAreGeneratedFromTheGraph() throws Exception { final Vertex v = graph.addVertex(); final Edge e = v.addEdge("knows", v); if (e.id() instanceof String) fail(String.format(INVALID_FEATURE_SPECIFICATION, EdgeFeatures.class.getSimpleName(), FEATURE_STRING_IDS)); }
Example #16
Source File: VertexTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES) @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS) @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS) public void shouldAddEdgeWithUserSuppliedNumericId() { final Vertex v = graph.addVertex(); v.addEdge("self", v, T.id, 1000L); tryCommit(graph, graph -> { final Edge e = graph.edges(1000L).next(); assertEquals(1000L, e.id()); }); }
Example #17
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = VertexPropertyFeatures.FEATURE_REMOVE_PROPERTY, supported = false) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_META_PROPERTIES) @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) public void shouldSupportRemovePropertyIfAPropertyCanBeRemoved() throws Exception { try { final Vertex v = graph.addVertex(); final VertexProperty p = v.property(VertexProperty.Cardinality.single, "name", "me", "test", "this"); p.property("test").remove(); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexPropertyFeatures.class.getSimpleName(), VertexPropertyFeatures.FEATURE_REMOVE_PROPERTY)); } catch (Exception ex) { validateException(Property.Exceptions.propertyRemovalNotSupported(), ex); } }
Example #18
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_PROPERTY) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_MULTI_PROPERTIES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_DUPLICATE_MULTI_PROPERTIES, supported = false) public void shouldSupportIdenticalMultiPropertyIfTheSameKeyCanBeAssignedSameValueMoreThanOnce() throws Exception { try { final Vertex v = graph.addVertex("name", "stephen", "name", "stephen"); if (2 == IteratorUtils.count(v.properties())) fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), VertexFeatures.FEATURE_DUPLICATE_MULTI_PROPERTIES)); } catch (Exception ex) { validateException(VertexProperty.Exceptions.identicalMultiPropertiesNotSupported(), ex); } }
Example #19
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_PROPERTY) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_MULTI_PROPERTIES, supported = false) public void shouldSupportMultiPropertyIfTheSameKeyCanBeAssignedMoreThanOnce() throws Exception { try { final Vertex v = graph.addVertex("name", "stephen", "name", "steve"); if (2 == IteratorUtils.count(v.properties())) fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), VertexFeatures.FEATURE_MULTI_PROPERTIES)); } catch (Exception ex) { validateException(VertexProperty.Exceptions.multiPropertiesNotSupported(), ex); } }
Example #20
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_PROPERTY) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_META_PROPERTIES, supported = false) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_META_PROPERTIES) public void shouldSupportMetaPropertyIfPropertiesCanBePutOnProperties() throws Exception { try { final Vertex v = graph.addVertex(); v.property(VertexProperty.Cardinality.single, "name", "stephen", "p", "on-property"); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), VertexFeatures.FEATURE_META_PROPERTIES)); } catch (Exception ex) { validateException(VertexProperty.Exceptions.metaPropertiesNotSupported(), ex); } }
Example #21
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_PROPERTY) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_META_PROPERTIES, supported = false) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_META_PROPERTIES) public void shouldSupportMetaPropertyIfPropertiesCanBePutOnPropertiesViaVertexProperty() throws Exception { try { final Vertex v = graph.addVertex("name", "stephen"); v.property("name").property("p", "on-property"); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), VertexFeatures.FEATURE_META_PROPERTIES)); } catch (Exception ex) { validateException(VertexProperty.Exceptions.metaPropertiesNotSupported(), ex); } }
Example #22
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_PROPERTY) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_META_PROPERTIES, supported = false) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_META_PROPERTIES) public void shouldSupportMetaPropertyIfPropertiesHaveAnIteratorViaVertexProperty() throws Exception { try { final Vertex v = graph.addVertex("name", "stephen"); v.property("name").properties(); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), VertexFeatures.FEATURE_META_PROPERTIES)); } catch (Exception ex) { validateException(VertexProperty.Exceptions.metaPropertiesNotSupported(), ex); } }
Example #23
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_PROPERTY) public void shouldEnableFeatureOnVertexIfNotEnabled() throws Exception { assumeThat(graph.features().supports(VertexPropertyFeatures.class, featureName), is(false)); try { graph.addVertex("aKey", value); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexPropertyFeatures.class.getSimpleName(), featureName)); } catch (Exception e) { validateException(Property.Exceptions.dataTypeOfPropertyValueNotSupported(value), e); } }
Example #24
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES, supported = false) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) public void shouldSupportAddEdgesIfEdgeCanBeAdded() throws Exception { try { final Vertex v = graph.addVertex(); v.addEdge("friend", v); fail(String.format(INVALID_FEATURE_SPECIFICATION, EdgeFeatures.class.getSimpleName(), EdgeFeatures.FEATURE_ADD_EDGES)); } catch (Exception e) { validateException(Vertex.Exceptions.edgeAdditionsNotSupported(), e); } }
Example #25
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS, supported = false) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_UUID_IDS, supported = false) public void shouldSupportUuidIdsIfUuidIdsAreGeneratedFromTheGraph() throws Exception { final Vertex v = graph.addVertex(); if (v.id() instanceof UUID) fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_UUID_IDS)); }
Example #26
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = EdgeFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS, supported = false) @FeatureRequirement(featureClass = EdgeFeatures.class, feature = FEATURE_NUMERIC_IDS, supported = false) public void shouldSupportNumericIdsIfNumericIdsAreGeneratedFromTheGraph() throws Exception { final Vertex v = graph.addVertex(); final Edge e = v.addEdge("knows", v); if (e.id() instanceof Number) fail(String.format(INVALID_FEATURE_SPECIFICATION, EdgeFeatures.class.getSimpleName(), FEATURE_NUMERIC_IDS)); }
Example #27
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_REMOVE_VERTICES, supported = false) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) public void shouldSupportRemoveVerticesIfAVertexCanBeRemoved() throws Exception { try { graph.addVertex().remove(); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), VertexFeatures.FEATURE_REMOVE_VERTICES)); } catch (Exception e) { validateException(Vertex.Exceptions.vertexRemovalNotSupported(), e); } }
Example #28
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS, supported = false) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_STRING_IDS, supported = false) public void shouldSupportStringIdsIfStringIdsAreGeneratedFromTheGraph() throws Exception { final Vertex v = graph.addVertex(); if (v.id() instanceof String) fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_STRING_IDS)); }
Example #29
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_ADD_PROPERTY, supported = false) public void shouldSupportAddVertexPropertyIfItCanBeAdded() throws Exception { try { final Vertex v = graph.addVertex(); v.property(VertexProperty.Cardinality.single, "should", "not-add-property"); fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), VertexFeatures.FEATURE_ADD_PROPERTY)); } catch (Exception e) { validateException(Element.Exceptions.propertyAdditionNotSupported(), e); } }
Example #30
Source File: FeatureSupportTest.java From tinkerpop with Apache License 2.0 | 5 votes |
@Test @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS, supported = false) @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_NUMERIC_IDS, supported = false) public void shouldSupportNumericIdsIfNumericIdsAreGeneratedFromTheGraph() throws Exception { final Vertex v = graph.addVertex(); if (v.id() instanceof Number) fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_NUMERIC_IDS)); }