use of com.tinkerpop.frames.domain.classes.Person in project frames by tinkerpop.
the class FrameInitializerTest method testVertexInitialization.
@Test
public void testVertexInitialization() {
Person person = framedGraph.addVertex(null, Person.class);
assertEquals("Defaulted", person.getName());
}
use of com.tinkerpop.frames.domain.classes.Person in project frames by tinkerpop.
the class FramedVertexSetTest method testFramedSet.
public void testFramedSet() {
Graph graph = TinkerGraphFactory.createTinkerGraph();
FramedGraph<Graph> framedGraph = new FramedGraph<Graph>(graph);
Set<Vertex> vertices = new HashSet<Vertex>();
vertices.add(graph.getVertex(1));
vertices.add(graph.getVertex(4));
vertices.add(graph.getVertex(6));
FramedVertexSet<Person> set = new FramedVertexSet<Person>(framedGraph, vertices, Person.class);
assertEquals(set.size(), 3);
assertTrue(set.contains(graph.getVertex(1)));
assertTrue(set.contains(graph.getVertex(4)));
assertTrue(set.contains(graph.getVertex(6)));
assertTrue(set.contains(framedGraph.frame(graph.getVertex(1), Person.class)));
assertTrue(set.contains(framedGraph.frame(graph.getVertex(4), Person.class)));
assertTrue(set.contains(framedGraph.frame(graph.getVertex(6), Person.class)));
int counter = 0;
for (Person person : set) {
assertTrue(person.asVertex().getId().equals("1") || person.asVertex().getId().equals("4") || person.asVertex().getId().equals("6"));
counter++;
}
assertEquals(counter, 3);
}
use of com.tinkerpop.frames.domain.classes.Person in project frames by tinkerpop.
the class JavaHandlerTest method testJavaHandlerVertices.
@Test
public void testJavaHandlerVertices() {
Person person = g.getVertex(1, Person.class);
String profile = person.getNameAndAge();
Assert.assertEquals("marko (29)", profile);
Person person2 = g.getVertex(2, Person.class);
String profile2 = person2.getNameAndAge();
Assert.assertEquals("vadas (27)", profile2);
Set<Person> coCreators = new HashSet<Person>();
Iterables.addAll(coCreators, person.getCoCreatorsJava());
Assert.assertEquals(Sets.newHashSet(g.getVertex(4), g.getVertex(6)), coCreators);
}
use of com.tinkerpop.frames.domain.classes.Person in project frames by tinkerpop.
the class FramedElementTest method testRemoveProperties.
@Test
public void testRemoveProperties() {
Graph graph = TinkerGraphFactory.createTinkerGraph();
FramedGraph<Graph> framedGraph = new FramedGraphFactory().create(graph);
Person marko = framedGraph.getVertex(1, Person.class);
assertEquals(marko.getAge(), new Integer(29));
marko.removeAge();
assertNull(marko.getAge());
}
use of com.tinkerpop.frames.domain.classes.Person in project frames by tinkerpop.
the class FramedElementTest method testSetPropertiesToNull.
@Test
public void testSetPropertiesToNull() {
Graph graph = TinkerGraphFactory.createTinkerGraph();
FramedGraph<Graph> framedGraph = new FramedGraphFactory().create(graph);
Person marko = framedGraph.getVertex(1, Person.class);
assertEquals(marko.getAge(), new Integer(29));
marko.setAge(null);
assertNull(marko.getAge());
}
Aggregations