Skip to content

Commit 0360809

Browse files
author
Zhen
committed
Made all test that requires boltkit into classes ended with BoltKitTest.java
Do not run this test by default Could run by `mvn -Dtest=*BoltKitTest test`
1 parent a4d3bb7 commit 0360809

File tree

7 files changed

+123
-93
lines changed

7 files changed

+123
-93
lines changed

driver/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,16 @@
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.1</version>
161+
<configuration>
162+
<excludes>
163+
<exclude>**/*BoltKitTest.java</exclude>
164+
</excludes>
165+
</configuration>
166+
</plugin>
157167
<plugin>
158168
<groupId>org.apache.maven.plugins</groupId>
159169
<artifactId>maven-failsafe-plugin</artifactId>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
20+
package org.neo4j.driver.internal;
21+
22+
import java.io.IOException;
23+
import java.net.URI;
24+
25+
import org.neo4j.driver.v1.Driver;
26+
import org.neo4j.driver.v1.GraphDatabase;
27+
import org.neo4j.driver.v1.Record;
28+
import org.neo4j.driver.v1.Session;
29+
import org.neo4j.driver.v1.util.StubServer;
30+
31+
import static org.hamcrest.core.IsEqual.equalTo;
32+
import static org.junit.Assert.assertThat;
33+
import static org.neo4j.driver.v1.Values.parameters;
34+
35+
public class DirectDriverBoltKitTest
36+
{
37+
public void shouldBeAbleRunCypher() throws StubServer.ForceKilled, InterruptedException, IOException
38+
{
39+
// Given
40+
StubServer server = StubServer.start( "return_x.script", 9001 );
41+
URI uri = URI.create( "bolt://127.0.0.1:9001" );
42+
int x;
43+
44+
// When
45+
try ( Driver driver = GraphDatabase.driver( uri ) )
46+
{
47+
try ( Session session = driver.session() )
48+
{
49+
Record record = session.run( "RETURN {x}", parameters( "x", 1 ) ).single();
50+
x = record.get( 0 ).asInt();
51+
}
52+
}
53+
54+
// Then
55+
assertThat( x, equalTo( 1 ) );
56+
57+
// Finally
58+
assertThat( server.exitStatus(), equalTo( 0 ) );
59+
}
60+
}

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

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

2020
package org.neo4j.driver.internal;
2121

22-
import org.junit.Ignore;
2322
import org.junit.Test;
2423

25-
import java.io.IOException;
2624
import java.net.URI;
2725

2826
import org.neo4j.driver.internal.net.BoltServerAddress;
29-
import org.neo4j.driver.v1.Driver;
3027
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;
3428

3529
import static org.hamcrest.core.IsEqual.equalTo;
3630
import static org.junit.Assert.assertThat;
37-
import static org.neo4j.driver.v1.Values.parameters;
3831

3932
public class DirectDriverTest
4033
{
@@ -67,30 +60,4 @@ public void shouldRegisterSingleServer()
6760
assertThat( driverAddress, equalTo( address ));
6861

6962
}
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-
}
63+
}

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

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

21-
import gherkin.lexer.Tr;
22-
import org.junit.Ignore;
2321
import org.junit.Rule;
2422
import org.junit.Test;
2523
import org.junit.rules.ExpectedException;
@@ -45,7 +43,6 @@
4543
import org.neo4j.driver.v1.Record;
4644
import org.neo4j.driver.v1.Session;
4745
import org.neo4j.driver.v1.Transaction;
48-
import org.neo4j.driver.v1.exceptions.ConnectionFailureException;
4946
import org.neo4j.driver.v1.exceptions.ServiceUnavailableException;
5047
import org.neo4j.driver.v1.exceptions.SessionExpiredException;
5148
import org.neo4j.driver.v1.util.Function;
@@ -63,8 +60,7 @@
6360
import static org.junit.Assert.assertTrue;
6461
import static org.junit.Assert.fail;
6562

66-
@Ignore
67-
public class RoutingDriverStubTest
63+
public class RoutingDriverBoltKitTest
6864
{
6965
@Rule
7066
public ExpectedException exception = ExpectedException.none();

driver/src/test/java/org/neo4j/driver/internal/net/pooling/SocketConnectionPoolTest.java

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
20+
package org.neo4j.driver.v1;
21+
22+
import java.io.IOException;
23+
import java.net.URI;
24+
25+
import org.neo4j.driver.internal.RoutingDriver;
26+
import org.neo4j.driver.v1.util.StubServer;
27+
28+
import static org.hamcrest.core.IsEqual.equalTo;
29+
import static org.hamcrest.core.IsInstanceOf.instanceOf;
30+
import static org.junit.Assert.assertThat;
31+
32+
public class GraphDatabaseBoltKitTest
33+
{
34+
public void boltPlusDiscoverySchemeShouldInstantiateClusterDriver() throws IOException, InterruptedException, StubServer.ForceKilled
35+
{
36+
// Given
37+
StubServer server = StubServer.start( "discover_servers.script", 9001 );
38+
URI uri = URI.create( "bolt+routing://127.0.0.1:9001" );
39+
40+
// When
41+
Driver driver = GraphDatabase.driver( uri );
42+
43+
// Then
44+
assertThat( driver, instanceOf( RoutingDriver.class ) );
45+
46+
// Finally
47+
driver.close();
48+
assertThat( server.exitStatus(), equalTo( 0 ) );
49+
}
50+
}

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

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

2020
package org.neo4j.driver.v1;
2121

22-
import org.junit.Ignore;
2322
import org.junit.Test;
2423

25-
import java.io.IOException;
2624
import java.net.URI;
2725

2826
import org.neo4j.driver.internal.DirectDriver;
29-
import org.neo4j.driver.internal.RoutingDriver;
30-
import org.neo4j.driver.v1.util.StubServer;
3127

32-
import static org.hamcrest.core.IsEqual.equalTo;
3328
import static org.hamcrest.core.IsInstanceOf.instanceOf;
3429
import static org.junit.Assert.assertThat;
3530

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

5045
}
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-
}
46+
}

0 commit comments

Comments
 (0)