private void sendGetNetworkStateRequest() throws Throwable { Operation getNetworkState = Operation.createGet(networkStateReference) .setCompletion((o, ex) -> { if (ex != null) { host.failIteration(ex); } else { host.completeIteration(); } }); host.testStart(1); host.send(getNetworkState); host.testWait(); }
private void verifyRegistryLinksByRegistryFilter(String registryFilter, Collection<String> tenantLinks, Collection<RegistryState> expectedRegistries) { assertNotNull(expectedRegistries); host.testStart(1); RegistryUtil.findRegistries(host, tenantLinks, registryFilter, (registries, errors) -> { if (errors != null && !errors.isEmpty()) { host.failIteration(errors.iterator().next()); } verifyFoundRegistries(expectedRegistries, registries); }); host.testWait(); }
private void delete(URI uri) throws Throwable { this.host.testStart(1); this.host.sendRequest(Operation .createDelete(uri) .setBody(new ServiceDocument()) .setCompletion(this.host.getCompletion()) .setReferer(this.host.getUri())); this.host.testWait(); }
@Test public void allocateExecutor() throws Throwable { setUp(false); Service s = this.host.startServiceAndWait(MinimalTestService.class, UUID.randomUUID() .toString()); ExecutorService exec = this.host.allocateExecutor(s); this.host.testStart(1); exec.execute(() -> { this.host.completeIteration(); }); this.host.testWait(); }
private void sendGetVolumeStateRequest() throws Throwable { Operation getVolumeState = Operation.createGet(volumeStateReference) .setCompletion((o, ex) -> { if (ex != null) { host.failIteration(ex); } else { host.completeIteration(); } }); host.testStart(1); host.send(getVolumeState); host.testWait(); }
private void delete(URI uri) throws Throwable { this.host.testStart(1); this.host.sendRequest(Operation .createDelete(uri) .setBody(new ServiceDocument()) .setCompletion(this.host.getCompletion()) .setReferer(this.host.getUri())); this.host.testWait(); }
@Test public void allocateExecutor() throws Throwable { setUp(false); Service s = this.host.startServiceAndWait(MinimalTestService.class, UUID.randomUUID() .toString()); ExecutorService exec = this.host.allocateExecutor(s); this.host.testStart(1); exec.execute(() -> { this.host.completeIteration(); }); this.host.testWait(); }
private void verifyRegistryLinksByHostname(String hostname, Collection<String> tenantLinks, Collection<RegistryState> expectedRegistries) { assertNotNull(expectedRegistries); host.testStart(1); RegistryUtil.findRegistriesByHostname(host, hostname, tenantLinks, (registries, errors) -> { if (errors != null && !errors.isEmpty()) { host.failIteration(errors.iterator().next()); } verifyFoundRegistries(expectedRegistries, registries); }); host.testWait(); }
private void commit(String transactionId) throws Throwable { this.defaultHost.testStart(1); Operation patch = SimpleTransactionService.TxUtils.buildCommitRequest(this.defaultHost, transactionId); patch.setCompletion((o, e) -> { if (operationFailed(o, e)) { this.defaultHost.failIteration(e); return; } this.defaultHost.completeIteration(); }); this.defaultHost.send(patch); this.defaultHost.testWait(); }
private void startAndWaitHostNetworkListDataCollection() throws Throwable { host.testStart(1); host.sendRequest(Operation .createPatch(UriUtils.buildUri(host, HostNetworkListDataCollection.DEFAULT_HOST_NETWORK_LIST_DATA_COLLECTION_LINK)) .setBody(networkListCallback) .setReferer(host.getUri()) .setCompletion(host.getCompletion())); host.testWait(); // Wait for data collection to finish waitForDataCollectionFinished(); }
private void abort(String transactionId) throws Throwable { this.defaultHost.testStart(1); Operation patch = SimpleTransactionService.TxUtils.buildAbortRequest(this.defaultHost, transactionId); patch.setCompletion((o, e) -> { if (operationFailed(o, e)) { this.defaultHost.failIteration(e); return; } this.defaultHost.completeIteration(); }); this.defaultHost.send(patch); this.defaultHost.testWait(); }
private void startDataCollectionAndWait() throws Throwable { host.testStart(1); host.sendRequest(Operation .createPatch(UriUtils.buildUri(host, KubernetesEntityDataCollection .DEFAULT_KUBERNETES_ENTITY_DATA_COLLECTION_LINK)) .setBody(listCallback) .setReferer(host.getUri()) .setCompletion(host.getCompletion())); host.testWait(); waitForDataCollectionToFinish(); }
private void commit(String transactionId) throws Throwable { this.defaultHost.testStart(1); Operation patch = SimpleTransactionService.TxUtils.buildCommitRequest(this.defaultHost, transactionId); patch.setCompletion((o, e) -> { if (operationFailed(o, e)) { this.defaultHost.failIteration(e); return; } this.defaultHost.completeIteration(); }); this.defaultHost.send(patch); this.defaultHost.testWait(); }
private void startAndWaitHostVolumeListDataCollection() throws Throwable { host.testStart(1); host.sendRequest(Operation .createPatch(UriUtils.buildUri(host, HostVolumeListDataCollection.DEFAULT_HOST_VOLUME_LIST_DATA_COLLECTION_LINK)) .setBody(volumeListCallback) .setReferer(host.getUri()) .setCompletion(host.getCompletion())); host.testWait(); // Wait for data collection to finish waitForDataCollectionFinished(); }
private void abort(String transactionId) throws Throwable { this.defaultHost.testStart(1); Operation patch = SimpleTransactionService.TxUtils.buildAbortRequest(this.defaultHost, transactionId); patch.setCompletion((o, e) -> { if (operationFailed(o, e)) { this.defaultHost.failIteration(e); return; } this.defaultHost.completeIteration(); }); this.defaultHost.send(patch); this.defaultHost.testWait(); }