28
28
import java .lang .management .OperatingSystemMXBean ;
29
29
import java .lang .reflect .Method ;
30
30
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 ;
31
36
import java .util .ArrayList ;
32
37
import java .util .Collections ;
33
38
import java .util .HashMap ;
64
69
import org .neo4j .driver .async .AsyncTransaction ;
65
70
import org .neo4j .driver .async .ResultCursor ;
66
71
import org .neo4j .driver .internal .InternalDriver ;
72
+ import org .neo4j .driver .internal .InternalIsoDuration ;
67
73
import org .neo4j .driver .internal .logging .DevNullLogger ;
68
74
import org .neo4j .driver .internal .util .Futures ;
69
75
import org .neo4j .driver .internal .util .Iterables ;
70
76
import org .neo4j .driver .reactive .RxSession ;
71
77
import org .neo4j .driver .reactive .RxTransaction ;
72
78
import org .neo4j .driver .types .Node ;
79
+ import org .neo4j .driver .types .Point ;
73
80
import org .neo4j .driver .util .DaemonThreadFactory ;
74
81
75
82
import static java .util .Collections .nCopies ;
86
93
import static org .junit .jupiter .api .Assertions .assertTrue ;
87
94
import static org .junit .jupiter .api .Assumptions .assumeTrue ;
88
95
import static org .neo4j .driver .SessionConfig .builder ;
96
+ import static org .neo4j .driver .Values .point ;
89
97
90
98
abstract class AbstractStressTestBase <C extends AbstractContext >
91
99
{
92
100
private static final int THREAD_COUNT = Integer .getInteger ( "threadCount" , 8 );
93
101
private static final int ASYNC_BATCH_SIZE = Integer .getInteger ( "asyncBatchSize" , 10 );
94
102
private static final int EXECUTION_TIME_SECONDS = Integer .getInteger ( "executionTimeSeconds" , 20 );
95
103
private static final boolean DEBUG_LOGGING_ENABLED = Boolean .getBoolean ( "loggingEnabled" );
104
+ private static final boolean EXTENDED_TYPES_ENABLED = Boolean .getBoolean ( "extendedTypesEnabled" );
96
105
97
106
private static final int BIG_DATA_TEST_NODE_COUNT = Integer .getInteger ( "bigDataTestNodeCount" , 30_000 );
98
107
private static final int BIG_DATA_TEST_BATCH_SIZE = Integer .getInteger ( "bigDataTestBatchSize" , 10_000 );
99
108
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
+
100
116
private LoggerNameTrackingLogging logging ;
101
117
private ExecutorService executor ;
102
118
@@ -710,6 +726,17 @@ private static Map<String,Object> createNodeProperties( int nodeIndex )
710
726
result .put ( "long-indices" , nCopies ( 10 , (long ) nodeIndex ) );
711
727
result .put ( "double-indices" , nCopies ( 10 , (double ) nodeIndex ) );
712
728
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
+
713
740
return result ;
714
741
}
715
742
@@ -721,6 +748,16 @@ private static void verifyNodeProperties( Node node )
721
748
assertEquals ( nCopies ( 10 , (long ) nodeIndex ), node .get ( "long-indices" ).asList () );
722
749
assertEquals ( nCopies ( 10 , (double ) nodeIndex ), node .get ( "double-indices" ).asList () );
723
750
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
+ }
724
761
}
725
762
726
763
private static <T > CompletionStage <T > safeCloseSession ( AsyncSession session , T result )
0 commit comments