@Test
public void testAuxServices() throws IOException {

  Configuration conf = getABConf();
  final AuxServices aux = new AuxServices(MOCK_AUX_PATH_HANDLER,
      MOCK_CONTEXT, MOCK_DEL_SERVICE);
  aux.init(conf);
  int latch = 1;
  for (Service s : aux.getServices()) {
    assertEquals(INITED, s.getServiceState());
    if (s instanceof ServiceA) { latch *= 2; }
    else if (s instanceof ServiceB) { latch *= 3; }
    else fail("Unexpected service type " + s.getClass());
  }
  assertEquals("Invalid mix of services", 6, latch);
  aux.start();
  for (AuxiliaryService s : aux.getServices()) {
    assertEquals(STARTED, s.getServiceState());
    assertEquals(s.getAuxiliaryLocalPathHandler(),
        MOCK_AUX_PATH_HANDLER);
  }
  aux.stop();
  for (Service s : aux.getServices()) {
    assertEquals(STOPPED, s.getServiceState());
  }
}