use of org.apache.ignite.services.ServiceConfiguration in project ignite by apache.
the class SystemCacheNotConfiguredTest method serviceConfiguration.
/**
* @return Service configuration.
*/
private ServiceConfiguration serviceConfiguration() {
ServiceConfiguration svcCfg = new ServiceConfiguration();
svcCfg.setName("service");
svcCfg.setTotalCount(1);
svcCfg.setService(new SimpleServiceImpl());
return svcCfg;
}
use of org.apache.ignite.services.ServiceConfiguration in project ignite by apache.
the class ServiceDeploymentOnActivationTest method checkRedeployment.
/**
* @param srvsNum Number of server nodes to start.
* @param clientsNum Number of client nodes to start.
* @param nodeFilter Node filter.
* @param deps Expected number of deployed services.
* @param isStatic Static or dynamic service deployment is used.
* @throws Exception If failed.
*/
private void checkRedeployment(int srvsNum, int clientsNum, IgnitePredicate<ClusterNode> nodeFilter, int deps, boolean isStatic) throws Exception {
if (isStatic)
srvcCfg = getServiceConfiguration(nodeFilter);
CountDownLatch exeLatch = new CountDownLatch(deps);
CountDownLatch cancelLatch = new CountDownLatch(deps);
DummyService.exeLatch(SERVICE_NAME, exeLatch);
DummyService.cancelLatch(SERVICE_NAME, cancelLatch);
for (int i = 0; i < srvsNum; i++) startGrid(i);
for (int i = 0; i < clientsNum; i++) startClientGrid(srvsNum + i);
Ignite ignite = grid(0);
ignite.cluster().active(true);
if (!isStatic) {
ServiceConfiguration srvcCfg = getServiceConfiguration(nodeFilter);
ignite.services().deploy(srvcCfg);
}
assertTrue(exeLatch.await(10, TimeUnit.SECONDS));
ignite.cluster().active(false);
assertTrue(cancelLatch.await(10, TimeUnit.SECONDS));
exeLatch = new CountDownLatch(deps);
DummyService.exeLatch(SERVICE_NAME, exeLatch);
ignite.cluster().active(true);
assertTrue(exeLatch.await(10, TimeUnit.SECONDS));
}
use of org.apache.ignite.services.ServiceConfiguration in project ignite by apache.
the class ServiceDeploymentOutsideBaselineTest method getClusterSingletonServiceConfiguration.
/**
* @return Test service configuration.
*/
private ServiceConfiguration getClusterSingletonServiceConfiguration() {
ServiceConfiguration srvcCfg = new ServiceConfiguration();
srvcCfg.setName(SERVICE_NAME);
srvcCfg.setService(new DummyService());
srvcCfg.setTotalCount(1);
return srvcCfg;
}
use of org.apache.ignite.services.ServiceConfiguration in project ignite by apache.
the class GridServiceProcessorAbstractSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
ServiceConfiguration[] svcs = services();
if (svcs != null)
c.setServiceConfiguration(svcs);
CacheConfiguration cc = new CacheConfiguration(DEFAULT_CACHE_NAME);
cc.setName(CACHE_NAME);
cc.setCacheMode(CacheMode.PARTITIONED);
cc.setBackups(nodeCount());
c.setCacheConfiguration(cc);
return c;
}
use of org.apache.ignite.services.ServiceConfiguration in project ignite by apache.
the class ServiceReassignmentFunctionSelfTest method testClusterSingletonWithOldTop.
/**
* @throws Exception In case of an error.
*/
@Test
public void testClusterSingletonWithOldTop() throws Exception {
ServiceConfiguration cfg = new ServiceConfiguration();
cfg.setName(TEST_SERVICE_NAME);
cfg.setTotalCount(1);
IgniteUuid srvcId = IgniteUuid.randomUuid();
TreeMap<UUID, Integer> oldTop = new TreeMap<>();
ClusterNode randomNode = nodes.get(new Random().nextInt(nodes.size()));
oldTop.put(randomNode.id(), 1);
runTestReassignFunction(srvcId, cfg, oldTop);
}
Aggregations