@Test(expectedExceptions = XenonRuntimeException.class) public void testInvalidPatchStateVmServiceLinkFieldSet() throws Throwable { createContainerService(); ContainerService.State patchState = new ContainerService.State(); patchState.vmServiceLink = "VM_SERVICE_LINK"; Operation patchOperation = Operation.createPatch(UriUtils.buildUri(testHost, TestHost.SERVICE_URI, null)) .setBody(patchState); testHost.sendRequestAndWait(patchOperation); }
@Test(expectedExceptions = XenonRuntimeException.class) public void testInvalidPatchStateOverwriteExistingContainerId() throws Throwable { ContainerService.State startState = TestHelper.getContainerServiceStartState(); startState.containerId = "CONTAINER_ID"; Operation startOperation = testHost.startServiceSynchronously(containerService, startState); assertThat(startOperation.getStatusCode(), is(200)); ContainerService.State patchState = new ContainerService.State(); patchState.containerId = "CONTAINER_ID"; Operation patchOperation = Operation.createPatch(UriUtils.buildUri(testHost, TestHost.SERVICE_URI, null)) .setBody(patchState); testHost.sendRequestAndWait(patchOperation); }
@Test(dataProvider = "ValidContainerIdPatchValues") public void testValidPatchStateContainerIdFieldSet(String containerId) throws Throwable { createContainerService(); ContainerService.State patchState = new ContainerService.State(); patchState.containerId = containerId; Operation patchOperation = Operation.createPatch(UriUtils.buildUri(testHost, TestHost.SERVICE_URI, null)) .setBody(patchState); Operation patchResult = testHost.sendRequestAndWait(patchOperation); assertThat(patchResult.getStatusCode(), is(200)); ContainerService.State savedState = testHost.getServiceState(ContainerService.State.class); assertThat(savedState.containerId, is(containerId)); }