Skip to content

Conversation

@zhenlineo
Copy link
Contributor

No description provided.

@zhenlineo zhenlineo force-pushed the 1.1-fix-routing branch 2 times, most recently from 2a9469a to a332bdf Compare January 30, 2017 15:49
Copy link
Contributor

@lutovich lutovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhenlineo review round completed. Made some comments.

this.routers.addAll( routers );
}

public boolean isValid()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can name this method #hasWriters() to be less ambiguous?

return !routers.isEmpty() && !writers.isEmpty();
return !writers.isEmpty();
}
public boolean isIllegalResponse()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd vote for #hasRoutersAndReaders() name to be more explicit

}
try

final ClusterComposition result;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declaration can be joined with the assignment

{
GetClusterCompositionResponse getClusterComposition( Connection connection );

class Default implements ClusterCompositionProvider
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this implementation to a separate file, I think it deserves this :)

*/
public class ProtocolException extends Neo4jException
{
private static String CODE = "Protocol violation: ";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Field should be final


import static java.util.Arrays.asList;

public class ClusterCompositionUtil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is probably good to make this class final and add a private constructor

events.registerHandler( StubConnectionPool.EventSink.class, new StubConnectionPool.EventSink.Adapter()
{
// given & when
final AtomicInteger ensureRoutingCounter = new AtomicInteger( 0 );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about using Mockito#spy() instead of atomic integers and runnables? Invocations could then be verified as with regular mockito mocks.

public class RediscoveryTest
{

private static GetClusterCompositionResponse.Success Success( ClusterComposition cluster )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Methods Success\Failure should be named success\failure. Would it be valuable to move them to GetClusterCompositionResponse?

import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably not use this exception. Prefer java.lang.UnsupportedOperationException

public void removeRouter( BoltServerAddress toRemove )
{
removedRouters.add( toRemove );
// throw new UnsupportedOperationException( "Should never remove any router from routing table" );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this comment be removed?

Copy link
Contributor

@lutovich lutovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhenlineo changes look good. Made couple minor comments about naming.


import static java.lang.String.format;

public class GetServersProcedureClusterCompositionProvider implements ClusterCompositionProvider
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about ClusterCompositionProviderImpl name for this class?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this long name better, as it allows us to have other providers such as FileClusterCompositionProvider or GetServers2ProcedureClusterCompositionProvider

{

private static GetClusterCompositionResponse.Success Success( ClusterComposition cluster )
private static ClusterCompositionResponse.Success Success( ClusterComposition cluster )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method should be named success

}

private static GetClusterCompositionResponse.Failure Failure( RuntimeException e )
private static ClusterCompositionResponse.Failure Failure( RuntimeException e )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method should be named failure

@lutovich lutovich merged commit 5d0403a into neo4j:1.1 Feb 3, 2017
@lutovich lutovich deleted the 1.1-fix-routing branch February 3, 2017 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants