use of org.apache.ignite.services.ServiceConfiguration in project ignite by apache.
the class GridServiceMetricsTest method testServiceMetricsEnabledDisabled.
/**
* Checks service metrics are enabled / disabled properly.
*/
@Test
public void testServiceMetricsEnabledDisabled() throws Exception {
IgniteEx ignite = startGrid();
ServiceConfiguration srvcCfg = serviceCfg(MyServiceFactory.create(), 0, 1);
srvcCfg.setStatisticsEnabled(false);
ignite.services().deploy(srvcCfg);
assertNull(METRICS_MUST_NOT_BE_CREATED, findMetricRegistry(ignite.context().metric(), SRVC_NAME));
ignite.services().cancel(SRVC_NAME);
srvcCfg.setStatisticsEnabled(true);
ignite.services().deploy(srvcCfg);
assertNotNull("Service metric registry must be created.", findMetricRegistry(ignite.context().metric(), SRVC_NAME));
}
use of org.apache.ignite.services.ServiceConfiguration in project ignite by apache.
the class ServiceStaticConfigTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setAuthenticationEnabled(true);
cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true)));
ServiceConfiguration srvcCfg = new ServiceConfiguration();
srvcCfg.setName(SVC_NAME);
srvcCfg.setMaxPerNodeCount(1);
srvcCfg.setService(new CounterService());
cfg.setServiceConfiguration(srvcCfg);
return cfg;
}
use of org.apache.ignite.services.ServiceConfiguration in project ignite by apache.
the class GridServiceProcessorBatchDeploySelfTest method deployAllFail.
/**
* @param async If {@code true}, then asynchronous method of deployment will be performed.
* @throws Exception If failed.
*/
private void deployAllFail(boolean async) throws Exception {
Ignite client = grid(CLIENT_NODE_NAME);
CountDownLatch latch = new CountDownLatch(NUM_SERVICES - 1);
List<ServiceConfiguration> cfgs = getConfigs(client.cluster().forServers().predicate(), NUM_SERVICES);
subscribeExeLatch(cfgs, latch);
ServiceConfiguration failingCfg = cfgs.get(cfgs.size() - 1);
failingCfg.setName(null);
assertFailingDeploy(client, async, cfgs, failingCfg);
assertTrue("Waiting for services deployment timed out.", latch.await(30, TimeUnit.SECONDS));
assertDeployedServices(client, cfgs.subList(0, cfgs.size() - 1));
}
use of org.apache.ignite.services.ServiceConfiguration in project ignite by apache.
the class GridServiceProcessorBatchDeploySelfTest method testDeployAll.
/**
* @throws Exception If failed.
*/
@Test
public void testDeployAll() throws Exception {
Ignite client = grid(CLIENT_NODE_NAME);
CountDownLatch latch = new CountDownLatch(NUM_SERVICES);
List<ServiceConfiguration> cfgs = getConfigs(client.cluster().forServers().predicate(), NUM_SERVICES);
subscribeExeLatch(cfgs, latch);
client.services().deployAll(cfgs);
assertTrue("Waiting for services deployment timed out.", latch.await(30, TimeUnit.SECONDS));
assertDeployedServices(client, cfgs);
}
use of org.apache.ignite.services.ServiceConfiguration in project ignite by apache.
the class GridServiceProcessorBatchDeploySelfTest method testCancelAllAsync.
/**
* @throws Exception If failed.
*/
@Test
public void testCancelAllAsync() throws Exception {
Ignite client = grid(CLIENT_NODE_NAME);
List<ServiceConfiguration> cfgs = getConfigs(client.cluster().forServers().predicate(), NUM_SERVICES);
CountDownLatch latch = new CountDownLatch(NUM_SERVICES);
subscribeExeLatch(cfgs, latch);
client.services().deployAll(cfgs);
latch.await(30, TimeUnit.SECONDS);
IgniteFuture<Void> fut = client.services().cancelAllAsync();
fut.get();
assertDeployedServices(client, Collections.<ServiceConfiguration>emptyList());
}
Aggregations