Search in sources :

Example 6 with FindCoordinatorRequest

use of org.apache.geode.distributed.internal.membership.gms.locator.FindCoordinatorRequest in project geode by apache.

the class GMSJoinLeaveJUnitTest method testCoordinatorFindRequestSuccess.

@Test
public void testCoordinatorFindRequestSuccess() throws Exception {
    try {
        initMocks(false);
        HashSet<InternalDistributedMember> registrants = new HashSet<>();
        registrants.add(mockMembers[0]);
        FindCoordinatorResponse fcr = new FindCoordinatorResponse(mockMembers[0], mockMembers[0], false, null, registrants, false, true, null);
        NetView view = createView();
        JoinResponseMessage jrm = new JoinResponseMessage(mockMembers[0], view, 0);
        TcpClientWrapper tcpClientWrapper = mock(TcpClientWrapper.class);
        gmsJoinLeave.setTcpClientWrapper(tcpClientWrapper);
        FindCoordinatorRequest fcreq = new FindCoordinatorRequest(gmsJoinLeaveMemberId, new HashSet<>(), -1, null, 0, "");
        int connectTimeout = (int) services.getConfig().getMemberTimeout() * 2;
        when(tcpClientWrapper.sendCoordinatorFindRequest(new InetSocketAddress("localhost", 12345), fcreq, connectTimeout)).thenReturn(fcr);
        callAsnyc(() -> {
            gmsJoinLeave.installView(view);
        });
        assertTrue("Should be able to join ", gmsJoinLeave.join());
    } finally {
    }
}
Also used : TcpClientWrapper(org.apache.geode.distributed.internal.membership.gms.membership.GMSJoinLeave.TcpClientWrapper) InternalDistributedMember(org.apache.geode.distributed.internal.membership.InternalDistributedMember) FindCoordinatorResponse(org.apache.geode.distributed.internal.membership.gms.locator.FindCoordinatorResponse) FindCoordinatorRequest(org.apache.geode.distributed.internal.membership.gms.locator.FindCoordinatorRequest) InetSocketAddress(java.net.InetSocketAddress) NetView(org.apache.geode.distributed.internal.membership.NetView) JoinResponseMessage(org.apache.geode.distributed.internal.membership.gms.messages.JoinResponseMessage) HashSet(java.util.HashSet) Test(org.junit.Test) MembershipTest(org.apache.geode.test.junit.categories.MembershipTest) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Aggregations

InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)6 FindCoordinatorRequest (org.apache.geode.distributed.internal.membership.gms.locator.FindCoordinatorRequest)6 HashSet (java.util.HashSet)5 NetView (org.apache.geode.distributed.internal.membership.NetView)5 FindCoordinatorResponse (org.apache.geode.distributed.internal.membership.gms.locator.FindCoordinatorResponse)5 MembershipTest (org.apache.geode.test.junit.categories.MembershipTest)4 Test (org.junit.Test)4 InetSocketAddress (java.net.InetSocketAddress)3 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)3 IOException (java.io.IOException)2 Properties (java.util.Properties)2 ConfigurationProperties (org.apache.geode.distributed.ConfigurationProperties)2 TcpClientWrapper (org.apache.geode.distributed.internal.membership.gms.membership.GMSJoinLeave.TcpClientWrapper)2 JoinResponseMessage (org.apache.geode.distributed.internal.membership.gms.messages.JoinResponseMessage)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 DataInputStream (java.io.DataInputStream)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 GemFireConfigException (org.apache.geode.GemFireConfigException)1 CacheException (org.apache.geode.cache.CacheException)1