public static void checkServiceDependencySatisified(Service service) {
    while (!serviceDependencySatisfied(service)) {
      try {
        LOG.info("Waiting for service dependencies.");
        Thread.sleep(15000L);
      } catch (InterruptedException e) {
      }
    }
  }
@Test
  public void testServiceDependencies() {
    Thread thread = new Thread() {
      @Override
      public void run() {
        Service service = createExampleApplication();
        Component compa = createComponent("compa");
        Component compb = createComponent("compb");
        service.addComponent(compa);
        service.addComponent(compb);
        List<String> dependencies = new ArrayList<String>();
        dependencies.add("abc");
        service.setDependencies(dependencies);
        Service dependent = createExampleApplication();
        dependent.setState(ServiceState.STOPPED);
        ServiceApiUtil.checkServiceDependencySatisified(service);
      }
    };
    thread.start();
    try {
      Thread.sleep(1000);
    } catch (InterruptedException e) {
    }
    Assert.assertTrue(thread.isAlive());
  }