@Test public void testSuccess() { TombstoneEntity entity = tombstoneBackend.create(entityKind, entityId); assertThat(entity.getId(), notNullValue()); assertThat(entity.getEntityId(), is(entityId)); assertThat(entity.getEntityKind(), is(entityKind)); assertThat(entity.getTombstoneTime(), greaterThan(0L)); }
@Test public void testSuccess() { String id = "entity-id"; String kind = "entity-kind"; TombstoneEntity entity = tombstoneBackend.create(kind, id); assertThat(entity, notNullValue()); assertThat(entity, is(tombstoneBackend.getByEntityId(id))); tombstoneBackend.delete(entity); assertThat(tombstoneBackend.getByEntityId(id), nullValue()); }
@Override public void tombstone(NetworkEntity network) throws ExternalException { List<Vm> vmsOnNetwork = vmBackend.filterByNetwork(network.getId()); if (!vmsOnNetwork.isEmpty()) { logger.info("There are {} VMs still on network {}", vmsOnNetwork.size(), network.getId()); return; } xenonClient.delete( NetworkServiceFactory.SELF_LINK + "/" + network.getId(), new NetworkService.State()); tombstoneBackend.create(Subnet.KIND, network.getId()); logger.info("network {} tombstoned", network.getId()); }
private void buildTombstones(int count, String id, String kind) { for (int i = 0; i < count; i++) { tombstoneBackend.create(kind, id); } }
@Test( expectedExceptions = RuntimeException.class, expectedExceptionsMessageRegExp = ".*entityId cannot be null.*") public void testError() { tombstoneBackend.create(entityKind, null); }