Package com.tinkerpop.gremlin.structure

Examples of com.tinkerpop.gremlin.structure.VertexProperty$Iterators


    @Test
    @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
    public void shouldNotConstructNewWithSomethingAlreadyDetached() {
        final Vertex v = g.addVertex();
        final VertexProperty vp = v.property("test", "this");
        final DetachedVertexProperty dvp = DetachedVertexProperty.detach(vp);
        assertSame(dvp, DetachedVertexProperty.detach(dvp));
    }
View Full Code Here


    @Test
    @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
    public void shouldConstructDetachedPropertyWithPropertyFromVertex() {
        final Vertex v = g.addVertex();
        final VertexProperty vp = v.property("test", "this");
        final DetachedVertexProperty mp = DetachedVertexProperty.detach(vp);
        assertEquals("test", mp.key());
        assertEquals("this", mp.value());
        assertFalse(mp.isHidden());
        assertEquals(DetachedVertex.class, mp.element().getClass());
View Full Code Here

    @Test
    @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
    public void shouldConstructDetachedPropertyWithHiddenFromVertex() {
        final Vertex v = g.addVertex();
        final VertexProperty vp = v.property(Graph.Key.hide("test"), "this");
        final DetachedVertexProperty mp = DetachedVertexProperty.detach(vp);
        assertEquals("test", mp.key());
        assertEquals("this", mp.value());
        assertTrue(mp.isHidden());
        assertEquals(DetachedVertex.class, mp.element().getClass());
View Full Code Here

    @Test(expected = UnsupportedOperationException.class)
    @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
    public void shouldNotSupportRemove() {
        final Vertex v = g.addVertex();
        final VertexProperty vp = v.property("test", "this");
        DetachedVertexProperty.detach(vp).remove();
    }
View Full Code Here

    @Test
    @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
    public void shouldBeEqualsPropertiesAsIdIsTheSame() {
        final Vertex v = g.addVertex();
        final VertexProperty vp = v.property("test", "this");
        final DetachedVertexProperty mp1 = DetachedVertexProperty.detach(vp);
        final DetachedVertexProperty mp2 = DetachedVertexProperty.detach(vp);
        assertTrue(mp1.equals(mp2));
    }
View Full Code Here

    @Test
    @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
    public void shouldNotBeEqualsPropertiesAsIdIsDifferent() {
        final Vertex v = g.addVertex();
        final VertexProperty vp1 = v.property("test", "this");
        final DetachedVertexProperty mp1 = DetachedVertexProperty.detach(vp1);
        final VertexProperty vp2 = v.property("testing", "this");
        final DetachedVertexProperty mp2 = DetachedVertexProperty.detach(vp2);
        assertFalse(mp1.equals(mp2));
    }
View Full Code Here

                p.label().equals(VertexProperty.DEFAULT_LABEL)
                        && (p.id().equals(123) || p.id().equals(124))
                        && (p.value().equals("a") || p.value().equals("c"))));

        // there should be only one with properties on properties
        final VertexProperty propertyOnProperty = propertyX.stream().filter(p -> p.iterators().propertyIterator().hasNext()).findAny().get();
        assertEquals("a", propertyOnProperty.iterators().propertyIterator("propX1a").next().value());
        assertEquals(1, propertyOnProperty.iterators().propertyIterator("propX11").next().value());
        assertEquals(123.01d, propertyOnProperty.iterators().propertyIterator("same").next().value());
        assertEquals("something", propertyOnProperty.iterators().propertyIterator("extra").next().value());
        assertEquals(4, StreamFactory.stream(propertyOnProperty.iterators().propertyIterator()).count());
        assertEquals("ha", propertyOnProperty.iterators().hiddenPropertyIterator("propX1ha").next().value());
        assertEquals(11, propertyOnProperty.iterators().hiddenPropertyIterator("propX1h1").next().value());
        assertEquals(321.01d, propertyOnProperty.iterators().hiddenPropertyIterator("same").next().value());
        assertEquals(3, StreamFactory.stream(propertyOnProperty.iterators().hiddenPropertyIterator()).count());

        final List<VertexProperty> propertyY = StreamFactory.stream(dv.iterators().hiddenPropertyIterator("y")).collect(Collectors.toList());
        assertEquals(2, propertyY.size());
        assertTrue(propertyY.stream().allMatch(p ->
                p.label().equals(VertexProperty.DEFAULT_LABEL)
View Full Code Here

        @Test
        @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
        public void shouldReturnWrappedVertexPropertyToString() {
            final StrategyWrappedGraph swg = new StrategyWrappedGraph(g);
            final Vertex v1 = swg.addVertex(T.label, "Person", "age", "one");
            final VertexProperty age = v1.property("age");
            final Vertex originalVertex = ((StrategyWrappedVertex) v1).getBaseVertex();
            final VertexProperty originalVertexProperty = originalVertex.property("age");
            swg.getStrategy().setGraphStrategy(strategy);
            assertEquals(StringFactory.graphStrategyPropertyString(strategy, originalVertexProperty), age.toString());
        }
View Full Code Here

    @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
    public void shouldNotAllowVertexPropertySetProperty() {
        g.addVertex();
        assertException(g -> {
            final VertexProperty p = g.V().next().<String>property("test", "test");
            p.property("property", "on-a-property");
        });
    }
View Full Code Here

        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
        public void shouldWrap() {
            final StrategyWrappedGraph swg = new StrategyWrappedGraph(g);
            swg.strategy.setGraphStrategy(GraphStrategy.DefaultGraphStrategy.INSTANCE);
            final Vertex v = swg.addVertex();
            final VertexProperty vp = v.property("property", "on-property", "food", "taco", Graph.Key.hide("food"), "burger", "more", "properties", Graph.Key.hide("more"), "hidden");

            final AtomicBoolean atLeastOne = new AtomicBoolean(false);
            assertTrue(streamGetter.apply(swg, vp).allMatch(p -> {
                atLeastOne.set(true);
                return p instanceof StrategyWrappedProperty;
View Full Code Here

TOP

Related Classes of com.tinkerpop.gremlin.structure.VertexProperty$Iterators

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.