Skip to content

Commit

Permalink
Add java.xml.bind to a list of accessible modules
Browse files Browse the repository at this point in the history
Fix compilation errors in java 9 in several new bolt tests
  • Loading branch information
MishaDemianenko committed Mar 19, 2018
1 parent fd6ae5d commit 213fe45
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 27 deletions.
Expand Up @@ -187,7 +187,7 @@ public void describeTo( Description description )
}; };
} }


public static Matcher<ResponseMessage> msgSuccess( final Matcher<Map<? extends String,?>> matcher ) public static Matcher<ResponseMessage> msgSuccess( final Matcher<Map<String,?>> matcher )
{ {
return new TypeSafeMatcher<ResponseMessage>() return new TypeSafeMatcher<ResponseMessage>()
{ {
Expand Down
Expand Up @@ -20,11 +20,13 @@
package org.neo4j.bolt.v1.transport.integration; package org.neo4j.bolt.v1.transport.integration;


import org.hamcrest.CoreMatchers; import org.hamcrest.CoreMatchers;
import org.hamcrest.Matcher;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;


import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
Expand Down Expand Up @@ -133,22 +135,22 @@ private void init( TransportConnection client ) throws Exception
private void createAndRollback( TransportConnection client ) throws Exception private void createAndRollback( TransportConnection client ) throws Exception
{ {
client.send( createAndRollback ); client.send( createAndRollback );
Matcher<Map<? extends String,?>> entryMatcher = hasEntry( is( "fields" ), equalTo( emptyList() ) );
Matcher<Map<String,?>> messageMatcher =
CoreMatchers.allOf( entryMatcher, hasKey( "result_available_after" ) );
assertThat( client, util.eventuallyReceives( assertThat( client, util.eventuallyReceives(
msgSuccess( CoreMatchers.allOf( hasEntry( is( "fields" ), equalTo( emptyList() ) ), msgSuccess( messageMatcher ),
hasKey( "result_available_after" ) ) ),
msgSuccess(), msgSuccess(),
msgSuccess( CoreMatchers.allOf( hasEntry( is( "fields" ), equalTo( emptyList() ) ), msgSuccess( messageMatcher ),
hasKey( "result_available_after" ) ) ),
msgSuccess(), msgSuccess(),
msgSuccess( CoreMatchers.allOf( hasEntry( is( "fields" ), equalTo( emptyList() ) ), msgSuccess( messageMatcher ),
hasKey( "result_available_after" ) ) ),
msgSuccess() ) ); msgSuccess() ) );


// Verify no visible data // Verify no visible data
client.send( matchAll ); client.send( matchAll );
Matcher<Map<? extends String,?>> fieldsMatcher = hasEntry( is( "fields" ), equalTo( singletonList( "n" ) ) );
assertThat( client, util.eventuallyReceives( assertThat( client, util.eventuallyReceives(
msgSuccess(CoreMatchers.allOf( hasEntry( is( "fields" ), equalTo( singletonList( "n" ) ) ), msgSuccess(CoreMatchers.allOf( fieldsMatcher, hasKey( "result_available_after" ) ) ),
hasKey( "result_available_after" ) ) ),
msgSuccess() ) ); msgSuccess() ) );


} }
Expand Down
Expand Up @@ -20,12 +20,14 @@
package org.neo4j.bolt.v1.transport.integration; package org.neo4j.bolt.v1.transport.integration;


import org.hamcrest.CoreMatchers; import org.hamcrest.CoreMatchers;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;


import java.util.HashMap; import java.util.HashMap;
import java.util.Map;


import org.neo4j.bolt.AbstractBoltTransportsTest; import org.neo4j.bolt.AbstractBoltTransportsTest;
import org.neo4j.bolt.v1.messaging.Neo4jPackV1; import org.neo4j.bolt.v1.messaging.Neo4jPackV1;
Expand Down Expand Up @@ -110,14 +112,15 @@ public void shouldRunSimpleStatement() throws Throwable


// Then // Then
assertThat( connection, util.eventuallyReceivesSelectedProtocolVersion() ); assertThat( connection, util.eventuallyReceivesSelectedProtocolVersion() );
Matcher<Map<? extends String,?>> entryTypeMatcher = hasEntry( is( "type" ), equalTo( "r" ) );
Matcher<Map<? extends String,?>> entryFieldMatcher = hasEntry( is( "fields" ), equalTo( asList( "a", "a_squared" ) ) );
assertThat( connection, util.eventuallyReceives( assertThat( connection, util.eventuallyReceives(
msgSuccess(), msgSuccess(),
msgSuccess( CoreMatchers.allOf( hasEntry( is( "fields" ), msgSuccess( CoreMatchers.allOf( entryFieldMatcher, hasKey( "result_available_after" ) ) ),
equalTo( asList( "a", "a_squared" ) ) ), hasKey( "result_available_after" ) ) ),
msgRecord( eqRecord( equalTo( longValue( 1L ) ), equalTo( longValue( 1L ) ) ) ), msgRecord( eqRecord( equalTo( longValue( 1L ) ), equalTo( longValue( 1L ) ) ) ),
msgRecord( eqRecord( equalTo( longValue( 2L ) ), equalTo( longValue( 4L ) ) ) ), msgRecord( eqRecord( equalTo( longValue( 2L ) ), equalTo( longValue( 4L ) ) ) ),
msgRecord( eqRecord( equalTo( longValue( 3L ) ), equalTo( longValue( 9L ) ) ) ), msgRecord( eqRecord( equalTo( longValue( 3L ) ), equalTo( longValue( 9L ) ) ) ),
msgSuccess( CoreMatchers.allOf( hasEntry( is( "type" ), equalTo( "r" ) ), msgSuccess( CoreMatchers.allOf( entryTypeMatcher,
hasKey( "result_consumed_after" ) ) ) ) ); hasKey( "result_consumed_after" ) ) ) ) );
} }


Expand All @@ -134,13 +137,12 @@ public void shouldRespondWithMetadataToDiscardAll() throws Throwable


// Then // Then
assertThat( connection, util.eventuallyReceivesSelectedProtocolVersion() ); assertThat( connection, util.eventuallyReceivesSelectedProtocolVersion() );
Matcher<Map<? extends String,?>> entryFieldsMatcher = hasEntry( is( "fields" ), equalTo( asList( "a", "a_squared" ) ) );
Matcher<Map<? extends String,?>> entryTypeMatcher = hasEntry( is( "type" ), equalTo( "r" ) );
assertThat( connection, util.eventuallyReceives( assertThat( connection, util.eventuallyReceives(
msgSuccess(), msgSuccess(),
msgSuccess( msgSuccess( CoreMatchers.allOf( entryFieldsMatcher, hasKey( "result_available_after" ) ) ),
CoreMatchers.allOf( hasEntry( is( "fields" ), equalTo( asList( "a", "a_squared" ) ) ), msgSuccess( CoreMatchers.allOf( entryTypeMatcher, hasKey( "result_consumed_after" ) ) ) ) );
hasKey( "result_available_after" ) ) ),
msgSuccess( CoreMatchers.allOf( hasEntry( is( "type" ), equalTo( "r" ) ),
hasKey( "result_consumed_after" ) ) ) ) );
} }


