This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
[ | |
"marko", | |
{ | |
"author": "stephen", | |
"time": 1 | |
} | |
], | |
[ | |
"mrodriguez", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"marko" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
"marko", | |
{ | |
"author": "stephen", | |
"time": 1 | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gremlin.of(g).V() | |
.match("a", "b", | |
Gremlin.of().as("a").out("knows").has("name", "josh"), | |
Gremlin.of().as("a").out("created").has("name", "lop"), | |
Gremlin.of().as("a").out("created").as("b")) | |
.value("name").path() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stream.of(gremlinTestBaseClass.getDeclaredMethods()) | |
.forEach(m -> { | |
try { | |
assertNotNull(testClass.getDeclaredMethod(m.getName()).getAnnotation(Test.class)); | |
} catch (final NoSuchMethodException e) { | |
fail(String.format("Base test method from gremlin-test [%s] not found in test implementation %s", | |
m.getName(), testClass)); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gremlin.of(g).V().as("x").out().jump("x", o -> o.getLoops() < 2).path().forEach(System.out::println); | |
Gremlin.of(g).V().as("x").jump("y", o -> o.getLoops() > 1).out().jump("x").path().as("y").forEach(System.out::println); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void g_V_hasXname_markoX() { | |
super.g_V_hasXname_markoX(new GremlinResultIterable<Vertex>(g, () -> Gremlin.of().has("name", "marko")).iterator()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void shouldSerializeLambda() throws Exception { | |
ByteArrayOutputStream outBytes = new ByteArrayOutputStream(10); | |
ObjectOutputStream out = new ObjectOutputStream(outBytes); | |
out.writeObject((Predicate) e -> true); | |
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(outBytes.toByteArray())); | |
Predicate predicate = (Predicate) in.readObject(); | |
assertTrue(predicate.test(null)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void shouldSerializeLambda() throws Exception { | |
ByteArrayOutputStream outBytes = new ByteArrayOutputStream(10); | |
ObjectOutputStream out = new ObjectOutputStream(outBytes); | |
final SerializedPredicate predicate = e -> true; | |
out.writeObject(predicate); | |
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(outBytes.toByteArray())); | |
Predicate p = (Predicate) in.readObject(); | |
assertTrue(p.test(null)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testUnion() { | |
Graph g = TinkerFactory.createClassic(); | |
Gremlin.of(g).v(1).union( | |
Gremlin.of().out("knows"), | |
Gremlin.of().out("created").in("created") | |
).value("name").forEach(System.out::println); | |
} | |