Search in sources :

Example 31 with GemFireIOException

use of org.apache.geode.GemFireIOException in project geode by apache.

the class JGroupsMessengerJUnitTest method testWaitForMessageStateThrowsExceptionIfMessagesMissing.

@Test
public void testWaitForMessageStateThrowsExceptionIfMessagesMissing() throws Exception {
    initMocks(true);
    NAKACK2 nakack = mock(NAKACK2.class);
    Digest digest = mock(Digest.class);
    when(nakack.getDigest(any(Address.class))).thenReturn(digest);
    when(digest.get(any(Address.class))).thenReturn(new long[] { 0, 0 }, new long[] { 2, 50 }, new long[] { 49, 50 });
    try {
        // message 50 will never arrive
        Map state = new HashMap();
        state.put("JGroups.mcastState", Long.valueOf(50));
        InternalDistributedMember mbr = createAddress(1234);
        messenger.scheduledMcastSeqnos.put(mbr, new JGroupsMessenger.MessageTracker(30));
        messenger.waitForMessageState(mbr, state);
        fail("expected a GemFireIOException to be thrown");
    } catch (GemFireIOException e) {
    // pass
    }
}
Also used : NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) Address(org.jgroups.Address) InternalDistributedMember(org.apache.geode.distributed.internal.membership.InternalDistributedMember) Digest(org.jgroups.util.Digest) HashMap(java.util.HashMap) GemFireIOException(org.apache.geode.GemFireIOException) Map(java.util.Map) HashMap(java.util.HashMap) Test(org.junit.Test) MembershipTest(org.apache.geode.test.junit.categories.MembershipTest) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Aggregations

GemFireIOException (org.apache.geode.GemFireIOException)31 IOException (java.io.IOException)20 File (java.io.File)5 Test (org.junit.Test)4 InputStream (java.io.InputStream)3 Properties (java.util.Properties)3 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)3 BufferedReader (java.io.BufferedReader)2 DataOutput (java.io.DataOutput)2 FileNotFoundException (java.io.FileNotFoundException)2 FileOutputStream (java.io.FileOutputStream)2 InputStreamReader (java.io.InputStreamReader)2 PrintStream (java.io.PrintStream)2 StringReader (java.io.StringReader)2 ArrayList (java.util.ArrayList)2 SerializationException (org.apache.commons.lang.SerializationException)2 CancelException (org.apache.geode.CancelException)2 ForcedDisconnectException (org.apache.geode.ForcedDisconnectException)2 GemFireConfigException (org.apache.geode.GemFireConfigException)2 InternalGemFireException (org.apache.geode.InternalGemFireException)2