@Test @Test
Expand Down Expand Up @@ -185,10 +187,10 @@ public void shouldRunProcedure() throws Throwable
pullAll() ) ); pullAll() ) );


assertThat( connection, util.eventuallyReceivesSelectedProtocolVersion() ); assertThat( connection, util.eventuallyReceivesSelectedProtocolVersion() );
Matcher<Map<? extends String,?>> ageMatcher = hasEntry( is( "fields" ), equalTo( singletonList( "age" ) ) );
assertThat( connection, util.eventuallyReceives( assertThat( connection, util.eventuallyReceives(
msgSuccess(), msgSuccess(),
msgSuccess( CoreMatchers.allOf( hasEntry( is( "fields" ), equalTo( singletonList( "age" ) ) ), msgSuccess( CoreMatchers.allOf( ageMatcher, hasKey( "result_available_after" ) ) ),
hasKey( "result_available_after" ) ) ),
msgRecord( eqRecord( equalTo( longValue( 2L ) ) ) ), msgRecord( eqRecord( equalTo( longValue( 2L ) ) ) ),
msgSuccess() ) ); msgSuccess() ) );


Expand All @@ -198,8 +200,9 @@ public void shouldRunProcedure() throws Throwable
pullAll() ) ); pullAll() ) );


// Then // Then
Matcher<Map<? extends String,?>> entryFieldsMatcher = hasEntry( is( "fields" ), equalTo( singletonList( "label" ) ) );
assertThat( connection, util.eventuallyReceives( assertThat( connection, util.eventuallyReceives(
msgSuccess( CoreMatchers.allOf( hasEntry( is( "fields" ), equalTo( singletonList( "label" ) ) ), msgSuccess( CoreMatchers.allOf( entryFieldsMatcher,
hasKey( "result_available_after" ) ) ), hasKey( "result_available_after" ) ) ),
msgRecord( eqRecord( Matchers.equalTo( stringValue( "Test" ) ) ) ), msgRecord( eqRecord( Matchers.equalTo( stringValue( "Test" ) ) ) ),
msgSuccess() msgSuccess()
Expand All @@ -219,9 +222,10 @@ public void shouldHandleDeletedNodes() throws Throwable


// Then // Then
assertThat( connection, util.eventuallyReceivesSelectedProtocolVersion() ); assertThat( connection, util.eventuallyReceivesSelectedProtocolVersion() );
Matcher<Map<? extends String,?>> entryFieldsMatcher = hasEntry( is( "fields" ), equalTo( singletonList( "n" ) ) );
assertThat( connection, util.eventuallyReceives( assertThat( connection, util.eventuallyReceives(
msgSuccess(), msgSuccess(),
msgSuccess( CoreMatchers.allOf( hasEntry( is( "fields" ), equalTo( singletonList( "n" ) ) ), msgSuccess( CoreMatchers.allOf( entryFieldsMatcher,
hasKey( "result_available_after" ) ) ) ) ); hasKey( "result_available_after" ) ) ) ) );


// //
Expand Down Expand Up @@ -250,9 +254,10 @@ public void shouldHandleDeletedRelationships() throws Throwable


// Then // Then
assertThat( connection, util.eventuallyReceivesSelectedProtocolVersion() ); assertThat( connection, util.eventuallyReceivesSelectedProtocolVersion() );
Matcher<Map<? extends String,?>> entryFieldsMatcher = hasEntry( is( "fields" ), equalTo( singletonList( "r" ) ) );
assertThat( connection, util.eventuallyReceives( assertThat( connection, util.eventuallyReceives(
msgSuccess(), msgSuccess(),
msgSuccess( CoreMatchers.allOf( hasEntry( is( "fields" ), equalTo( singletonList( "r" ) ) ), msgSuccess( CoreMatchers.allOf( entryFieldsMatcher,
hasKey( "result_available_after" ) ) ) ) ); hasKey( "result_available_after" ) ) ) ) );


// //
Expand Down Expand Up @@ -293,11 +298,11 @@ public void shouldNotLeakStatsToNextStatement() throws Throwable
pullAll() ) ); pullAll() ) );


