Search in sources :

Example 16 with HazelcastInstance

use of com.hazelcast.core.HazelcastInstance in project spring-boot by spring-projects.

the class HazelcastAutoConfigurationTests method explicitConfigFile.

@Test
public void explicitConfigFile() throws IOException {
    load("spring.hazelcast.config=org/springframework/boot/autoconfigure/hazelcast/" + "hazelcast-specific.xml");
    HazelcastInstance hazelcastInstance = this.context.getBean(HazelcastInstance.class);
    assertThat(hazelcastInstance.getConfig().getConfigurationFile()).isEqualTo(new ClassPathResource("org/springframework/boot/autoconfigure/hazelcast" + "/hazelcast-specific.xml").getFile());
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) ClassPathResource(org.springframework.core.io.ClassPathResource) Test(org.junit.Test)

Example 17 with HazelcastInstance

use of com.hazelcast.core.HazelcastInstance in project spring-boot by spring-projects.

the class HazelcastAutoConfigurationTests method configInstanceWithoutName.

@Test
public void configInstanceWithoutName() {
    load(HazelcastConfigNoName.class, "spring.hazelcast.config=this-is-ignored.xml");
    HazelcastInstance hazelcastInstance = this.context.getBean(HazelcastInstance.class);
    Map<String, QueueConfig> queueConfigs = hazelcastInstance.getConfig().getQueueConfigs();
    assertThat(queueConfigs).hasSize(1).containsKey("another-queue");
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) QueueConfig(com.hazelcast.config.QueueConfig) Test(org.junit.Test)

Example 18 with HazelcastInstance

use of com.hazelcast.core.HazelcastInstance in project spring-boot by spring-projects.

the class SessionAutoConfigurationHazelcastTests method customMapName.

@Test
public void customMapName() {
    load(Collections.<Class<?>>singletonList(HazelcastConfiguration.class), "spring.session.store-type=hazelcast", "spring.session.hazelcast.map-name=foo:bar:biz");
    validateSessionRepository(HazelcastSessionRepository.class);
    HazelcastInstance hazelcastInstance = this.context.getBean(HazelcastInstance.class);
    verify(hazelcastInstance, times(1)).getMap("foo:bar:biz");
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Test(org.junit.Test)

Example 19 with HazelcastInstance

use of com.hazelcast.core.HazelcastInstance in project camel by apache.

the class HazelcastRoute method configure.

@Override
public void configure() throws Exception {
    HazelcastComponent component = new HazelcastComponent();
    ClientConfig config = new ClientConfig();
    config.getNetworkConfig().addAddress("hazelcast");
    config.getNetworkConfig().setSSLConfig(new SSLConfig().setEnabled(false));
    config.setGroupConfig(new GroupConfig("someGroup", "someSecret"));
    HazelcastInstance instance = HazelcastClient.newHazelcastClient(config);
    component.setHazelcastInstance(instance);
    getContext().addComponent("hazelcast", component);
    from("timer:foo?period=5000").log("Producer side: Sending data to Hazelcast topic..").process(new Processor() {

        @Override
        public void process(Exchange exchange) throws Exception {
            exchange.getIn().setHeader(HazelcastConstants.OPERATION, HazelcastConstants.PUBLISH_OPERATION);
            String payload = "Test " + UUID.randomUUID();
            exchange.getIn().setBody(payload);
        }
    }).to("hazelcast:topic:foo");
    from("hazelcast:topic:foo").log("Consumer side: Detected following action: $simple{in.header.CamelHazelcastListenerAction}");
}
Also used : Exchange(org.apache.camel.Exchange) SSLConfig(com.hazelcast.config.SSLConfig) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Processor(org.apache.camel.Processor) GroupConfig(com.hazelcast.config.GroupConfig) HazelcastComponent(org.apache.camel.component.hazelcast.HazelcastComponent) ClientConfig(com.hazelcast.client.config.ClientConfig)

Example 20 with HazelcastInstance

use of com.hazelcast.core.HazelcastInstance in project hazelcast by hazelcast.

the class ClientMapProxy method aggregate.

@Override
public <SuppliedValue, Result> Result aggregate(Supplier<K, V, SuppliedValue> supplier, Aggregation<K, SuppliedValue, Result> aggregation) {
    HazelcastInstance hazelcastInstance = getContext().getHazelcastInstance();
    JobTracker jobTracker = hazelcastInstance.getJobTracker("hz::aggregation-map-" + name);
    return aggregate(supplier, aggregation, jobTracker);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) JobTracker(com.hazelcast.mapreduce.JobTracker)

Aggregations

HazelcastInstance (com.hazelcast.core.HazelcastInstance)2077 Test (org.junit.Test)1684 QuickTest (com.hazelcast.test.annotation.QuickTest)1466 ParallelTest (com.hazelcast.test.annotation.ParallelTest)1389 Config (com.hazelcast.config.Config)815 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)665 AssertTask (com.hazelcast.test.AssertTask)263 MapConfig (com.hazelcast.config.MapConfig)254 CountDownLatch (java.util.concurrent.CountDownLatch)251 NightlyTest (com.hazelcast.test.annotation.NightlyTest)230 MapStoreConfig (com.hazelcast.config.MapStoreConfig)169 IMap (com.hazelcast.core.IMap)145 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)144 ClientConfig (com.hazelcast.client.config.ClientConfig)137 Before (org.junit.Before)111 NearCacheConfig (com.hazelcast.config.NearCacheConfig)106 Member (com.hazelcast.core.Member)96 Map (java.util.Map)96 SlowTest (com.hazelcast.test.annotation.SlowTest)94 SqlPredicate (com.hazelcast.query.SqlPredicate)83