Search in sources :

Example 1 with CacheOperationMessage

use of org.apache.geode.internal.cache.DistributedCacheOperation.CacheOperationMessage in project geode by apache.

the class CacheOperationMessageTest method shouldBeMockable.

@Test
public void shouldBeMockable() throws Exception {
    CacheOperationMessage mockCacheOperationMessage = mock(CacheOperationMessage.class);
    DistributionManager mockDistributionManager = mock(DistributionManager.class);
    when(mockCacheOperationMessage.supportsDirectAck()).thenReturn(true);
    when(mockCacheOperationMessage._mayAddToMultipleSerialGateways(eq(mockDistributionManager))).thenReturn(true);
    mockCacheOperationMessage.process(mockDistributionManager);
    verify(mockCacheOperationMessage, times(1)).process(mockDistributionManager);
    assertThat(mockCacheOperationMessage.supportsDirectAck()).isTrue();
    assertThat(mockCacheOperationMessage._mayAddToMultipleSerialGateways(mockDistributionManager)).isTrue();
}
Also used : CacheOperationMessage(org.apache.geode.internal.cache.DistributedCacheOperation.CacheOperationMessage) DistributionManager(org.apache.geode.distributed.internal.DistributionManager) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Example 2 with CacheOperationMessage

use of org.apache.geode.internal.cache.DistributedCacheOperation.CacheOperationMessage in project geode by apache.

the class DistributedCacheOperationTest method shouldBeMockable.

@Test
public void shouldBeMockable() throws Exception {
    DistributedCacheOperation mockDistributedCacheOperation = mock(DistributedCacheOperation.class);
    CacheOperationMessage mockCacheOperationMessage = mock(CacheOperationMessage.class);
    Map<InternalDistributedMember, PersistentMemberID> persistentIds = new HashMap<>();
    when(mockDistributedCacheOperation.supportsDirectAck()).thenReturn(false);
    mockDistributedCacheOperation.waitForAckIfNeeded(mockCacheOperationMessage, persistentIds);
    verify(mockDistributedCacheOperation, times(1)).waitForAckIfNeeded(mockCacheOperationMessage, persistentIds);
    assertThat(mockDistributedCacheOperation.supportsDirectAck()).isFalse();
}
Also used : CacheOperationMessage(org.apache.geode.internal.cache.DistributedCacheOperation.CacheOperationMessage) InternalDistributedMember(org.apache.geode.distributed.internal.membership.InternalDistributedMember) HashMap(java.util.HashMap) PersistentMemberID(org.apache.geode.internal.cache.persistence.PersistentMemberID) Test(org.junit.Test) UnitTest(org.apache.geode.test.junit.categories.UnitTest)

Aggregations

CacheOperationMessage (org.apache.geode.internal.cache.DistributedCacheOperation.CacheOperationMessage)2 UnitTest (org.apache.geode.test.junit.categories.UnitTest)2 Test (org.junit.Test)2 HashMap (java.util.HashMap)1 DistributionManager (org.apache.geode.distributed.internal.DistributionManager)1 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)1 PersistentMemberID (org.apache.geode.internal.cache.persistence.PersistentMemberID)1