@Override public boolean equals(Object obj) { if (!(obj instanceof AddPropertyEvent)) { return false; } AddPropertyEvent other = (AddPropertyEvent) obj; return getElement().equals(other.getElement()) && getProperty().equals(other.getProperty()); } }
new AddPropertyEvent(graph, saveVertices.get(0), saveVertices.get(0).getProperty("k1", "name")), new AddExtendedDataEvent(graph, saveVertices.get(0), "table1", "row1", "col1", null, "extended", VISIBILITY_A), new AddVertexEvent(graph, (Vertex) saveVertices.get(1)), new AddPropertyEvent(graph, saveVertices.get(1), saveVertices.get(1).getProperty("k1", "name")), new AddExtendedDataEvent(graph, saveVertices.get(1), "table1", "row1", "col1", null, "extended", VISIBILITY_A) );
@Override public int hashCode() { return getProperty().hashCode(); }
@Override public String toString() { return "AddPropertyEvent{element=" + getElement() + ", property=" + property + '}'; }
new AddPropertyEvent(graph, saveVertices.get(0), saveVertices.get(0).getProperty("k1", "name")), new AddExtendedDataEvent(graph, saveVertices.get(0), "table1", "row1", "col1", null, "extended", VISIBILITY_A), new AddVertexEvent(graph, (Vertex) saveVertices.get(1)), new AddPropertyEvent(graph, saveVertices.get(1), saveVertices.get(1).getProperty("k1", "name")), new AddExtendedDataEvent(graph, saveVertices.get(1), "table1", "row1", "col1", null, "extended", VISIBILITY_A) );
@Override public int hashCode() { return getProperty().hashCode(); }
@Override public String toString() { return "AddPropertyEvent{element=" + getElement() + ", property=" + property + '}'; }
new AddPropertyEvent(graph, vertexAdded, vertexAdded.getProperty("prop1")), new AddPropertyEvent(graph, vertexAdded, vertexAdded.getProperty("prop2")) ); clearGraphEvents(); assertEquals("value1Mutation", v.getPropertyValues("prop1Mutation").iterator().next()); assertEvents( new AddPropertyEvent(graph, vertexAdded, vertexAdded.getProperty("prop1Mutation")) );
@Override public boolean equals(Object obj) { if (!(obj instanceof AddPropertyEvent)) { return false; } AddPropertyEvent other = (AddPropertyEvent) obj; return getElement().equals(other.getElement()) && getProperty().equals(other.getProperty()); } }
new AddPropertyEvent(graph, vertexAdded, vertexAdded.getProperty("prop1")), new AddPropertyEvent(graph, vertexAdded, vertexAdded.getProperty("prop2")) ); clearGraphEvents(); assertEquals("value1Mutation", v.getPropertyValues("prop1Mutation").iterator().next()); assertEvents( new AddPropertyEvent(graph, vertexAdded, vertexAdded.getProperty("prop1Mutation")) );
@Test public void testAddEdgeWithProperties() { Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A); Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_A); Edge addedEdge = graph.prepareEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A) .setProperty("propA", "valueA", VISIBILITY_A) .setProperty("propB", "valueB", VISIBILITY_B) .save(AUTHORIZATIONS_A_AND_B); graph.flush(); Edge e = graph.getEdge("e1", AUTHORIZATIONS_A); Assert.assertEquals(1, count(e.getProperties())); assertEquals("valueA", e.getPropertyValues("propA").iterator().next()); Assert.assertEquals(0, count(e.getPropertyValues("propB"))); e = graph.getEdge("e1", AUTHORIZATIONS_A_AND_B); Assert.assertEquals(2, count(e.getProperties())); assertEquals("valueA", e.getPropertyValues("propA").iterator().next()); assertEquals("valueB", e.getPropertyValues("propB").iterator().next()); assertEquals("valueA", e.getPropertyValue("propA")); assertEquals("valueB", e.getPropertyValue("propB")); graph.flush(); assertEvents( new AddVertexEvent(graph, v1), new AddVertexEvent(graph, v2), new AddEdgeEvent(graph, addedEdge), new AddPropertyEvent(graph, addedEdge, addedEdge.getProperty("propA")), new AddPropertyEvent(graph, addedEdge, addedEdge.getProperty("propB")) ); }
@Test public void testAddEdgeWithProperties() { Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A); Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_A); Edge addedEdge = graph.prepareEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A) .setProperty("propA", "valueA", VISIBILITY_A) .setProperty("propB", "valueB", VISIBILITY_B) .save(AUTHORIZATIONS_A_AND_B); graph.flush(); Edge e = graph.getEdge("e1", AUTHORIZATIONS_A); Assert.assertEquals(1, count(e.getProperties())); assertEquals("valueA", e.getPropertyValues("propA").iterator().next()); Assert.assertEquals(0, count(e.getPropertyValues("propB"))); e = graph.getEdge("e1", AUTHORIZATIONS_A_AND_B); Assert.assertEquals(2, count(e.getProperties())); assertEquals("valueA", e.getPropertyValues("propA").iterator().next()); assertEquals("valueB", e.getPropertyValues("propB").iterator().next()); assertEquals("valueA", e.getPropertyValue("propA")); assertEquals("valueB", e.getPropertyValue("propB")); graph.flush(); assertEvents( new AddVertexEvent(graph, v1), new AddVertexEvent(graph, v2), new AddEdgeEvent(graph, addedEdge), new AddPropertyEvent(graph, addedEdge, addedEdge.getProperty("propA")), new AddPropertyEvent(graph, addedEdge, addedEdge.getProperty("propB")) ); }
fireGraphEvent(new AddPropertyEvent(this, element, property));
@Test public void testDeleteVertexWithProperties() { Vertex v1 = graph.prepareVertex("v1", VISIBILITY_A) .setProperty("prop1", "value1", VISIBILITY_B) .save(AUTHORIZATIONS_A_AND_B); graph.flush(); Property prop1 = v1.getProperty("prop1"); Assert.assertEquals(1, count(graph.getVertices(AUTHORIZATIONS_A))); graph.deleteVertex("v1", AUTHORIZATIONS_A); graph.flush(); Assert.assertEquals(0, count(graph.getVertices(AUTHORIZATIONS_A_AND_B))); assertEvents( new AddVertexEvent(graph, v1), new AddPropertyEvent(graph, v1, prop1), new DeleteVertexEvent(graph, v1) ); }
@Test public void testDeleteVertexWithProperties() { Vertex v1 = graph.prepareVertex("v1", VISIBILITY_A) .setProperty("prop1", "value1", VISIBILITY_B) .save(AUTHORIZATIONS_A_AND_B); graph.flush(); Property prop1 = v1.getProperty("prop1"); Assert.assertEquals(1, count(graph.getVertices(AUTHORIZATIONS_A))); graph.deleteVertex("v1", AUTHORIZATIONS_A); graph.flush(); Assert.assertEquals(0, count(graph.getVertices(AUTHORIZATIONS_A_AND_B))); assertEvents( new AddVertexEvent(graph, v1), new AddPropertyEvent(graph, v1, prop1), new DeleteVertexEvent(graph, v1) ); }
if (properties != null) { for (Property property : properties) { queueEvent(new AddPropertyEvent(this, element, property));
if (properties != null) { for (Property property : properties) { queueEvent(new AddPropertyEvent(this, element, property));