Search in sources :

Example 6 with ClasspathXmlConfig

use of com.hazelcast.config.ClasspathXmlConfig in project hazelcast by hazelcast.

the class CachingProviderTest method setup.

@Before
public void setup() {
    instance1 = createHazelcastInstance(INSTANCE_1_NAME);
    instance2 = createHazelcastInstance(INSTANCE_2_NAME);
    cachingProvider = createCachingProvider(instance1);
    // also start a hazelcast instance off a well-known config location
    Config config = new ClasspathXmlConfig(CONFIG_CLASSPATH_LOCATION);
    instance3 = instanceFactory.newHazelcastInstance(config);
}
Also used : Config(com.hazelcast.config.Config) ClasspathXmlConfig(com.hazelcast.config.ClasspathXmlConfig) ClasspathXmlConfig(com.hazelcast.config.ClasspathXmlConfig) Before(org.junit.Before)

Example 7 with ClasspathXmlConfig

use of com.hazelcast.config.ClasspathXmlConfig in project hazelcast by hazelcast.

the class PartitionStateGeneratorTest method testXmlPartitionGroupConfig.

@Test
public void testXmlPartitionGroupConfig() {
    Config config = new ClasspathXmlConfig("hazelcast-fullconfig.xml");
    PartitionGroupConfig partitionGroupConfig = config.getPartitionGroupConfig();
    assertTrue(partitionGroupConfig.isEnabled());
    assertEquals(PartitionGroupConfig.MemberGroupType.CUSTOM, partitionGroupConfig.getGroupType());
    assertEquals(2, partitionGroupConfig.getMemberGroupConfigs().size());
}
Also used : PartitionGroupConfig(com.hazelcast.config.PartitionGroupConfig) Config(com.hazelcast.config.Config) ClasspathXmlConfig(com.hazelcast.config.ClasspathXmlConfig) MemberGroupConfig(com.hazelcast.config.MemberGroupConfig) PartitionGroupConfig(com.hazelcast.config.PartitionGroupConfig) ClasspathXmlConfig(com.hazelcast.config.ClasspathXmlConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 8 with ClasspathXmlConfig

use of com.hazelcast.config.ClasspathXmlConfig in project SSM by Intel-bigdata.

the class HazelcastInstanceProvider method getInstance.

public static HazelcastInstance getInstance() {
    if (instance == null) {
        ClasspathXmlConfig config = new ClasspathXmlConfig(CONFIG_FILE);
        addMemberConfig(config);
        instance = Hazelcast.newHazelcastInstance(config);
        Runtime.getRuntime().addShutdownHook(new Thread() {

            @Override
            public void run() {
                instance.getLifecycleService().shutdown();
            }
        });
    }
    return instance;
}
Also used : ClasspathXmlConfig(com.hazelcast.config.ClasspathXmlConfig)

Example 9 with ClasspathXmlConfig

use of com.hazelcast.config.ClasspathXmlConfig in project jain-sip.ha by RestComm.

the class HazelcastCache method init.

public void init() throws SipCacheException {
    Config cfg = null;
    String instanceName = configProperties.getProperty(HAZELCAST_INSTANCE_NAME, DEFAULT_HAZELCAST_INSTANCE_NAME);
    hz = Hazelcast.getHazelcastInstanceByName(instanceName);
    if (hz == null) {
        String pojoConfigurationPath = configProperties.getProperty(HAZELCAST_CACHE_CONFIG_PATH);
        if (pojoConfigurationPath != null) {
            if (clusteredlogger.isLoggingEnabled(StackLogger.TRACE_INFO)) {
                clusteredlogger.logInfo("Mobicents JAIN SIP Hazelcast Cache Configuration path is : " + pojoConfigurationPath);
            }
            try {
                cfg = new XmlConfigBuilder(pojoConfigurationPath).build();
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        } else {
            cfg = new ClasspathXmlConfig(DEFAULT_FILE_CONFIG_PATH);
        }
        cfg.setInstanceName(instanceName);
        hz = Hazelcast.newHazelcastInstance(cfg);
    }
    dialogs = hz.getMap("cache.dialogs");
    appDataMap = hz.getMap("cache.appdata");
    serverTransactions = hz.getMap("cache.serverTX");
    serverTransactionsApp = hz.getMap("cache.serverTXApp");
    clientTransactions = hz.getMap("cache.clientTX");
    clientTransactionsApp = hz.getMap("cache.clientTXApp");
}
Also used : XmlConfigBuilder(com.hazelcast.config.XmlConfigBuilder) Config(com.hazelcast.config.Config) ClasspathXmlConfig(com.hazelcast.config.ClasspathXmlConfig) FileNotFoundException(java.io.FileNotFoundException) ClasspathXmlConfig(com.hazelcast.config.ClasspathXmlConfig)

Aggregations

ClasspathXmlConfig (com.hazelcast.config.ClasspathXmlConfig)9 Config (com.hazelcast.config.Config)6 UrlXmlConfig (com.hazelcast.config.UrlXmlConfig)2 FileSystemXmlConfig (com.hazelcast.config.FileSystemXmlConfig)1 MemberGroupConfig (com.hazelcast.config.MemberGroupConfig)1 PartitionGroupConfig (com.hazelcast.config.PartitionGroupConfig)1 XmlConfigBuilder (com.hazelcast.config.XmlConfigBuilder)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 FileNotFoundException (java.io.FileNotFoundException)1 Integer (java.lang.Integer)1 TimeUnit (java.util.concurrent.TimeUnit)1 TimeoutException (java.util.concurrent.TimeoutException)1 RemoteSessionLocator (org.jivesoftware.openfire.plugin.session.RemoteSessionLocator)1 ClusterPacketRouter (org.jivesoftware.openfire.plugin.util.cluster.ClusterPacketRouter)1 Before (org.junit.Before)1 Test (org.junit.Test)1