@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); } }
@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); } }
@Override public <V> DuctileVertexProperty<V> property(Cardinality cardinality, String key, V value, Object... keyValues) { if (cardinality != VertexProperty.Cardinality.single) { throw VertexProperty.Exceptions.multiPropertiesNotSupported(); } if (keyValues.length > 0) { throw VertexProperty.Exceptions.metaPropertiesNotSupported(); } ElementHelper.validateProperty(key, value); if (ElementHelper.getIdValue(keyValues).isPresent()) throw Vertex.Exceptions.userSuppliedIdsNotSupported(); graph().tx().readWrite(); try { if (value == null) { getBaseVertex().removeProperty(key); } else { getBaseVertex().setProperty(key, value); } return new DuctileVertexProperty<V>(this, key, value); } catch (final IllegalArgumentException iae) { throw Property.Exceptions.dataTypeOfPropertyValueNotSupported(value); } }
@Override public <U> Property<U> property(final String key, final U value) { throw VertexProperty.Exceptions.multiPropertiesNotSupported(); }
@Override public <U> Iterator<Property<U>> properties(String... propertyKeys) { throw VertexProperty.Exceptions.multiPropertiesNotSupported(); }
@Override public <U> Iterator<Property<U>> properties(String... propertyKeys) { throw VertexProperty.Exceptions.multiPropertiesNotSupported(); }
@Override public <U> Property<U> property(final String key, final U value) { throw VertexProperty.Exceptions.multiPropertiesNotSupported(); }
@Override public <V> VertexProperty<V> setVertexProperty(final Neo4jVertex vertex, final VertexProperty.Cardinality cardinality, final String key, final V value, final Object... keyValues) { if (cardinality != VertexProperty.Cardinality.single) throw VertexProperty.Exceptions.multiPropertiesNotSupported(); if (keyValues.length > 0) throw VertexProperty.Exceptions.metaPropertiesNotSupported(); try { vertex.getBaseVertex().setProperty(key, value); return new Neo4jVertexProperty<>(vertex, key, value); } catch (final IllegalArgumentException iae) { throw Property.Exceptions.dataTypeOfPropertyValueNotSupported(value, iae); } }
@Override public <V> VertexProperty<V> property(final VertexProperty.Cardinality cardinality, final String key, final V value, final Object... keyValues) { if (cardinality != VertexProperty.Cardinality.single) throw VertexProperty.Exceptions.multiPropertiesNotSupported(); if (keyValues.length > 0) throw VertexProperty.Exceptions.metaPropertiesNotSupported(); setProperty(key, value); return new HBaseVertexProperty<>(graph, this, key, value); }
@Override public <V> VertexProperty<V> setVertexProperty(final Neo4jVertex vertex, final VertexProperty.Cardinality cardinality, final String key, final V value, final Object... keyValues) { if (cardinality != VertexProperty.Cardinality.single) throw VertexProperty.Exceptions.multiPropertiesNotSupported(); if (keyValues.length > 0) throw VertexProperty.Exceptions.metaPropertiesNotSupported(); try { vertex.getBaseVertex().setProperty(key, value); return new Neo4jVertexProperty<>(vertex, key, value); } catch (final IllegalArgumentException iae) { throw Property.Exceptions.dataTypeOfPropertyValueNotSupported(value, iae); } }