Skip to content

Commit

Permalink
refactor: removed use of deprecated java APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
tglman committed Sep 18, 2024
1 parent f8af01f commit 9899907
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,38 @@ public void shouldCountVerticesEdges() {

// Count on V
Long count = graph.traversal().V().count().toList().get(0);
Assert.assertEquals(new Long(4), count);
Assert.assertEquals(Long.valueOf(4), count);

count = graph.traversal().V().hasLabel("Person").count().toList().get(0);
Assert.assertEquals(new Long(2), count);
Assert.assertEquals(Long.valueOf(2), count);

count = graph.traversal().V().hasLabel("Animal").count().toList().get(0);
Assert.assertEquals(new Long(2), count);
Assert.assertEquals(Long.valueOf(2), count);

count = graph.traversal().V().hasLabel("Animal", "Person").count().toList().get(0);
Assert.assertEquals(new Long(4), count);
Assert.assertEquals(Long.valueOf(4), count);

// Count on E

count = graph.traversal().E().count().toList().get(0);
Assert.assertEquals(new Long(3), count);
Assert.assertEquals(Long.valueOf(3), count);

count = graph.traversal().E().hasLabel("HasFriend").count().toList().get(0);
Assert.assertEquals(new Long(1), count);
Assert.assertEquals(Long.valueOf(1), count);

count = graph.traversal().E().hasLabel("HasAnimal").count().toList().get(0);
Assert.assertEquals(new Long(2), count);
Assert.assertEquals(Long.valueOf(2), count);

count = graph.traversal().E().hasLabel("HasAnimal", "HasFriend").count().toList().get(0);
Assert.assertEquals(new Long(3), count);
Assert.assertEquals(Long.valueOf(3), count);

// Inverted Count

count = graph.traversal().V().hasLabel("HasFriend").count().toList().get(0);
Assert.assertEquals(new Long(0), count);
Assert.assertEquals(Long.valueOf(0), count);

count = graph.traversal().E().hasLabel("Person").count().toList().get(0);
Assert.assertEquals(new Long(0), count);
Assert.assertEquals(Long.valueOf(0), count);

// More Complex Count

Expand All @@ -62,29 +62,29 @@ public void shouldCountVerticesEdges() {
.count()
.toList()
.get(0);
Assert.assertEquals(new Long(2), count);
Assert.assertEquals(Long.valueOf(2), count);

// With Polymorphism

count = graph.traversal().V().has("Person", "name", "Jon").out("E").count().toList().get(0);
Assert.assertEquals(new Long(2), count);
Assert.assertEquals(Long.valueOf(2), count);

// With Base Class V/E

count = graph.traversal().V().has("name", "Jon").count().toList().get(0);
Assert.assertEquals(new Long(1), count);
Assert.assertEquals(Long.valueOf(1), count);

count = graph.traversal().E().has("name", "Jon").count().toList().get(0);
Assert.assertEquals(new Long(0), count);
Assert.assertEquals(Long.valueOf(0), count);

count = graph.traversal().V().has("name", "Jon").out("E").count().toList().get(0);
Assert.assertEquals(new Long(2), count);
Assert.assertEquals(Long.valueOf(2), count);

count = graph.traversal().E().has("marker", 10).count().toList().get(0);
Assert.assertEquals(new Long(1), count);
Assert.assertEquals(Long.valueOf(1), count);

count = graph.traversal().V().has("marker", 10).count().toList().get(0);
Assert.assertEquals(new Long(0), count);
Assert.assertEquals(Long.valueOf(0), count);
}

@Test
Expand All @@ -95,19 +95,19 @@ public void shouldCountVerticesEdgesOnTXRollback() {
// Count on V
Long count = graph.traversal().V().count().toList().get(0);

Assert.assertEquals(new Long(0), count);
Assert.assertEquals(Long.valueOf(0), count);

graph.addVertex("name", "Jon");

count = graph.traversal().V().count().toList().get(0);

Assert.assertEquals(new Long(1), count);
Assert.assertEquals(Long.valueOf(1), count);

graph.tx().rollback();

count = graph.traversal().V().count().toList().get(0);

Assert.assertEquals(new Long(0), count);
Assert.assertEquals(Long.valueOf(0), count);

graph.close();
}
Expand All @@ -120,18 +120,18 @@ public void shouldExecuteTraversalWithSpecialCharacters() {
// Count on V
Long count = graph.traversal().V().count().toList().get(0);

Assert.assertEquals(new Long(0), count);
Assert.assertEquals(Long.valueOf(0), count);

graph.addVertex("identifier", 1);

count = graph.traversal().V().count().toList().get(0);

Assert.assertEquals(new Long(1), count);
Assert.assertEquals(Long.valueOf(1), count);

graph.tx().commit();

count = graph.traversal().V().has("~identifier", 1).count().toList().get(0);
Assert.assertEquals(new Long(0), count);
Assert.assertEquals(Long.valueOf(0), count);

graph.close();
}
Expand All @@ -147,13 +147,13 @@ public void shouldNotBlowWithWrongClass() {

Integer count = graph.traversal().V().hasLabel("Wrong").toList().size();

Assert.assertEquals(new Integer(0), count);
Assert.assertEquals(Integer.valueOf(0), count);

// Count on Person + Wrong Class

count = graph.traversal().V().hasLabel("Person", "Wrong").toList().size();

Assert.assertEquals(new Integer(2), count);
Assert.assertEquals(Integer.valueOf(2), count);
} finally {
graph.close();
}
Expand Down Expand Up @@ -194,19 +194,19 @@ public void shouldCountVerticesEdgesOnTXCommit() {
// Count on V
Long count = graph.traversal().V().count().toList().get(0);

Assert.assertEquals(new Long(0), count);
Assert.assertEquals(Long.valueOf(0), count);

graph.addVertex("name", "Jon");

count = graph.traversal().V().count().toList().get(0);

Assert.assertEquals(new Long(1), count);
Assert.assertEquals(Long.valueOf(1), count);

graph.tx().commit();

count = graph.traversal().V().count().toList().get(0);

Assert.assertEquals(new Long(1), count);
Assert.assertEquals(Long.valueOf(1), count);

graph.close();
}
Expand All @@ -221,7 +221,7 @@ public void shouldWorkWithTwoLabels() {
// Count on V
Long count = graph.traversal().V().count().toList().get(0);

Assert.assertEquals(new Long(0), count);
Assert.assertEquals(Long.valueOf(0), count);

graph.addVertex(T.label, "Person", "name", "Jon");

Expand All @@ -237,7 +237,7 @@ public void shouldWorkWithTwoLabels() {
.toList()
.get(0);

Assert.assertEquals(new Long(1), count);
Assert.assertEquals(Long.valueOf(1), count);

graph.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public void openWithEmptyConfig() {

graph.addVertex(T.label, "V", "name", "Foo");

Assert.assertEquals(new Long(1), graph.traversal().V().count().toList().iterator().next());
Assert.assertEquals(Long.valueOf(1), graph.traversal().V().count().toList().iterator().next());

graph.drop();
}
Expand All @@ -340,7 +340,8 @@ public void openWithMemoryDatabase() {
try {
graph.addVertex(T.label, "V", "name", "Foo");

Assert.assertEquals(new Long(1), graph.traversal().V().count().toList().iterator().next());
Assert.assertEquals(
Long.valueOf(1), graph.traversal().V().count().toList().iterator().next());
} finally {
graph.drop();
}
Expand All @@ -354,7 +355,8 @@ public void openWithLocalDatabase() {
try {
graph.addVertex(T.label, "V", "name", "Foo");

Assert.assertEquals(new Long(1), graph.traversal().V().count().toList().iterator().next());
Assert.assertEquals(
Long.valueOf(1), graph.traversal().V().count().toList().iterator().next());
} finally {
graph.drop();
}
Expand All @@ -378,7 +380,8 @@ public void openWithConfiguration() {
Assert.assertEquals(true, graph.tx().isOpen());
Assert.assertEquals(true, vertex.getRawElement().getIdentity().isNew());
graph.tx().commit();
Assert.assertEquals(new Long(1), graph.traversal().V().count().toList().iterator().next());
Assert.assertEquals(
Long.valueOf(1), graph.traversal().V().count().toList().iterator().next());
} finally {
graph.drop();
}
Expand All @@ -392,7 +395,7 @@ public void shouldOpenAFactoryInMemory() {
OrientGraph graph = factory.getNoTx();
graph.addVertex(T.label, "V", "name", "Foo");

Assert.assertEquals(new Long(1), graph.traversal().V().count().toList().iterator().next());
Assert.assertEquals(Long.valueOf(1), graph.traversal().V().count().toList().iterator().next());

factory.drop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void testExecuteGremlinFunctionCountQueryTest() {

Assert.assertEquals(true, gremlin.hasNext());
Object result = gremlin.next();
Assert.assertEquals(new Long(2), result);
Assert.assertEquals(Long.valueOf(2), result);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void testExecuteGremlinCountQueryTest() {
Assert.assertEquals(true, iterator.hasNext());
OGremlinResult result = iterator.next();
Long count = result.getProperty("value");
Assert.assertEquals(new Long(2), count);
Assert.assertEquals(Long.valueOf(2), count);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public ORID convertId(Object id, Class<? extends Element> c) {
if (id instanceof String) {
Integer numericId;
try {
numericId = new Integer(id.toString());
numericId = Integer.valueOf(id.toString());
} catch (NumberFormatException e) {
return new MockORID("Invalid id: " + id + " for " + c);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void testExecuteGremlinFunctionCountQueryTest() {

Assert.assertEquals(true, gremlin.hasNext());
Object result = gremlin.next();
Assert.assertEquals(new Long(2), result);
Assert.assertEquals(Long.valueOf(2), result);
}

// Still Not supported
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void testExecuteGremlinCountQueryTest() {
Assert.assertEquals(true, iterator.hasNext());
OGremlinResult result = iterator.next();
Long count = result.getProperty("value");
Assert.assertEquals(new Long(2), count);
Assert.assertEquals(Long.valueOf(2), count);
}

@Test
Expand Down
Loading

0 comments on commit 9899907

Please sign in to comment.