@Test
public void factoryDurableServicePostWithDeleteRestart() throws Throwable {

    // first create the factory service
    long count = this.serviceCount;
    MinimalFactoryTestService f = new MinimalFactoryTestService();
    f.setChildServiceCaps(EnumSet.of(ServiceOption.PERSISTENCE));
    MinimalFactoryTestService factoryService = (MinimalFactoryTestService) this.host
            .startServiceAndWait(f, UUID.randomUUID().toString(), null);
    this.host.waitForServiceAvailable(factoryService.getUri());
    doFactoryServiceChildCreation(EnumSet.of(ServiceOption.PERSISTENCE),
            EnumSet.of(TestProperty.DELETE_DURABLE_SERVICE), count,
            factoryService.getUri());
    // do one more pass to verify the previous services, even if durable,
    // have their documents marked deleted in the index
    doFactoryServiceChildCreation(EnumSet.of(ServiceOption.PERSISTENCE),
            EnumSet.of(TestProperty.DELETE_DURABLE_SERVICE), count,
            factoryService.getUri());
    // do it all again, but with durable, replicated services
    f = new MinimalFactoryTestService();
    EnumSet<ServiceOption> caps = EnumSet.of(ServiceOption.PERSISTENCE,
            ServiceOption.REPLICATION);
    f.setChildServiceCaps(caps);
    factoryService = (MinimalFactoryTestService) this.host
            .startServiceAndWait(f, UUID.randomUUID().toString(), null);
    doFactoryServiceChildCreation(caps,
            EnumSet.of(TestProperty.DELETE_DURABLE_SERVICE), count,
            factoryService.getUri());
    // do one more pass to verify the previous services, even if durable,
    // have their documents marked deleted in the index
    doFactoryServiceChildCreation(caps,
            EnumSet.of(TestProperty.DELETE_DURABLE_SERVICE), count,
            factoryService.getUri());
}