Skip to content

Commit 0c1f5cf

Browse files
author
Zhen Li
authored
Revert "Enable test that requires boltkit"
1 parent d14308e commit 0c1f5cf

File tree

10 files changed

+97
-142
lines changed

10 files changed

+97
-142
lines changed

driver/pom.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,6 @@
154154
</archive>
155155
</configuration>
156156
</plugin>
157-
<plugin>
158-
<groupId>org.apache.maven.plugins</groupId>
159-
<artifactId>maven-surefire-plugin</artifactId>
160-
<version>2.19</version>
161-
<configuration>
162-
<excludes>
163-
<exclude>**/*BoltKitTest.java</exclude>
164-
</excludes>
165-
</configuration>
166-
</plugin>
167157
<plugin>
168158
<groupId>org.apache.maven.plugins</groupId>
169159
<artifactId>maven-failsafe-plugin</artifactId>

driver/src/test/java/org/neo4j/driver/internal/DirectDriverBoltKitTest.java

Lines changed: 0 additions & 62 deletions
This file was deleted.

driver/src/test/java/org/neo4j/driver/internal/DirectDriverTest.java

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,22 @@
1919

2020
package org.neo4j.driver.internal;
2121

22+
import org.junit.Ignore;
2223
import org.junit.Test;
2324

25+
import java.io.IOException;
2426
import java.net.URI;
2527

2628
import org.neo4j.driver.internal.net.BoltServerAddress;
29+
import org.neo4j.driver.v1.Driver;
2730
import org.neo4j.driver.v1.GraphDatabase;
31+
import org.neo4j.driver.v1.Record;
32+
import org.neo4j.driver.v1.Session;
33+
import org.neo4j.driver.v1.util.StubServer;
2834

2935
import static org.hamcrest.core.IsEqual.equalTo;
3036
import static org.junit.Assert.assertThat;
37+
import static org.neo4j.driver.v1.Values.parameters;
3138

3239
public class DirectDriverTest
3340
{
@@ -60,4 +67,30 @@ public void shouldRegisterSingleServer()
6067
assertThat( driverAddress, equalTo( address ));
6168

6269
}
63-
}
70+
71+
@Ignore
72+
public void shouldBeAbleRunCypher() throws StubServer.ForceKilled, InterruptedException, IOException
73+
{
74+
// Given
75+
StubServer server = StubServer.start( "return_x.script", 9001 );
76+
URI uri = URI.create( "bolt://127.0.0.1:9001" );
77+
int x;
78+
79+
// When
80+
try ( Driver driver = GraphDatabase.driver( uri ) )
81+
{
82+
try ( Session session = driver.session() )
83+
{
84+
Record record = session.run( "RETURN {x}", parameters( "x", 1 ) ).single();
85+
x = record.get( 0 ).asInt();
86+
}
87+
}
88+
89+
// Then
90+
assertThat( x, equalTo( 1 ) );
91+
92+
// Finally
93+
assertThat( server.exitStatus(), equalTo( 0 ) );
94+
}
95+
96+
}

driver/src/test/java/org/neo4j/driver/internal/RoutingDriverBoltKitTest.java renamed to driver/src/test/java/org/neo4j/driver/internal/RoutingDriverStubTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
package org.neo4j.driver.internal;
2020

21+
import gherkin.lexer.Tr;
22+
import org.junit.Ignore;
2123
import org.junit.Rule;
2224
import org.junit.Test;
2325
import org.junit.rules.ExpectedException;
@@ -43,6 +45,7 @@
4345
import org.neo4j.driver.v1.Record;
4446
import org.neo4j.driver.v1.Session;
4547
import org.neo4j.driver.v1.Transaction;
48+
import org.neo4j.driver.v1.exceptions.ConnectionFailureException;
4649
import org.neo4j.driver.v1.exceptions.ServiceUnavailableException;
4750
import org.neo4j.driver.v1.exceptions.SessionExpiredException;
4851
import org.neo4j.driver.v1.util.Function;
@@ -60,7 +63,8 @@
6063
import static org.junit.Assert.assertTrue;
6164
import static org.junit.Assert.fail;
6265

63-
public class RoutingDriverBoltKitTest
66+
@Ignore
67+
public class RoutingDriverStubTest
6468
{
6569
@Rule
6670
public ExpectedException exception = ExpectedException.none();
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Copyright (c) 2002-2016 "Neo Technology,"
3+
* Network Engine for Objects in Lund AB [http://neotechnology.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
package org.neo4j.driver.internal.net.pooling;
20+
21+
import org.junit.Ignore;
22+
23+
@Ignore
24+
public class SocketConnectionPoolTest
25+
{
26+
27+
// TODO: write some tests that actually test something
28+
29+
}

driver/src/test/java/org/neo4j/driver/v1/GraphDatabaseBoltKitTest.java

Lines changed: 0 additions & 52 deletions
This file was deleted.

driver/src/test/java/org/neo4j/driver/v1/GraphDatabaseTest.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,17 @@
1919

2020
package org.neo4j.driver.v1;
2121

22+
import org.junit.Ignore;
2223
import org.junit.Test;
2324

25+
import java.io.IOException;
2426
import java.net.URI;
2527

2628
import org.neo4j.driver.internal.DirectDriver;
29+
import org.neo4j.driver.internal.RoutingDriver;
30+
import org.neo4j.driver.v1.util.StubServer;
2731

32+
import static org.hamcrest.core.IsEqual.equalTo;
2833
import static org.hamcrest.core.IsInstanceOf.instanceOf;
2934
import static org.junit.Assert.assertThat;
3035

@@ -43,4 +48,23 @@ public void boltSchemeShouldInstantiateDirectDriver()
4348
assertThat( driver, instanceOf( DirectDriver.class ) );
4449

4550
}
46-
}
51+
52+
@Ignore
53+
public void boltPlusDiscoverySchemeShouldInstantiateClusterDriver() throws IOException, InterruptedException, StubServer.ForceKilled
54+
{
55+
// Given
56+
StubServer server = StubServer.start( "discover_servers.script", 9001 );
57+
URI uri = URI.create( "bolt+routing://127.0.0.1:9001" );
58+
59+
// When
60+
Driver driver = GraphDatabase.driver( uri );
61+
62+
// Then
63+
assertThat( driver, instanceOf( RoutingDriver.class ) );
64+
65+
// Finally
66+
driver.close();
67+
assertThat( server.exitStatus(), equalTo( 0 ) );
68+
}
69+
70+
}

driver/src/test/java/org/neo4j/driver/v1/util/StubServer.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
package org.neo4j.driver.v1.util;
2121

2222
import java.io.IOException;
23-
import java.net.URISyntaxException;
2423
import java.net.URL;
25-
import java.nio.file.Paths;
2624
import java.util.ArrayList;
2725
import java.util.List;
2826

@@ -41,7 +39,7 @@ public static class ForceKilled extends Exception {}
4139
private StubServer( String script, int port ) throws IOException, InterruptedException
4240
{
4341
List<String> command = new ArrayList<>();
44-
command.addAll( singletonList( "boltstub" ) );
42+
command.addAll( singletonList( "/usr/local/bin/boltstub" ) );
4543
command.addAll( asList( Integer.toString( port ), script ) );
4644
ProcessBuilder server = new ProcessBuilder().inheritIO().command( command );
4745
process = server.start();
@@ -76,14 +74,6 @@ private static String resource( String fileName )
7674
{
7775
fail( fileName + " does not exists" );
7876
}
79-
try
80-
{
81-
return Paths.get( resource.toURI() ).toFile().getCanonicalPath();
82-
}
83-
catch ( Throwable e )
84-
{
85-
fail( e.toString() );
86-
throw new RuntimeException( e );
87-
}
77+
return resource.getFile();
8878
}
8979
}

driver/src/test/resources/acquire_endpoints.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ C: RUN "CALL dbms.cluster.routing.getServers" {}
77
PULL_ALL
88
S: SUCCESS {"fields": ["ttl", "servers"]}
99
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9007","127.0.0.1:9008"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9005","127.0.0.1:9006"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002","127.0.0.1:9003"], "role": "ROUTE"}]]
10-
SUCCESS {}
10+
SUCCESS {}

driver/src/test/resources/write_server.script

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
!: AUTO PULL_ALL
55
!: AUTO RUN "ROLLBACK" {}
66
!: AUTO RUN "BEGIN" {}
7-
!: AUTO RUN "COMMIT" {}
87

98
C: RUN "CREATE (n {name:'Bob'})" {}
109
PULL_ALL
1110
S: SUCCESS {}
12-
SUCCESS {}
11+
SUCCESS {}

0 commit comments

Comments
 (0)