@Test public void testDeleteWithEpz() throws Throwable { String rpLink = createRp().documentSelfLink; String epzLink = createEpz(rpLink, "tag1").documentSelfLink; ElasticPlacementZoneConfigurationState state = createState(true); state.resourcePoolState.documentSelfLink = rpLink; state.epzState.documentSelfLink = epzLink; delete(ElasticPlacementZoneConfigurationService.SELF_LINK + rpLink); assertNull(searchForDocument(ResourcePoolState.class, rpLink)); assertNull(searchForDocument(ElasticPlacementZoneState.class, epzLink)); }
@Test public void testCreateDelete() throws Throwable { ElasticPlacementZoneConfigurationState state = createState(true); state.resourcePoolState = buildRpState(); state.epzState = buildEpzState(null, "tag1", "tag2"); ElasticPlacementZoneConfigurationState createdState = sendState(state, Action.POST); delete(ElasticPlacementZoneConfigurationService.SELF_LINK + createdState.resourcePoolState.documentSelfLink); assertNull( searchForDocument(ResourcePoolState.class, createdState.resourcePoolState.documentSelfLink)); assertNull(searchForDocument(ElasticPlacementZoneState.class, createdState.epzState.documentSelfLink)); }
@Test public void testDeleteNoEpz() throws Throwable { String rpLink = createRp().documentSelfLink; ElasticPlacementZoneConfigurationState state = createState(false); state.resourcePoolState.documentSelfLink = rpLink; delete(ElasticPlacementZoneConfigurationService.SELF_LINK + rpLink); assertNull(searchForDocument(ResourcePoolState.class, rpLink)); }
@Test public void testCreateWithEpz() throws Throwable { ElasticPlacementZoneConfigurationState state = createState(true); state.resourcePoolState = buildRpState(); state.epzState = buildEpzState(null, "tag1", "tag2"); ElasticPlacementZoneConfigurationState returnedState = sendState(state, Action.POST); assertNotNull(returnedState.resourcePoolState.documentSelfLink); assertNotNull(searchForDocument(ResourcePoolState.class, returnedState.resourcePoolState.documentSelfLink)); assertNotNull(returnedState.epzState.documentSelfLink); assertNotNull(searchForDocument(ElasticPlacementZoneState.class, returnedState.epzState.documentSelfLink)); assertEquals(state.resourcePoolState.name, returnedState.resourcePoolState.name); assertEquals(state.epzState.tagLinksToMatch, returnedState.epzState.tagLinksToMatch); }
@Test public void testCreateNoEpz() throws Throwable { ElasticPlacementZoneConfigurationState state = createState(true); state.resourcePoolState = buildRpState(); ElasticPlacementZoneConfigurationState returnedState = sendState(state, Action.POST); assertNotNull(returnedState.resourcePoolState.documentSelfLink); assertNotNull(searchForDocument(ResourcePoolState.class, returnedState.resourcePoolState.documentSelfLink)); assertEquals(state.resourcePoolState.name, returnedState.resourcePoolState.name); }