Search in sources :

Example 61 with CacheServer

use of org.apache.geode.cache.server.CacheServer in project geode by apache.

the class HARQueueNewImplDUnitTest method createOneMoreBridgeServer.

public static Integer createOneMoreBridgeServer(Boolean notifyBySubscription) throws Exception {
    int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
    CacheServer server1 = cache.addCacheServer();
    server1.setPort(port);
    server1.setNotifyBySubscription(notifyBySubscription.booleanValue());
    server1.getClientSubscriptionConfig().setEvictionPolicy(HARegionQueue.HA_EVICTION_POLICY_MEMORY);
    // let this server to use default diskstore
    server1.start();
    return new Integer(server1.getPort());
}
Also used : CacheServer(org.apache.geode.cache.server.CacheServer)

Example 62 with CacheServer

use of org.apache.geode.cache.server.CacheServer in project geode by apache.

the class HARQueueNewImplDUnitTest method stopServer.

public static void stopServer() {
    try {
        Iterator iter = cache.getCacheServers().iterator();
        if (iter.hasNext()) {
            CacheServer server = (CacheServer) iter.next();
            server.stop();
        }
    } catch (Exception e) {
        fail("failed in stopServer()" + e);
    }
}
Also used : Iterator(java.util.Iterator) CacheServer(org.apache.geode.cache.server.CacheServer)

Example 63 with CacheServer

use of org.apache.geode.cache.server.CacheServer in project geode by apache.

the class CacheServerTestUtil method createCacheServer.

public static void createCacheServer(String regionName, Boolean notifyBySubscription, Integer serverPort) throws Exception {
    Properties props = new Properties();
    props.setProperty(MCAST_PORT, "0");
    props.setProperty(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
    new CacheServerTestUtil().createCache(props);
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.DISTRIBUTED_ACK);
    factory.setEnableBridgeConflation(true);
    factory.setDataPolicy(DataPolicy.REPLICATE);
    RegionAttributes attrs = factory.create();
    cache.createRegion(regionName, attrs);
    CacheServer server = cache.addCacheServer();
    server.setPort(serverPort.intValue());
    server.setNotifyBySubscription(notifyBySubscription.booleanValue());
    server.start();
}
Also used : AttributesFactory(org.apache.geode.cache.AttributesFactory) RegionAttributes(org.apache.geode.cache.RegionAttributes) CacheServer(org.apache.geode.cache.server.CacheServer) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties)

Example 64 with CacheServer

use of org.apache.geode.cache.server.CacheServer in project geode by apache.

the class CacheServerUtils method getCacheServer.

/**
   * Returns single CacheServer for the specified Cache instance
   */
public static CacheServer getCacheServer(final Cache cache) {
    List<CacheServer> cacheServers = cache.getCacheServers();
    CacheServer cacheServer = cacheServers.get(0);
    return cacheServer;
}
Also used : CacheServer(org.apache.geode.cache.server.CacheServer)

Example 65 with CacheServer

use of org.apache.geode.cache.server.CacheServer in project geode by apache.

the class BackwardCompatibilityHigherVersionClientDUnitTest method createServerCache.

public static Integer createServerCache() throws Exception {
    new BackwardCompatibilityHigherVersionClientDUnitTest().createCache(new Properties());
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.DISTRIBUTED_ACK);
    factory.setDataPolicy(DataPolicy.REPLICATE);
    RegionAttributes attrs = factory.create();
    cache.createRegion(REGION_NAME, attrs);
    int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
    CacheServer server1 = cache.addCacheServer();
    server1.setPort(port);
    server1.setNotifyBySubscription(true);
    server1.start();
    return new Integer(server1.getPort());
}
Also used : AttributesFactory(org.apache.geode.cache.AttributesFactory) RegionAttributes(org.apache.geode.cache.RegionAttributes) CacheServer(org.apache.geode.cache.server.CacheServer) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties)

Aggregations

CacheServer (org.apache.geode.cache.server.CacheServer)323 AttributesFactory (org.apache.geode.cache.AttributesFactory)99 Properties (java.util.Properties)97 Test (org.junit.Test)77 Cache (org.apache.geode.cache.Cache)76 ConfigurationProperties (org.apache.geode.distributed.ConfigurationProperties)76 RegionAttributes (org.apache.geode.cache.RegionAttributes)60 IOException (java.io.IOException)53 ClientCache (org.apache.geode.cache.client.ClientCache)53 Region (org.apache.geode.cache.Region)50 SerializableCallable (org.apache.geode.test.dunit.SerializableCallable)49 PartitionAttributesFactory (org.apache.geode.cache.PartitionAttributesFactory)33 Iterator (java.util.Iterator)31 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)31 ClientCacheFactory (org.apache.geode.cache.client.ClientCacheFactory)30 Host (org.apache.geode.test.dunit.Host)27 VM (org.apache.geode.test.dunit.VM)25 DistributedSystem (org.apache.geode.distributed.DistributedSystem)20 CacheException (org.apache.geode.cache.CacheException)17 CacheFactory (org.apache.geode.cache.CacheFactory)17