Skip to content

Commit

Permalink
Fixing up after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
jimwebber committed Feb 8, 2017
1 parent 9c448c5 commit 944f672
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
Expand Up @@ -50,7 +50,10 @@ public static CoreAddresses adressesForCore( int id )


public static ReadReplicaAddresses addressesForReadReplica( int id ) public static ReadReplicaAddresses addressesForReadReplica( int id )
{ {
AdvertisedSocketAddress boltServerAddress = new AdvertisedSocketAddress( "localhost", (6000 + id) ); AdvertisedSocketAddress advertisedSocketAddress = new AdvertisedSocketAddress( "localhost", (6000 + id) );
return new ReadReplicaAddresses( wrapAsClientConnectorAddresses( boltServerAddress ) ); ClientConnectorAddresses clientConnectorAddresses = new ClientConnectorAddresses(
singletonList( new ClientConnectorAddresses.ConnectorUri( bolt, advertisedSocketAddress ) ) );

return new ReadReplicaAddresses( clientConnectorAddresses, advertisedSocketAddress );
} }
} }
Expand Up @@ -19,15 +19,14 @@
*/ */
package org.neo4j.causalclustering.discovery.procedures; package org.neo4j.causalclustering.discovery.procedures;


import org.hamcrest.collection.IsIterableContainingInOrder;
import org.junit.Test;

import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.UUID; import java.util.UUID;


import org.hamcrest.collection.IsIterableContainingInOrder;
import org.junit.Test;

import org.neo4j.causalclustering.core.consensus.LeaderLocator; import org.neo4j.causalclustering.core.consensus.LeaderLocator;
import org.neo4j.causalclustering.discovery.CoreAddresses; import org.neo4j.causalclustering.discovery.CoreAddresses;
import org.neo4j.causalclustering.discovery.CoreTopology; import org.neo4j.causalclustering.discovery.CoreTopology;
Expand All @@ -40,9 +39,8 @@
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;

import static org.neo4j.causalclustering.discovery.TestTopology.addressesForReadReplicas;
import static org.neo4j.causalclustering.discovery.TestTopology.adressesForCore; import static org.neo4j.causalclustering.discovery.TestTopology.adressesForCore;
import static org.neo4j.causalclustering.load_balancing.procedure.GetServersProcedureV1Test.addresses;
import static org.neo4j.helpers.collection.Iterators.asList; import static org.neo4j.helpers.collection.Iterators.asList;


public class ClusterOverviewProcedureTest public class ClusterOverviewProcedureTest
Expand Down
Expand Up @@ -370,22 +370,15 @@ private ClusterView run( GetServersProcedureV1 proc ) throws ProcedureException
return ClusterView.parse( (List<Map<String,Object>>) rows[1] ); return ClusterView.parse( (List<Map<String,Object>>) rows[1] );
} }


static Map<MemberId,ReadReplicaAddresses> addresses( int... ids ) public static Map<MemberId,ReadReplicaAddresses> addresses( int... ids )
{ {
return Arrays.stream( ids ).mapToObj( GetServersProcedureV1Test::readReplicaAddresses ).collect( Collectors return Arrays.stream( ids ).mapToObj( GetServersProcedureV1Test::readReplicaAddresses ).collect( Collectors
.toMap( (p) -> new MemberId( UUID.randomUUID() ), Function.identity() ) ); .toMap( (p) -> new MemberId( UUID.randomUUID() ), Function.identity() ) );
} }


static CoreAddresses coreAddresses( int id )
{
AdvertisedSocketAddress advertisedSocketAddress = new AdvertisedSocketAddress( "localhost", (3000 + id) );
return new CoreAddresses( advertisedSocketAddress, advertisedSocketAddress,
new ClientConnectorAddresses( singletonList( new ClientConnectorAddresses.ConnectorUri( bolt, advertisedSocketAddress ) ) ) );
}

private static ReadReplicaAddresses readReplicaAddresses( int id ) private static ReadReplicaAddresses readReplicaAddresses( int id )
{ {
AdvertisedSocketAddress advertisedSocketAddress = new AdvertisedSocketAddress( "localhost", (3000 + id) ); AdvertisedSocketAddress advertisedSocketAddress = new AdvertisedSocketAddress( "localhost", (6000 + id) );
return new ReadReplicaAddresses( return new ReadReplicaAddresses(
new ClientConnectorAddresses( singletonList( new ClientConnectorAddresses.ConnectorUri( bolt, advertisedSocketAddress ) ) ), new ClientConnectorAddresses( singletonList( new ClientConnectorAddresses.ConnectorUri( bolt, advertisedSocketAddress ) ) ),
new AdvertisedSocketAddress( "localhost", 4000 + id )); new AdvertisedSocketAddress( "localhost", 4000 + id ));
Expand Down

0 comments on commit 944f672

Please sign in to comment.