23
23
import static org .hamcrest .MatcherAssert .assertThat ;
24
24
import static org .hamcrest .Matchers .lessThan ;
25
25
import static org .hamcrest .Matchers .lessThanOrEqualTo ;
26
- import static org .junit .Assert .assertEquals ;
27
- import static org .junit .Assert .assertNotNull ;
28
- import static org .junit .Assert .assertTrue ;
26
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
27
+ import static org .junit .jupiter .api .Assertions .assertInstanceOf ;
28
+ import static org .junit .jupiter .api .Assertions .assertNotNull ;
29
+ import static org .junit .jupiter .api .Assertions .assertTrue ;
29
30
import static org .neo4j .configuration .GraphDatabaseSettings .DEFAULT_DATABASE_NAME ;
30
31
import static org .neo4j .gis .spatial .rtree .RTreeIndex .DEFAULT_MAX_NODE_REFERENCES ;
31
32
import static org .neo4j .internal .helpers .collection .MapUtil .map ;
49
50
import org .geotools .api .referencing .crs .CoordinateReferenceSystem ;
50
51
import org .geotools .data .neo4j .Neo4jFeatureBuilder ;
51
52
import org .geotools .referencing .crs .DefaultEngineeringCRS ;
52
- import org .junit .After ;
53
- import org .junit .AfterClass ;
54
- import org .junit .Before ;
55
- import org .junit .Ignore ;
56
- import org .junit .Test ;
53
+ import org .junit .jupiter . api . AfterAll ;
54
+ import org .junit .jupiter . api . AfterEach ;
55
+ import org .junit .jupiter . api . BeforeEach ;
56
+ import org .junit .jupiter . api . Disabled ;
57
+ import org .junit .jupiter . api . Test ;
57
58
import org .locationtech .jts .geom .Coordinate ;
58
59
import org .locationtech .jts .geom .Geometry ;
59
60
import org .neo4j .dbms .api .DatabaseManagementService ;
@@ -94,17 +95,17 @@ public class RTreeBulkInsertTest {
94
95
// While the current lucene index implmentation is so slow (16n/s) we disable all benchmarks for lucene backed indexes
95
96
private static final boolean enableLucene = false ;
96
97
97
- @ Before
98
+ @ BeforeEach
98
99
public void before () throws IOException {
99
100
restart ();
100
101
}
101
102
102
- @ After
103
+ @ AfterEach
103
104
public void after () throws IOException {
104
105
doCleanShutdown ();
105
106
}
106
107
107
- @ Ignore
108
+ @ Disabled
108
109
public void shouldDeleteRecursiveTree () {
109
110
int depth = 5 ;
110
111
int width = 2 ;
@@ -185,7 +186,7 @@ private EditableLayer getOrCreateSimplePointLayer(String name, String index, Str
185
186
}
186
187
}
187
188
188
- @ Ignore
189
+ @ Disabled
189
190
public void shouldInsertSimpleRTree () {
190
191
int width = 20 ;
191
192
int blockSize = 10000 ;
@@ -603,12 +604,12 @@ public void shouldInsertManyNodesInBulkWithHilbert_small() throws FactoryExcepti
603
604
insertManyNodesInBulk (new HilbertIndexMaker ("Coordinates" , "Bulk" , testConfigs .get ("small" )), 5000 );
604
605
}
605
606
606
- @ Ignore // takes too long, change to @Test when benchmarking
607
+ @ Disabled // takes too long, change to @Test when benchmarking
607
608
public void shouldInsertManyNodesIndividuallyWithQuadraticSplit_small_10 () throws FactoryException , IOException {
608
609
insertManyNodesIndividually (RTreeIndex .QUADRATIC_SPLIT , 5000 , 10 , testConfigs .get ("small" ));
609
610
}
610
611
611
- @ Ignore // takes too long, change to @Test when benchmarking
612
+ @ Disabled // takes too long, change to @Test when benchmarking
612
613
public void shouldInsertManyNodesIndividuallyGreenesSplit_small_10 () throws FactoryException , IOException {
613
614
insertManyNodesIndividually (RTreeIndex .GREENES_SPLIT , 5000 , 10 , testConfigs .get ("small" ));
614
615
}
@@ -627,12 +628,12 @@ public void shouldInsertManyNodesInBulkWithGreenesSplit_small_10() throws Factor
627
628
* Small model 250*250 nodes (shallow tree)
628
629
*/
629
630
630
- @ Ignore // takes too long, change to @Test when benchmarking
631
+ @ Disabled // takes too long, change to @Test when benchmarking
631
632
public void shouldInsertManyNodesIndividuallyWithQuadraticSplit_small_100 () throws FactoryException , IOException {
632
633
insertManyNodesIndividually (RTreeIndex .QUADRATIC_SPLIT , 5000 , 100 , testConfigs .get ("small" ));
633
634
}
634
635
635
- @ Ignore // takes too long, change to @Test when benchmarking
636
+ @ Disabled // takes too long, change to @Test when benchmarking
636
637
public void shouldInsertManyNodesIndividuallyGreenesSplit_small_100 () throws FactoryException , IOException {
637
638
insertManyNodesIndividually (RTreeIndex .GREENES_SPLIT , 5000 , 100 , testConfigs .get ("small" ));
638
639
}
@@ -681,12 +682,12 @@ public void shouldInsertManyNodesInBulkWithHilbert_medium() throws FactoryExcept
681
682
insertManyNodesInBulk (new HilbertIndexMaker ("Coordinates" , "Bulk" , testConfigs .get ("medium" )), 5000 );
682
683
}
683
684
684
- @ Ignore
685
+ @ Disabled
685
686
public void shouldInsertManyNodesIndividuallyWithQuadraticSplit_medium_10 () throws FactoryException , IOException {
686
687
insertManyNodesIndividually (RTreeIndex .QUADRATIC_SPLIT , 5000 , 10 , testConfigs .get ("medium" ));
687
688
}
688
689
689
- @ Ignore
690
+ @ Disabled
690
691
public void shouldInsertManyNodesIndividuallyGreenesSplit_medium_10 () throws FactoryException , IOException {
691
692
insertManyNodesIndividually (RTreeIndex .GREENES_SPLIT , 5000 , 10 , testConfigs .get ("medium" ));
692
693
}
@@ -701,12 +702,12 @@ public void shouldInsertManyNodesInBulkWithGreenesSplit_medium_10() throws Facto
701
702
insertManyNodesInBulk (RTreeIndex .GREENES_SPLIT , 5000 , 10 , testConfigs .get ("medium" ));
702
703
}
703
704
704
- @ Ignore
705
+ @ Disabled
705
706
public void shouldInsertManyNodesInBulkWithQuadraticSplit_medium_10_merge () throws FactoryException , IOException {
706
707
insertManyNodesInBulk (RTreeIndex .QUADRATIC_SPLIT , 5000 , 10 , testConfigs .get ("medium" ), true );
707
708
}
708
709
709
- @ Ignore
710
+ @ Disabled
710
711
public void shouldInsertManyNodesInBulkWithGreenesSplit_medium_10_merge () throws FactoryException , IOException {
711
712
insertManyNodesInBulk (RTreeIndex .GREENES_SPLIT , 5000 , 10 , testConfigs .get ("medium" ), true );
712
713
}
@@ -715,17 +716,17 @@ public void shouldInsertManyNodesInBulkWithGreenesSplit_medium_10_merge() throws
715
716
* Medium model 500*500 nodes (shallow tree - factor 100)
716
717
*/
717
718
718
- @ Ignore
719
+ @ Disabled
719
720
public void shouldInsertManyNodesIndividuallyWithQuadraticSplit_medium_100 () throws FactoryException , IOException {
720
721
insertManyNodesIndividually (RTreeIndex .QUADRATIC_SPLIT , 5000 , 100 , testConfigs .get ("medium" ));
721
722
}
722
723
723
- @ Ignore
724
+ @ Disabled
724
725
public void shouldInsertManyNodesIndividuallyGreenesSplit_medium_100 () throws FactoryException , IOException {
725
726
insertManyNodesIndividually (RTreeIndex .GREENES_SPLIT , 5000 , 100 , testConfigs .get ("medium" ));
726
727
}
727
728
728
- @ Ignore // takes too long, change to @Test when benchmarking
729
+ @ Disabled // takes too long, change to @Test when benchmarking
729
730
public void shouldInsertManyNodesInBulkWithQuadraticSplit_medium_100 () throws FactoryException , IOException {
730
731
insertManyNodesInBulk (RTreeIndex .QUADRATIC_SPLIT , 5000 , 100 , testConfigs .get ("medium" ));
731
732
}
@@ -735,12 +736,12 @@ public void shouldInsertManyNodesInBulkWithGreenesSplit_medium_100() throws Fact
735
736
insertManyNodesInBulk (RTreeIndex .GREENES_SPLIT , 5000 , 100 , testConfigs .get ("medium" ));
736
737
}
737
738
738
- @ Ignore
739
+ @ Disabled
739
740
public void shouldInsertManyNodesInBulkWithQuadraticSplit_medium_100_merge () throws FactoryException , IOException {
740
741
insertManyNodesInBulk (RTreeIndex .QUADRATIC_SPLIT , 5000 , 100 , testConfigs .get ("medium" ), true );
741
742
}
742
743
743
- @ Ignore
744
+ @ Disabled
744
745
public void shouldInsertManyNodesInBulkWithGreenesSplit_medium_100_merge () throws FactoryException , IOException {
745
746
insertManyNodesInBulk (RTreeIndex .GREENES_SPLIT , 5000 , 100 , testConfigs .get ("medium" ), true );
746
747
}
@@ -779,22 +780,22 @@ public void shouldInsertManyNodesInBulkWithHilbert_large() throws FactoryExcepti
779
780
insertManyNodesInBulk (new HilbertIndexMaker ("Coordinates" , "Bulk" , testConfigs .get ("large" )), 5000 );
780
781
}
781
782
782
- @ Ignore // takes too long, change to @Test when benchmarking
783
+ @ Disabled // takes too long, change to @Test when benchmarking
783
784
public void shouldInsertManyNodesInBulkWithQuadraticSplit_large_10 () throws FactoryException , IOException {
784
785
insertManyNodesInBulk (RTreeIndex .QUADRATIC_SPLIT , 5000 , 10 , testConfigs .get ("large" ));
785
786
}
786
787
787
- @ Ignore // takes too long, change to @Test when benchmarking
788
+ @ Disabled // takes too long, change to @Test when benchmarking
788
789
public void shouldInsertManyNodesInBulkWithGreenesSplit_large_10 () throws FactoryException , IOException {
789
790
insertManyNodesInBulk (RTreeIndex .GREENES_SPLIT , 5000 , 10 , testConfigs .get ("large" ));
790
791
}
791
792
792
- @ Ignore // takes too long, change to @Test when benchmarking
793
+ @ Disabled // takes too long, change to @Test when benchmarking
793
794
public void shouldInsertManyNodesInBulkWithQuadraticSplit_large_100 () throws FactoryException , IOException {
794
795
insertManyNodesInBulk (RTreeIndex .QUADRATIC_SPLIT , 5000 , 100 , testConfigs .get ("large" ));
795
796
}
796
797
797
- @ Ignore // takes too long, change to @Test when benchmarking
798
+ @ Disabled // takes too long, change to @Test when benchmarking
798
799
public void shouldInsertManyNodesInBulkWithGreenesSplit_large_100 () throws FactoryException , IOException {
799
800
insertManyNodesInBulk (RTreeIndex .GREENES_SPLIT , 5000 , 100 , testConfigs .get ("large" ));
800
801
}
@@ -916,7 +917,7 @@ private void insertManyNodesIndividually(IndexMaker indexMaker, int blockSize) {
916
917
* Run this manually to generate images of RTree that can be used for animation.
917
918
* ffmpeg -f image2 -r 12 -i rtree-single/rtree-%d.png -r 12 -s 1280x960 rtree-single2_12fps.mp4
918
919
*/
919
- @ Ignore
920
+ @ Disabled
920
921
public void shouldInsertManyNodesIndividuallyAndGenerateImagesForAnimation () throws FactoryException , IOException {
921
922
IndexTestConfig config = testConfigs .get ("medium" );
922
923
int blockSize = 5 ;
@@ -1029,7 +1030,7 @@ private void insertManyNodesInBulk(IndexMaker indexMaker, int blockSize) {
1029
1030
* Run this manually to generate images of RTree that can be used for animation.
1030
1031
* ffmpeg -f image2 -r 12 -i rtree-single/rtree-%d.png -r 12 -s 1280x960 rtree-single2_12fps.mp4
1031
1032
*/
1032
- @ Ignore
1033
+ @ Disabled
1033
1034
public void shouldInsertManyNodesInBulkAndGenerateImagesForAnimation () throws FactoryException , IOException {
1034
1035
IndexTestConfig config = testConfigs .get ("medium" );
1035
1036
int blockSize = 1000 ;
@@ -1085,7 +1086,7 @@ public void shouldInsertManyNodesInBulkAndGenerateImagesForAnimation() throws Fa
1085
1086
// debugIndexTree((RTreeIndex) layer.getIndex());
1086
1087
}
1087
1088
1088
- @ Ignore
1089
+ @ Disabled
1089
1090
public void shouldAccessIndexAfterBulkInsertion () throws Exception {
1090
1091
// Use these two lines if you want to examine the output.
1091
1092
// File dbPath = new File("target/var/BulkTest");
@@ -1137,7 +1138,7 @@ public void shouldAccessIndexAfterBulkInsertion() throws Exception {
1137
1138
Result result = tx .execute (cypher );
1138
1139
// System.out.println(result.columns().toString());
1139
1140
Object obj = result .columnAs ("count" ).next ();
1140
- assertTrue ( obj instanceof Long );
1141
+ assertInstanceOf ( Long . class , obj );
1141
1142
assertEquals ((long ) ((Long ) obj ), numNodes );
1142
1143
tx .commit ();
1143
1144
}
@@ -1152,14 +1153,14 @@ public void shouldAccessIndexAfterBulkInsertion() throws Exception {
1152
1153
Result result = tx .execute (cypher );
1153
1154
// System.out.println(result.columns().toString());
1154
1155
Object obj = result .columnAs ("count" ).next ();
1155
- assertTrue ( obj instanceof Long );
1156
+ assertInstanceOf ( Long . class , obj );
1156
1157
assertEquals ((long ) ((Long ) obj ), numNodes );
1157
1158
tx .commit ();
1158
1159
}
1159
1160
System .out .println ("\t " + (System .currentTimeMillis () - start ) + "ms" );
1160
1161
}
1161
1162
1162
- @ Ignore
1163
+ @ Disabled
1163
1164
public void shouldBuildTreeFromScratch () throws Exception {
1164
1165
//GraphDatabaseService db = this.databases.database("BultTest2");
1165
1166
GraphDatabaseService db = this .db ;
@@ -1215,7 +1216,7 @@ public void shouldBuildTreeFromScratch() throws Exception {
1215
1216
}
1216
1217
}
1217
1218
1218
- @ Ignore
1219
+ @ Disabled
1219
1220
public void shouldPerformRTreeBulkInsertion () throws Exception {
1220
1221
// Use this line if you want to examine the output.
1221
1222
//GraphDatabaseService db = databases.database("BulkTest");
@@ -1492,8 +1493,8 @@ private List<Node> queryIndex(Layer layer, TestStats stats) {
1492
1493
stats .put ("Indexed" , geometrySize );
1493
1494
System .out .println ("Index contains " + geometrySize + " geometries" );
1494
1495
}
1495
- assertEquals ("Expected " + config .expectedGeometries + " nodes to be returned" , config . expectedGeometries ,
1496
- countGeometries );
1496
+ assertEquals (config .expectedGeometries , countGeometries ,
1497
+ "Expected " + config . expectedGeometries + " nodes to be returned" );
1497
1498
return nodes ;
1498
1499
}
1499
1500
@@ -1529,7 +1530,8 @@ private void getRTreeIndexStats(RTreeIndex index, TreeMonitor monitor, TestStats
1529
1530
// unless the polygon is a rectangle, in which case they are not contained, leading to
1530
1531
// different numbers for expectedGeometries and expectedCount.
1531
1532
// See https://github.com/locationtech/jts/blob/master/modules/core/src/main/java/org/locationtech/jts/operation/predicate/RectangleContains.java#L70
1532
- assertEquals ("Expected " + config .expectedCount + " nodes to be matched" , config .expectedCount , matched );
1533
+ assertEquals (config .expectedCount , matched ,
1534
+ "Expected " + config .expectedCount + " nodes to be matched" );
1533
1535
int maxNodeReferences = stats .maxNodeReferences ;
1534
1536
int maxExpectedGeometriesTouched = matched * maxNodeReferences ;
1535
1537
if (countGeometries > 1 && assertTouches ) {
@@ -1555,7 +1557,8 @@ private void getExplicitIndexBackedIndexStats(ExplicitIndexBackedPointIndex inde
1555
1557
// unless the polygon is a rectangle, in which case they are not contained, leading to
1556
1558
// different numbers for expectedGeometries and expectedCount.
1557
1559
// See https://github.com/locationtech/jts/blob/master/modules/core/src/main/java/org/locationtech/jts/operation/predicate/RectangleContains.java#L70
1558
- assertEquals ("Expected " + config .expectedCount + " nodes to be matched" , config .expectedCount , matched );
1560
+ assertEquals (config .expectedCount , matched ,
1561
+ "Expected " + config .expectedCount + " nodes to be matched" );
1559
1562
}
1560
1563
1561
1564
private class TimedLogger {
@@ -1599,17 +1602,17 @@ private void log(String line, long number) {
1599
1602
1600
1603
private void verifyGeohashIndex (Layer layer ) {
1601
1604
LayerIndexReader index = layer .getIndex ();
1602
- assertTrue ( "Index should be a geohash index" , index instanceof LayerGeohashPointIndex );
1605
+ assertInstanceOf ( LayerGeohashPointIndex . class , index , "Index should be a geohash index" );
1603
1606
}
1604
1607
1605
1608
private void verifyHilbertIndex (Layer layer ) {
1606
1609
LayerIndexReader index = layer .getIndex ();
1607
- assertTrue ( "Index should be a hilbert index" , index instanceof LayerHilbertPointIndex );
1610
+ assertInstanceOf ( LayerHilbertPointIndex . class , index , "Index should be a hilbert index" );
1608
1611
}
1609
1612
1610
1613
private void verifyZOrderIndex (Layer layer ) {
1611
1614
LayerIndexReader index = layer .getIndex ();
1612
- assertTrue ( "Index should be a Z-Order index" , index instanceof LayerZOrderPointIndex );
1615
+ assertInstanceOf ( LayerZOrderPointIndex . class , index , "Index should be a Z-Order index" );
1613
1616
}
1614
1617
1615
1618
private void verifyTreeStructure (Layer layer , String splitMode , TestStats stats ) {
@@ -1650,7 +1653,7 @@ private void verifyTreeStructure(Layer layer, String splitMode, TestStats stats)
1650
1653
System .out .println ("Tree depth to all geometries: " + depthMap );
1651
1654
}
1652
1655
}
1653
- assertEquals ("All geometries should be at the same depth" , 1 , balanced );
1656
+ assertEquals (1 , balanced , "All geometries should be at the same depth" );
1654
1657
Map <String , Object > leafMap ;
1655
1658
try (Transaction tx = db .beginTx ()) {
1656
1659
Result resultNumChildren = tx .execute (queryNumChildren , params );
@@ -1803,7 +1806,7 @@ public String toString() {
1803
1806
1804
1807
private static final LinkedHashSet <TestStats > allStats = new LinkedHashSet <>();
1805
1808
1806
- @ AfterClass
1809
+ @ AfterAll
1807
1810
public static void afterClass () {
1808
1811
System .out .println ("\n \n Composite stats for " + allStats .size () + " tests run" );
1809
1812
System .out .println (TestStats .headerString ());
0 commit comments