use of org.apache.samza.rest.SamzaRestConfig in project samza by apache.
the class TestMonitorService method testMonitorExceptionIsolation.
@Test
public void testMonitorExceptionIsolation() {
// Test that an exception from a monitor doesn't bubble up out of the scheduler.
Map<String, String> configMap = ImmutableMap.of(String.format("monitor.name.%s", CONFIG_MONITOR_FACTORY_CLASS), ExceptionThrowingMonitorFactory.class.getCanonicalName());
SamzaRestConfig config = new SamzaRestConfig(new MapConfig(configMap));
SamzaMonitorService monitorService = new SamzaMonitorService(config, METRICS_REGISTRY, new InstantSchedulingProvider());
// This will throw if the exception isn't caught within the provider.
monitorService.start();
monitorService.stop();
}
use of org.apache.samza.rest.SamzaRestConfig in project samza by apache.
the class TestMonitorService method testShouldFailWhenTheMonitorFactoryClassIsInvalid.
@Test(expected = SamzaException.class)
public void testShouldFailWhenTheMonitorFactoryClassIsInvalid() {
// Test that when MonitorFactoryClass is defined in the config and is invalid,
// monitor service should fail. Should throw back SamzaException.
Map<String, String> configMap = ImmutableMap.of(String.format("monitor.name.%s", CONFIG_MONITOR_FACTORY_CLASS), "RandomClassName");
SamzaRestConfig config = new SamzaRestConfig(new MapConfig(configMap));
SamzaMonitorService monitorService = new SamzaMonitorService(config, METRICS_REGISTRY, new InstantSchedulingProvider());
monitorService.start();
}
use of org.apache.samza.rest.SamzaRestConfig in project samza by apache.
the class TestMonitorService method testShouldNotFailWhenTheMonitorFactoryClassIsNotDefined.
@Test
public void testShouldNotFailWhenTheMonitorFactoryClassIsNotDefined() throws Exception {
// Test that when MonitorFactoryClass is not defined in the config, monitor service
// should not fail.
Map<String, String> configMap = ImmutableMap.of("monitor.monitor1.config.key1", "configValue1", "monitor.monitor1.config.key2", "configValue2", String.format("monitor.MOCK_MONITOR.%s", CONFIG_MONITOR_FACTORY_CLASS), MockMonitorFactory.class.getCanonicalName());
SamzaRestConfig config = new SamzaRestConfig(new MapConfig(configMap));
SamzaMonitorService monitorService = new SamzaMonitorService(config, METRICS_REGISTRY, new InstantSchedulingProvider());
try {
monitorService.start();
} catch (Exception e) {
fail();
}
Mockito.verify(MockMonitorFactory.MOCK_MONITOR, Mockito.times(1)).monitor();
}
use of org.apache.samza.rest.SamzaRestConfig in project samza by apache.
the class TestTasksResource method configure.
@Override
protected Application configure() {
Map<String, String> configMap = ImmutableMap.of(TaskResourceConfig.CONFIG_TASK_PROXY_FACTORY, MockTaskProxyFactory.class.getName(), SamzaRestConfig.CONFIG_REST_RESOURCE_FACTORIES, MockResourceFactory.class.getName());
SamzaRestConfig config = new SamzaRestConfig(new MapConfig(configMap));
return new SamzaRestApplication(config);
}
use of org.apache.samza.rest.SamzaRestConfig in project samza by apache.
the class TestJobsResource method configure.
@Override
protected Application configure() {
Map<String, String> configMap = ImmutableMap.of(JobsResourceConfig.CONFIG_JOB_PROXY_FACTORY, MockJobProxyFactory.class.getName(), SamzaRestConfig.CONFIG_REST_RESOURCE_FACTORIES, MockResourceFactory.class.getName());
SamzaRestConfig config = new SamzaRestConfig(new MapConfig(configMap));
return new SamzaRestApplication(config);
}
Aggregations