use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class UnregisterInterestDUnitTest method createClientCache.
public static void createClientCache(Host host, Integer port) throws Exception {
DistributedSystem ds = new UnregisterInterestDUnitTest().getSystem();
ds.disconnect();
Properties props = new Properties();
props.setProperty(LOCATORS, "");
props.setProperty(MCAST_PORT, "0");
ClientCacheFactory ccf = new ClientCacheFactory(props);
ccf.setPoolSubscriptionEnabled(true);
ccf.addPoolServer(host.getHostName(), port);
cache = ccf.create();
ClientRegionFactory crf = ((GemFireCacheImpl) cache).createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY);
crf.create(regionname);
}
use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class RegisterInterestBeforeRegionCreationDUnitTest method createCache.
private void createCache(Properties props) throws Exception {
DistributedSystem ds = getSystem(props);
assertNotNull(ds);
ds.disconnect();
ds = getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
}
use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class ReliableMessagingDUnitTest method createCache.
private Cache createCache(Properties props) throws Exception {
DistributedSystem ds = getSystem(props);
ds.disconnect();
ds = getSystem(props);
Cache result = null;
result = CacheFactory.create(ds);
if (result == null) {
throw new Exception("CacheFactory.create() returned null ");
}
return result;
}
use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class GfshCommandJUnitTest method testGetMemberWithMatchingMemberId.
@Test
public void testGetMemberWithMatchingMemberId() {
final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
final DistributedSystem mockDistributedSystem = mockContext.mock(DistributedSystem.class, "DistributedSystem");
final DistributedMember mockMemberSelf = createMockMember("S", "Self");
final DistributedMember mockMemberOne = createMockMember("1", "One");
final DistributedMember mockMemberTwo = createMockMember("2", "Two");
mockContext.checking(new Expectations() {
{
oneOf(mockCache).getMembers();
will(returnValue(CollectionUtils.asSet(mockMemberOne, mockMemberTwo)));
oneOf(mockCache).getDistributedSystem();
will(returnValue(mockDistributedSystem));
oneOf(mockDistributedSystem).getDistributedMember();
will(returnValue(mockMemberSelf));
}
});
final GfshCommand commands = createAbstractCommandsSupport(mockCache);
assertSame(mockMemberTwo, commands.getMember(mockCache, "2"));
}
use of org.apache.geode.distributed.DistributedSystem in project geode by apache.
the class GfshCommandJUnitTest method testGetMemberWithMatchingMemberNameCaseInsensitive.
@Test
public void testGetMemberWithMatchingMemberNameCaseInsensitive() {
final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
final DistributedSystem mockDistributedSystem = mockContext.mock(DistributedSystem.class, "DistributedSystem");
final DistributedMember mockMemberSelf = createMockMember("S", "Self");
final DistributedMember mockMemberOne = createMockMember("1", "One");
final DistributedMember mockMemberTwo = createMockMember("2", "Two");
mockContext.checking(new Expectations() {
{
oneOf(mockCache).getMembers();
will(returnValue(CollectionUtils.asSet(mockMemberOne, mockMemberTwo)));
oneOf(mockCache).getDistributedSystem();
will(returnValue(mockDistributedSystem));
oneOf(mockDistributedSystem).getDistributedMember();
will(returnValue(mockMemberSelf));
}
});
final GfshCommand commands = createAbstractCommandsSupport(mockCache);
assertSame(mockMemberSelf, commands.getMember(mockCache, "self"));
}
Aggregations