Search in sources :

Example 1 with StubGraphChangedListener

use of com.tinkerpop.blueprints.util.wrappers.event.listener.StubGraphChangedListener in project blueprints by tinkerpop.

the class EventGraphTest method testMutateInListener.

public void testMutateInListener() {
    StubGraphChangedListener listener = new StubGraphChangedListener() {

        @Override
        public void vertexPropertyChanged(Vertex vertex, String key, Object oldValue, Object setValue) {
            if (!"setInListener".equals(key)) {
                vertex.setProperty("setInListener", 12345);
            }
            super.vertexPropertyChanged(vertex, key, oldValue, setValue);
        }
    };
    graph.addListener(listener);
    Vertex vertex = createVertex();
    vertex.setProperty("test", 123);
    assertEquals(12345, vertex.getProperty("setInListener"));
    assertEquals(2, listener.vertexPropertyChangedEventRecorded());
}
Also used : Vertex(com.tinkerpop.blueprints.Vertex) StubGraphChangedListener(com.tinkerpop.blueprints.util.wrappers.event.listener.StubGraphChangedListener)

Example 2 with StubGraphChangedListener

use of com.tinkerpop.blueprints.util.wrappers.event.listener.StubGraphChangedListener in project blueprints by tinkerpop.

the class EventTransactionalGraphTest method testMutateInListener.

public void testMutateInListener() {
    StubGraphChangedListener listener = new StubGraphChangedListener() {

        @Override
        public void vertexPropertyChanged(Vertex vertex, String key, Object oldValue, Object setValue) {
            if (!"setInListener".equals(key)) {
                vertex.setProperty("setInListener", 12345);
            }
            super.vertexPropertyChanged(vertex, key, oldValue, setValue);
        }
    };
    graph.addListener(listener);
    Vertex vertex = createVertex();
    vertex.setProperty("test", 123);
    graph.commit();
    assertEquals(12345, vertex.getProperty("setInListener"));
    assertEquals(2, listener.vertexPropertyChangedEventRecorded());
}
Also used : Vertex(com.tinkerpop.blueprints.Vertex) StubGraphChangedListener(com.tinkerpop.blueprints.util.wrappers.event.listener.StubGraphChangedListener)

Example 3 with StubGraphChangedListener

use of com.tinkerpop.blueprints.util.wrappers.event.listener.StubGraphChangedListener in project blueprints by tinkerpop.

the class EventTransactionalGraphTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    graphChangedListener = new StubGraphChangedListener();
    graph = new EventTransactionalGraph<TinkerTransactionalGraph>(TinkerTransactionalGraph.createTinkerGraph());
}
Also used : StubGraphChangedListener(com.tinkerpop.blueprints.util.wrappers.event.listener.StubGraphChangedListener)

Example 4 with StubGraphChangedListener

use of com.tinkerpop.blueprints.util.wrappers.event.listener.StubGraphChangedListener in project blueprints by tinkerpop.

the class EventGraphTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    graphChangedListener = new StubGraphChangedListener();
    graph = new EventGraph<TinkerGraph>(TinkerGraphFactory.createTinkerGraph());
}
Also used : TinkerGraph(com.tinkerpop.blueprints.impls.tg.TinkerGraph) StubGraphChangedListener(com.tinkerpop.blueprints.util.wrappers.event.listener.StubGraphChangedListener)

Aggregations

StubGraphChangedListener (com.tinkerpop.blueprints.util.wrappers.event.listener.StubGraphChangedListener)4 Vertex (com.tinkerpop.blueprints.Vertex)2 TinkerGraph (com.tinkerpop.blueprints.impls.tg.TinkerGraph)1