use of org.apache.ignite.services.ServiceConfiguration in project ignite by apache.
the class GridServiceProcessorProxySelfTest method deployNodeSingleton.
/**
* Deploys {@link MapServiceImpl} service over the cluster as node singleton.
*
* @param svcName Service name
* @param withStat If {@code true}, enabled the serive metrics {@link ServiceConfiguration#setStatisticsEnabled(boolean)}.
*/
private void deployNodeSingleton(String svcName, boolean withStat) throws InterruptedException {
ServiceConfiguration svcCfg = new ServiceConfiguration();
svcCfg.setName(svcName);
svcCfg.setMaxPerNodeCount(1);
svcCfg.setTotalCount(nodeCount());
svcCfg.setService(new MapServiceImpl<String, Integer>());
svcCfg.setStatisticsEnabled(withStat);
grid(0).services().deploy(svcCfg);
awaitPartitionMapExchange();
}
use of org.apache.ignite.services.ServiceConfiguration in project ignite by apache.
the class ServiceDeploymentOnActivationTest method getServiceConfiguration.
/**
* @param nodeFilter Node filter.
* @return Service configuration.
*/
private ServiceConfiguration getServiceConfiguration(IgnitePredicate<ClusterNode> nodeFilter) {
ServiceConfiguration srvcCfg = new ServiceConfiguration();
srvcCfg.setName(SERVICE_NAME);
srvcCfg.setMaxPerNodeCount(1);
srvcCfg.setNodeFilter(nodeFilter);
srvcCfg.setService(new DummyService());
return srvcCfg;
}
use of org.apache.ignite.services.ServiceConfiguration in project ignite by apache.
the class ServiceDeploymentProcessingOnNodesLeftTest method testDeploymentProcessingOnServersAndClientsLeaveTopology.
/**
* @throws Exception In case of an error.
*/
@Test
public void testDeploymentProcessingOnServersAndClientsLeaveTopology() throws Exception {
try {
Ignite ignite0 = startGrids(4);
IgniteEx client1 = startClientGrid(getConfiguration("client1"));
IgniteEx client2 = startClientGrid(getConfiguration("client2"));
IgniteEx ignite1 = grid(1);
((BlockingTcpCommunicationSpi) client1.configuration().getCommunicationSpi()).block();
((BlockingTcpCommunicationSpi) client2.configuration().getCommunicationSpi()).block();
((BlockingTcpCommunicationSpi) ignite1.configuration().getCommunicationSpi()).block();
ServiceConfiguration srvcCfg = new ServiceConfiguration();
srvcCfg.setName("testService");
srvcCfg.setMaxPerNodeCount(1);
srvcCfg.setService(new LongInitializedTestService(10_000));
srvcCfg.setNodeFilter(new AlwaysTruePredicate<>());
IgniteFuture fut = ignite0.services().deployAsync(srvcCfg);
stopNode(client1);
stopNode(client2);
stopNode(ignite1);
fut.get(TEST_FUTURE_WAIT_TIMEOUT);
assertNotNull(ignite0.services().service("testService"));
IgniteEx ignite3 = grid(3);
assertNotNull(ignite3.services().service("testService"));
} finally {
stopAllGrids();
}
}
use of org.apache.ignite.services.ServiceConfiguration in project ignite by apache.
the class ServiceInfoSelfTest method configuration.
/**
* @return Service configuration.
*/
private ServiceConfiguration configuration() {
ServiceConfiguration cfg = new ServiceConfiguration();
cfg.setName("testConfig");
cfg.setTotalCount(10);
cfg.setMaxPerNodeCount(3);
cfg.setCacheName("testCacheName");
cfg.setAffinityKey("testAffKey");
cfg.setService(new TestService());
cfg.setNodeFilter(ClusterNode::isLocal);
return cfg;
}
use of org.apache.ignite.services.ServiceConfiguration in project ignite by apache.
the class SqlViewExporterSpiTest method testServices.
/**
*/
@Test
public void testServices() throws Exception {
ServiceConfiguration srvcCfg = new ServiceConfiguration();
srvcCfg.setName("service");
srvcCfg.setMaxPerNodeCount(1);
srvcCfg.setService(new DummyService());
ignite0.services().deploy(srvcCfg);
List<List<?>> srvs = execute(ignite0, "SELECT " + " NAME, " + " SERVICE_ID, " + " SERVICE_CLASS, " + " TOTAL_COUNT, " + " MAX_PER_NODE_COUNT, " + " CACHE_NAME, " + " AFFINITY_KEY, " + " NODE_FILTER, " + " STATICALLY_CONFIGURED, " + " ORIGIN_NODE_ID " + "FROM SYS.SERVICES");
assertEquals(ignite0.context().service().serviceDescriptors().size(), srvs.size());
List<?> sysView = srvs.iterator().next();
assertEquals(srvcCfg.getName(), sysView.get(0));
assertEquals(DummyService.class.getName(), sysView.get(2));
assertEquals(srvcCfg.getMaxPerNodeCount(), sysView.get(4));
}
Aggregations