public URI getReferer() { if (this.referer == null) { this.referer = getUri(); } return this.referer; }
@Before public void setUp() throws Exception { try { // Start the tracing service this.host.toggleOperationTracing(this.host.getUri(), true); } catch (Throwable e) { throw new Exception(e); } }
@Before public void setUp() throws Exception { try { // Start the tracing service this.host.toggleOperationTracing(this.host.getUri(), true); } catch (Throwable e) { throw new Exception(e); } }
@Before public void enableTracing() throws Throwable { // Enable operation tracing to verify tracing does not error out with auth enabled. this.host.toggleOperationTracing(this.host.getUri(), true); }
private long getTrustCertsCount() throws Throwable { Operation get = Operation.createGet(host, SslTrustCertificateService.FACTORY_LINK) .setReferer(host.getUri()); return host.sendWithDeferredResult(get, ServiceDocumentQueryResult.class) .toCompletionStage() .toCompletableFuture() .get().documentCount; }
@Before public void setUp() { CommandLineArgumentParser.parseFromProperties(this); URI exampleFactoryUri = UriUtils.buildUri( this.host.getUri(), ExampleService.FACTORY_LINK); URI exampleODLFactoryUri = UriUtils.buildUri( this.host.getUri(), ExampleODLService.FACTORY_LINK); this.host.waitForReplicatedFactoryServiceAvailable( exampleFactoryUri); this.host.waitForReplicatedFactoryServiceAvailable( exampleODLFactoryUri); }
@Test public void updateAndQueryByVersion() throws Throwable { setUpHost(false); this.host.doExampleServiceUpdateAndQueryByVersion(this.host.getUri(), (int) this.serviceCount); }
private VerificationHost setupMetricHost() throws Throwable { // Start a metric Host separately. VerificationHost metricHost = VerificationHost.create(0); metricHost.start(); ServiceTypeCluster.METRIC_SERVICE.setUri(metricHost.getUri().toString()); PhotonModelMetricServices.startServices(metricHost); return metricHost; }
@Test public void updateAndQueryByVersion() throws Throwable { setUpHost(false); this.host.doExampleServiceUpdateAndQueryByVersion(this.host.getUri(), (int) this.serviceCount); }
private ServiceDocumentQueryResult queryDocuments(String documentKind, int desiredCount) throws Throwable { QueryTask.QuerySpecification q = new QueryTask.QuerySpecification(); q.query.setTermPropertyName(ServiceDocument.FIELD_NAME_KIND) .setTermMatchValue(documentKind); q.options = EnumSet .of(QueryTask.QuerySpecification.QueryOption.EXPAND_CONTENT); return this.host .createAndWaitSimpleDirectQuery(this.host.getUri(), q, desiredCount, desiredCount, null); }
private Operation createServiceOperation(Service s) { return Operation.createGet(s.getUri()) .setReferer(host.getUri()) .forceRemote(); }
private Operation createServiceOperation(Service s) { MinimalTestServiceState body = (MinimalTestServiceState) this.host.buildMinimalTestState(); body.id = MinimalTestService.STRING_MARKER_DELAY_COMPLETION; return Operation.createPatch(s.getUri()) .setBody(body) .setReferer(this.host.getUri()); } }
private Operation createServicePatch(Operation op) { return Operation.createPatch(op.getUri()) .setReferer(host.getUri()) .forceRemote() .setBody(op.getBody(MinimalTestServiceState.class)); } }
private Operation createServicePatch(Operation op) { return Operation.createPatch(op.getUri()) .setReferer(host.getUri()) .forceRemote() .setBody(op.getBody(MinimalTestServiceState.class)); } }
@Test public void testFailureCodes() throws Throwable { Operation op = Operation.createGet(this.host.getUri()); Operation.failActionNotSupported(op); ServiceErrorResponse rsp = op.getErrorResponseBody(); assertEquals(op.getStatusCode(), Operation.STATUS_CODE_BAD_METHOD); assertNotNull(rsp); assertEquals(rsp.statusCode, Operation.STATUS_CODE_BAD_METHOD); }
@Test public void testFailureCodes() throws Throwable { Operation op = Operation.createGet(this.host.getUri()); Operation.failActionNotSupported(op); ServiceErrorResponse rsp = op.getErrorResponseBody(); assertEquals(op.getStatusCode(), Operation.STATUS_CODE_BAD_METHOD); assertNotNull(rsp); assertEquals(rsp.statusCode, Operation.STATUS_CODE_BAD_METHOD); }
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(); }
@Test public void testRequestWithNoHostLink() { EntityListCallback request = new EntityListCallback(); host.testStart(1); host.sendRequest( Operation.createPatch(UriUtils.buildUri(host, KubernetesEntityDataCollection .DEFAULT_KUBERNETES_ENTITY_DATA_COLLECTION_LINK)) .setBody(request) .setReferer(host.getUri()) .setCompletion(host.getCompletion())); host.testWait(); }