// Then // Then
Matcher<Map<? extends String,?>> typeMatcher = hasEntry( is( "type" ), equalTo( "r" ) );
assertThat( connection, util.eventuallyReceives( assertThat( connection, util.eventuallyReceives(
msgSuccess(), msgSuccess(),
msgRecord( eqRecord( equalTo( longValue( 1L ) ) ) ), msgRecord( eqRecord( equalTo( longValue( 1L ) ) ) ),
msgSuccess( CoreMatchers.allOf( hasEntry( is( "type" ), equalTo( "r" ) ), msgSuccess( CoreMatchers.allOf( typeMatcher, hasKey( "result_consumed_after" ) ) ) ) );
hasKey( "result_consumed_after" ) ) ) ) );
} }


@Test @Test
Expand Down Expand Up @@ -343,10 +348,10 @@ public void shouldFailNicelyOnPointsWhenProtocolDoesNotSupportThem() throws Thro


// Then // Then
assertThat( connection, util.eventuallyReceivesSelectedProtocolVersion() ); assertThat( connection, util.eventuallyReceivesSelectedProtocolVersion() );
Matcher<Map<? extends String,?>> fieldsMatcher = hasEntry( is( "fields" ), equalTo( singletonList( "p" ) ) );
assertThat( connection, util.eventuallyReceives( assertThat( connection, util.eventuallyReceives(
msgSuccess(), msgSuccess(),
msgSuccess( CoreMatchers.allOf( hasEntry( is( "fields" ), equalTo( singletonList( "p" ) ) ), msgSuccess( CoreMatchers.allOf( fieldsMatcher, hasKey( "result_available_after" ) ) ),
hasKey( "result_available_after" ) ) ),
msgRecord( eqRecord( equalTo( NO_VALUE ) ) ), msgRecord( eqRecord( equalTo( NO_VALUE ) ) ),
msgFailure( Status.Request.Invalid, "Point is not yet supported as a return type in Bolt" ) ) ); msgFailure( Status.Request.Invalid, "Point is not yet supported as a return type in Bolt" ) ) );
} }
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -919,7 +919,7 @@
<jdk>9</jdk> <jdk>9</jdk>
</activation> </activation>
<properties> <properties>
<java9.exports>--add-exports=java.base/sun.nio.ch=ALL-UNNAMED</java9.exports> <java9.exports>--add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-modules java.xml.bind</java9.exports>
<maven.javadoc.skip>true</maven.javadoc.skip> <maven.javadoc.skip>true</maven.javadoc.skip>
<scala.java9.arg>-nobootcp</scala.java9.arg> <scala.java9.arg>-nobootcp</scala.java9.arg>
</properties> </properties>
Expand Down

0 comments on commit 213fe45

Please sign in to comment.