Skip to content

Commit d8a7d41

Browse files
committed
Add flag for CausalClusteringStressIT
1 parent 7140b2b commit d8a7d41

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

driver/src/test/java/org/neo4j/driver/stress/AbstractStressTestBase.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
import java.lang.management.OperatingSystemMXBean;
2929
import java.lang.reflect.Method;
3030
import java.net.URI;
31+
import java.time.Duration;
32+
import java.time.LocalDate;
33+
import java.time.LocalDateTime;
34+
import java.time.LocalTime;
35+
import java.time.ZonedDateTime;
3136
import java.util.ArrayList;
3237
import java.util.Collections;
3338
import java.util.HashMap;
@@ -64,12 +69,14 @@
6469
import org.neo4j.driver.async.AsyncTransaction;
6570
import org.neo4j.driver.async.ResultCursor;
6671
import org.neo4j.driver.internal.InternalDriver;
72+
import org.neo4j.driver.internal.InternalIsoDuration;
6773
import org.neo4j.driver.internal.logging.DevNullLogger;
6874
import org.neo4j.driver.internal.util.Futures;
6975
import org.neo4j.driver.internal.util.Iterables;
7076
import org.neo4j.driver.reactive.RxSession;
7177
import org.neo4j.driver.reactive.RxTransaction;
7278
import org.neo4j.driver.types.Node;
79+
import org.neo4j.driver.types.Point;
7380
import org.neo4j.driver.util.DaemonThreadFactory;
7481

7582
import static java.util.Collections.nCopies;
@@ -86,17 +93,26 @@
8693
import static org.junit.jupiter.api.Assertions.assertTrue;
8794
import static org.junit.jupiter.api.Assumptions.assumeTrue;
8895
import static org.neo4j.driver.SessionConfig.builder;
96+
import static org.neo4j.driver.Values.point;
8997

9098
abstract class AbstractStressTestBase<C extends AbstractContext>
9199
{
92100
private static final int THREAD_COUNT = Integer.getInteger( "threadCount", 8 );
93101
private static final int ASYNC_BATCH_SIZE = Integer.getInteger( "asyncBatchSize", 10 );
94102
private static final int EXECUTION_TIME_SECONDS = Integer.getInteger( "executionTimeSeconds", 20 );
95103
private static final boolean DEBUG_LOGGING_ENABLED = Boolean.getBoolean( "loggingEnabled" );
104+
private static final boolean EXTENDED_TYPES_ENABLED = Boolean.getBoolean( "extendedTypesEnabled" );
96105

97106
private static final int BIG_DATA_TEST_NODE_COUNT = Integer.getInteger( "bigDataTestNodeCount", 30_000 );
98107
private static final int BIG_DATA_TEST_BATCH_SIZE = Integer.getInteger( "bigDataTestBatchSize", 10_000 );
99108

109+
private static final Point POINT = point( 9157, 3, 7, 12).asPoint();
110+
private static final LocalTime LOCAL_TIME = LocalTime.now();
111+
private static final LocalDateTime LOCAL_DATE_TIME = LocalDateTime.now();
112+
private static final LocalDate DATE = LOCAL_DATE_TIME.toLocalDate();
113+
private static final ZonedDateTime ZONED_DATE_TIME = ZonedDateTime.now();
114+
private static final Duration DURATION = Duration.ofHours( 300 );
115+
100116
private LoggerNameTrackingLogging logging;
101117
private ExecutorService executor;
102118

@@ -710,6 +726,17 @@ private static Map<String,Object> createNodeProperties( int nodeIndex )
710726
result.put( "long-indices", nCopies( 10, (long) nodeIndex ) );
711727
result.put( "double-indices", nCopies( 10, (double) nodeIndex ) );
712728
result.put( "booleans", nCopies( 10, nodeIndex % 2 == 0 ) );
729+
730+
if ( EXTENDED_TYPES_ENABLED )
731+
{
732+
result.put( "cartPoint", POINT );
733+
result.put( "localDateTime", LOCAL_DATE_TIME );
734+
result.put( "zonedDateTime", ZONED_DATE_TIME );
735+
result.put( "localTime", LOCAL_TIME );
736+
result.put( "date", DATE );
737+
result.put( "duration", DURATION );
738+
}
739+
713740
return result;
714741
}
715742

@@ -721,6 +748,16 @@ private static void verifyNodeProperties( Node node )
721748
assertEquals( nCopies( 10, (long) nodeIndex ), node.get( "long-indices" ).asList() );
722749
assertEquals( nCopies( 10, (double) nodeIndex ), node.get( "double-indices" ).asList() );
723750
assertEquals( nCopies( 10, nodeIndex % 2 == 0 ), node.get( "booleans" ).asList() );
751+
752+
if ( EXTENDED_TYPES_ENABLED )
753+
{
754+
assertEquals( POINT, node.get( "cartPoint" ).asPoint() );
755+
assertEquals( LOCAL_DATE_TIME, node.get( "localDateTime" ).asLocalDateTime() );
756+
assertEquals( ZONED_DATE_TIME, node.get( "zonedDateTime" ).asZonedDateTime() );
757+
assertEquals( LOCAL_TIME, node.get( "localTime" ).asLocalTime() );
758+
assertEquals( DATE, node.get( "date" ).asLocalDate() );
759+
assertEquals( new InternalIsoDuration( DURATION ), node.get( "duration" ).asIsoDuration() );
760+
}
724761
}
725762

726763
private static <T> CompletionStage<T> safeCloseSession( AsyncSession session, T result )

0 commit comments

Comments
 (0)