Java Code Examples for org.apache.hadoop.service.Service#init()

The following examples show how to use org.apache.hadoop.service.Service#init() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestServiceLifecycle.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartInInitService() throws Throwable {
  Service service = new StartInInitService();
  BreakableStateChangeListener listener = new BreakableStateChangeListener();
  service.registerServiceListener(listener);
  service.init(new Configuration());
  assertServiceInState(service, Service.STATE.STARTED);
  assertEventCount(listener, 1);
}
 
Example 2
Source File: TestServiceLifecycle.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test
public void testStopInInitService() throws Throwable {
  Service service = new StopInInitService();
  BreakableStateChangeListener listener = new BreakableStateChangeListener();
  service.registerServiceListener(listener);
  service.init(new Configuration());
  assertServiceInState(service, Service.STATE.STOPPED);
  assertEventCount(listener, 1);
}
 
Example 3
Source File: TestServiceLifecycle.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartInInitService() throws Throwable {
  Service service = new StartInInitService();
  BreakableStateChangeListener listener = new BreakableStateChangeListener();
  service.registerServiceListener(listener);
  service.init(new Configuration());
  assertServiceInState(service, Service.STATE.STARTED);
  assertEventCount(listener, 1);
}
 
Example 4
Source File: TestServiceLifecycle.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test
public void testStopInInitService() throws Throwable {
  Service service = new StopInInitService();
  BreakableStateChangeListener listener = new BreakableStateChangeListener();
  service.registerServiceListener(listener);
  service.init(new Configuration());
  assertServiceInState(service, Service.STATE.STOPPED);
  assertEventCount(listener, 1);
}