37
37
import org .neo4j .driver .internal .async .inbound .InboundMessageDispatcher ;
38
38
import org .neo4j .driver .internal .async .outbound .OutboundMessageHandler ;
39
39
import org .neo4j .driver .internal .messaging .v1 .MessageFormatV1 ;
40
- import org .neo4j .driver .internal .util .ServerVersion ;
41
40
42
41
import static org .junit .jupiter .api .Assertions .assertEquals ;
43
42
import static org .junit .jupiter .api .Assertions .assertFalse ;
@@ -74,7 +73,7 @@ void tearDown()
74
73
void shouldSetServerVersionOnChannel ()
75
74
{
76
75
ChannelPromise channelPromise = channel .newPromise ();
77
- HelloResponseHandler handler = new HelloResponseHandler ( channelPromise , 3 );
76
+ HelloResponseHandler handler = new HelloResponseHandler ( channelPromise );
78
77
79
78
Map <String ,Value > metadata = metadata ( anyServerVersion (), "bolt-1" );
80
79
handler .onSuccess ( metadata );
@@ -87,7 +86,7 @@ void shouldSetServerVersionOnChannel()
87
86
void shouldThrowWhenServerVersionNotReturned ()
88
87
{
89
88
ChannelPromise channelPromise = channel .newPromise ();
90
- HelloResponseHandler handler = new HelloResponseHandler ( channelPromise , 3 );
89
+ HelloResponseHandler handler = new HelloResponseHandler ( channelPromise );
91
90
92
91
Map <String ,Value > metadata = metadata ( null , "bolt-1" );
93
92
assertThrows ( UntrustedServerException .class , () -> handler .onSuccess ( metadata ) );
@@ -100,7 +99,7 @@ void shouldThrowWhenServerVersionNotReturned()
100
99
void shouldThrowWhenServerVersionIsNull ()
101
100
{
102
101
ChannelPromise channelPromise = channel .newPromise ();
103
- HelloResponseHandler handler = new HelloResponseHandler ( channelPromise , 3 );
102
+ HelloResponseHandler handler = new HelloResponseHandler ( channelPromise );
104
103
105
104
Map <String ,Value > metadata = metadata ( Values .NULL , "bolt-x" );
106
105
assertThrows ( UntrustedServerException .class , () -> handler .onSuccess ( metadata ) );
@@ -113,7 +112,7 @@ void shouldThrowWhenServerVersionIsNull()
113
112
void shouldThrowWhenServerVersionCantBeParsed ()
114
113
{
115
114
ChannelPromise channelPromise = channel .newPromise ();
116
- HelloResponseHandler handler = new HelloResponseHandler ( channelPromise , 3 );
115
+ HelloResponseHandler handler = new HelloResponseHandler ( channelPromise );
117
116
118
117
Map <String ,Value > metadata = metadata ( "WrongServerVersion" , "bolt-x" );
119
118
assertThrows ( IllegalArgumentException .class , () -> handler .onSuccess ( metadata ) );
@@ -122,25 +121,11 @@ void shouldThrowWhenServerVersionCantBeParsed()
122
121
assertTrue ( channel .closeFuture ().isDone () ); // channel was closed
123
122
}
124
123
125
- @ Test
126
- void shouldUseProtocolVersionForServerVersionWhenConnectedWithBoltV4 ()
127
- {
128
- ChannelPromise channelPromise = channel .newPromise ();
129
- HelloResponseHandler handler = new HelloResponseHandler ( channelPromise , 4 );
130
-
131
- // server used in metadata should be ignored
132
- Map <String ,Value > metadata = metadata ( ServerVersion .vInDev , "bolt-1" );
133
- handler .onSuccess ( metadata );
134
-
135
- assertTrue ( channelPromise .isSuccess () );
136
- assertEquals ( ServerVersion .v4_0_0 , serverVersion ( channel ) );
137
- }
138
-
139
124
@ Test
140
125
void shouldSetConnectionIdOnChannel ()
141
126
{
142
127
ChannelPromise channelPromise = channel .newPromise ();
143
- HelloResponseHandler handler = new HelloResponseHandler ( channelPromise , 3 );
128
+ HelloResponseHandler handler = new HelloResponseHandler ( channelPromise );
144
129
145
130
Map <String ,Value > metadata = metadata ( anyServerVersion (), "bolt-42" );
146
131
handler .onSuccess ( metadata );
@@ -153,7 +138,7 @@ void shouldSetConnectionIdOnChannel()
153
138
void shouldThrowWhenConnectionIdNotReturned ()
154
139
{
155
140
ChannelPromise channelPromise = channel .newPromise ();
156
- HelloResponseHandler handler = new HelloResponseHandler ( channelPromise , 3 );
141
+ HelloResponseHandler handler = new HelloResponseHandler ( channelPromise );
157
142
158
143
Map <String ,Value > metadata = metadata ( anyServerVersion (), null );
159
144
assertThrows ( IllegalStateException .class , () -> handler .onSuccess ( metadata ) );
@@ -166,7 +151,7 @@ void shouldThrowWhenConnectionIdNotReturned()
166
151
void shouldThrowWhenConnectionIdIsNull ()
167
152
{
168
153
ChannelPromise channelPromise = channel .newPromise ();
169
- HelloResponseHandler handler = new HelloResponseHandler ( channelPromise , 3 );
154
+ HelloResponseHandler handler = new HelloResponseHandler ( channelPromise );
170
155
171
156
Map <String ,Value > metadata = metadata ( anyServerVersion (), Values .NULL );
172
157
assertThrows ( IllegalStateException .class , () -> handler .onSuccess ( metadata ) );
@@ -179,7 +164,7 @@ void shouldThrowWhenConnectionIdIsNull()
179
164
void shouldCloseChannelOnFailure () throws Exception
180
165
{
181
166
ChannelPromise channelPromise = channel .newPromise ();
182
- HelloResponseHandler handler = new HelloResponseHandler ( channelPromise , 3 );
167
+ HelloResponseHandler handler = new HelloResponseHandler ( channelPromise );
183
168
184
169
RuntimeException error = new RuntimeException ( "Hi!" );
185
170
handler .onFailure ( error );
0 commit comments