use of com.hazelcast.config.ServiceConfig in project hazelcast by hazelcast.
the class MembershipUpdateTest method getConfigWithService.
private Config getConfigWithService(Object service, String serviceName) {
Config config = new Config();
ServiceConfig serviceConfig = new ServiceConfig().setEnabled(true).setName(serviceName).setImplementation(service);
ConfigAccessor.getServicesConfig(config).addServiceConfig(serviceConfig);
return config;
}
use of com.hazelcast.config.ServiceConfig in project hazelcast by hazelcast.
the class MapIndexLifecycleTest method whenIndexAddedProgrammatically_existsOnAllMembers.
@Test
public void whenIndexAddedProgrammatically_existsOnAllMembers() {
// GIVEN indexes are configured before Hazelcast starts
int clusterSize = 3;
TestHazelcastInstanceFactory instanceFactory = createHazelcastInstanceFactory(clusterSize);
HazelcastInstance[] instances = new HazelcastInstance[clusterSize];
Config config = getConfig().setProperty(ClusterProperty.PARTITION_COUNT.getName(), "4");
config.getMapConfig(mapName);
ConfigAccessor.getServicesConfig(config).addServiceConfig(new ServiceConfig().setName("SlowPostJoinAwareService").setEnabled(true).setImplementation(new SlowPostJoinAwareService()));
instances[0] = instanceFactory.newHazelcastInstance(config);
IMap<Integer, Book> bookMap = instances[0].getMap(mapName);
fillMap(bookMap);
bookMap.addIndex(getIndexConfig("author", false));
bookMap.addIndex(getIndexConfig("year", true));
assertEquals(BOOK_COUNT, bookMap.size());
// THEN indexes are migrated and populated on all members
for (int i = 1; i < clusterSize; i++) {
instances[i] = instanceFactory.newHazelcastInstance(config);
waitAllForSafeState(copyOfRange(instances, 0, i + 1));
bookMap = instances[i].getMap(mapName);
assertEquals(BOOK_COUNT, bookMap.keySet().size());
assertAllPartitionContainersAreInitialized(instances[i]);
assertGlobalIndexesAreInitialized(instances[i]);
}
}
use of com.hazelcast.config.ServiceConfig in project hazelcast by hazelcast.
the class PartitionIndexingTest method getConfig.
@Override
protected Config getConfig() {
Config config = smallInstanceConfig();
config.setProperty(ClusterProperty.PARTITION_COUNT.getName(), "101");
config.getMapConfig(MAP_NAME).setInMemoryFormat(inMemoryFormat);
ServiceConfig serviceConfig = new ServiceConfig().setEnabled(true).setImplementation(migrationFailingService).setName(MigrationFailingService.class.getName());
ConfigAccessor.getServicesConfig(config).addServiceConfig(serviceConfig);
return config;
}
use of com.hazelcast.config.ServiceConfig in project hazelcast by hazelcast.
the class LockInterceptorServiceTest method testLockingInterceptor.
private void testLockingInterceptor(LockInterceptingService implementation) {
Config config = new Config();
ConfigAccessor.getServicesConfig(config).addServiceConfig(new ServiceConfig().setEnabled(true).setName(LockInterceptingService.SERVICE_NAME).setImplementation(implementation));
HazelcastInstance member = createHazelcastInstance(config);
NodeEngine nodeEngine = getNodeEngineImpl(member);
implementation.serializationService = getSerializationService(member);
LockProxySupport lockProxySupport = new LockProxySupport(new DistributedObjectNamespace(LockInterceptingService.SERVICE_NAME, "test-object"), 10000);
for (int i = 0; i < 100; i++) {
try {
Data key = getSerializationService(member).toData("key" + i);
lockProxySupport.lock(nodeEngine, key);
} catch (RuntimeException e) {
ignore(e);
}
}
}
use of com.hazelcast.config.ServiceConfig in project hazelcast-jet by hazelcast.
the class Jet method configureJetService.
static void configureJetService(JetConfig jetConfig) {
if (!(jetConfig.getHazelcastConfig().getConfigPatternMatcher() instanceof MatchingPointConfigPatternMatcher)) {
throw new UnsupportedOperationException("Custom config pattern matcher is not supported in Jet");
}
jetConfig.getHazelcastConfig().getServicesConfig().addServiceConfig(new ServiceConfig().setEnabled(true).setName(JetService.SERVICE_NAME).setClassName(JetService.class.getName()).setConfigObject(jetConfig));
jetConfig.getHazelcastConfig().addMapConfig(new MapConfig(INTERNAL_JET_OBJECTS_PREFIX + "*").setBackupCount(jetConfig.getInstanceConfig().getBackupCount()).setStatisticsEnabled(false).setMergePolicy(IgnoreMergingEntryMapMergePolicy.class.getName()));
}
Aggregations