Search in sources :

Example 46 with GemFireCacheImpl

use of org.apache.geode.internal.cache.GemFireCacheImpl in project geode by apache.

the class UnregisterInterestDUnitTest method checkAllKeys.

public static void checkAllKeys(Integer value, Integer valueInv) {
    FilterProfile fp = ((GemFireCacheImpl) cache).getFilterProfile(regionname);
    assertEquals(value.intValue(), fp.getAllKeyClientsSize());
    assertEquals(valueInv.intValue(), fp.getAllKeyClientsInvSize());
}
Also used : FilterProfile(org.apache.geode.internal.cache.FilterProfile) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl)

Example 47 with GemFireCacheImpl

use of org.apache.geode.internal.cache.GemFireCacheImpl 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);
}
Also used : GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) DistributedSystem(org.apache.geode.distributed.DistributedSystem) ClientRegionFactory(org.apache.geode.cache.client.ClientRegionFactory) ClientCacheFactory(org.apache.geode.cache.client.ClientCacheFactory)

Example 48 with GemFireCacheImpl

use of org.apache.geode.internal.cache.GemFireCacheImpl in project geode by apache.

the class MBeanUtil method getLocatorMbeanProxy.

/**
   * Utility Method to obtain GatewayReceiverMXBean proxy reference for a member
   * 
   * @param member distributed member
   * @return a reference to GatewayReceiverMXBean
   * @throws Exception
   */
public static LocatorMXBean getLocatorMbeanProxy(DistributedMember member) throws Exception {
    final SystemManagementService service = (SystemManagementService) ManagementTestBase.getManagementService();
    final ObjectName locatorMBeanName = service.getLocatorMBeanName(member);
    Wait.waitForCriterion(new WaitCriterion() {

        LocatorMXBean bean = null;

        public String description() {
            return "Waiting for the proxy to get reflected at managing node";
        }

        public boolean done() {
            GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
            bean = service.getMBeanProxy(locatorMBeanName, LocatorMXBean.class);
            boolean done = (bean != null);
            return done;
        }
    }, MAX_WAIT, 500, true);
    LocatorMXBean bean = null;
    try {
        bean = service.getMBeanProxy(locatorMBeanName, LocatorMXBean.class);
    } catch (ManagementException mgz) {
        if (bean == null) {
            InternalDistributedSystem.getLoggerI18n().fine("Undesired Result :Locator MBean Proxy Should Not be Empty for : " + locatorMBeanName.getCanonicalName());
        }
    }
    return bean;
}
Also used : WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) ObjectName(javax.management.ObjectName)

Example 49 with GemFireCacheImpl

use of org.apache.geode.internal.cache.GemFireCacheImpl in project geode by apache.

the class MBeanUtil method getGatewayReceiverMbeanProxy.

/**
   * Utility Method to obtain GatewayReceiverMXBean proxy reference for a member
   * 
   * @param member distributed member
   * @return a reference to GatewayReceiverMXBean
   * @throws Exception
   */
public static GatewayReceiverMXBean getGatewayReceiverMbeanProxy(DistributedMember member) throws Exception {
    final SystemManagementService service = (SystemManagementService) ManagementTestBase.getManagementService();
    final ObjectName receiverMBeanName = service.getGatewayReceiverMBeanName(member);
    Wait.waitForCriterion(new WaitCriterion() {

        GatewayReceiverMXBean bean = null;

        public String description() {
            return "Waiting for the proxy to get reflected at managing node";
        }

        public boolean done() {
            GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
            bean = service.getMBeanProxy(receiverMBeanName, GatewayReceiverMXBean.class);
            boolean done = (bean != null);
            return done;
        }
    }, MAX_WAIT, 500, true);
    GatewayReceiverMXBean bean = null;
    try {
        bean = service.getMBeanProxy(receiverMBeanName, GatewayReceiverMXBean.class);
    } catch (ManagementException mgz) {
        if (bean == null) {
            InternalDistributedSystem.getLoggerI18n().fine("Undesired Result :GatewaySender MBean Proxy Should Not be Empty for : " + receiverMBeanName.getCanonicalName());
        }
    }
    return bean;
}
Also used : WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) ObjectName(javax.management.ObjectName)

Example 50 with GemFireCacheImpl

use of org.apache.geode.internal.cache.GemFireCacheImpl in project geode by apache.

the class ManagementTestBase method createDistributedRegionAsync.

/**
   * Creates a Distributed Region
   */
private AsyncInvocation createDistributedRegionAsync(final VM vm, final String regionName) {
    return vm.invokeAsync("Create Distributed region", () -> {
        GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
        SystemManagementService service = (SystemManagementService) getManagementService();
        RegionFactory rf = cache.createRegionFactory(RegionShortcut.REPLICATE);
        LogWriterUtils.getLogWriter().info("Creating Dist Region");
        rf.create(regionName);
    });
}
Also used : RegionFactory(org.apache.geode.cache.RegionFactory) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) SystemManagementService(org.apache.geode.management.internal.SystemManagementService)

Aggregations

GemFireCacheImpl (org.apache.geode.internal.cache.GemFireCacheImpl)213 Test (org.junit.Test)127 Region (org.apache.geode.cache.Region)86 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)55 LocalRegion (org.apache.geode.internal.cache.LocalRegion)54 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)51 VM (org.apache.geode.test.dunit.VM)49 DistributedRegion (org.apache.geode.internal.cache.DistributedRegion)47 Host (org.apache.geode.test.dunit.Host)42 ClientCacheCreation (org.apache.geode.internal.cache.xmlcache.ClientCacheCreation)40 RegionAttributes (org.apache.geode.cache.RegionAttributes)39 CacheCreation (org.apache.geode.internal.cache.xmlcache.CacheCreation)35 SerializableRunnable (org.apache.geode.test.dunit.SerializableRunnable)33 CacheException (org.apache.geode.cache.CacheException)32 RegionCreation (org.apache.geode.internal.cache.xmlcache.RegionCreation)32 SerializableCallable (org.apache.geode.test.dunit.SerializableCallable)31 Properties (java.util.Properties)24 AttributesFactory (org.apache.geode.cache.AttributesFactory)24 Cache (org.apache.geode.cache.Cache)23 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)23