@Before public void waitForServices() throws Throwable { this.uri = UriUtils.buildUri(this.host, ServiceUriPaths.PROCESS_LOG); this.host.testStart(3); this.host.registerForServiceAvailability(this.host.getCompletion(), ServiceUriPaths.PROCESS_LOG); this.host.registerForServiceAvailability(this.host.getCompletion(), ServiceUriPaths.SYSTEM_LOG); this.host.registerForServiceAvailability(this.host.getCompletion(), ServiceUriPaths.GO_PROCESS_LOG); this.host.testWait(); }
@Before public void waitForServices() throws Throwable { this.uri = UriUtils.buildUri(this.host, ServiceUriPaths.PROCESS_LOG); this.host.testStart(3); this.host.registerForServiceAvailability(this.host.getCompletion(), ServiceUriPaths.PROCESS_LOG); this.host.registerForServiceAvailability(this.host.getCompletion(), ServiceUriPaths.SYSTEM_LOG); this.host.registerForServiceAvailability(this.host.getCompletion(), ServiceUriPaths.GO_PROCESS_LOG); this.host.testWait(); }
protected URI register(VerificationHost host, Class<? extends Service> type) throws Exception { try { TestContext ctx = testCreate(1); Field f = type.getField("SELF_LINK"); String path = (String) f.get(null); host.registerForServiceAvailability(ctx.getCompletion(), path); ctx.await(); } catch (Throwable e) { throw new Exception(e); } return UriUtils.buildUri(host, type); }
public void waitForServiceAvailable(String... links) { for (String link : links) { TestContext ctx = testCreate(1); this.registerForServiceAvailability(ctx.getCompletion(), link); ctx.await(); } }
private void waitForServices(String... services) { host.testStart(services.length); host.registerForServiceAvailability(host.getCompletion(), services); host.testWait(); }
public void waitForServiceAvailable(String... links) { for (String link : links) { TestContext ctx = testCreate(1); this.registerForServiceAvailability(ctx.getCompletion(), link); ctx.await(); } }
@Test public void registerForServiceAvailabilityBeforeAndAfterMultiple() throws Throwable { setUp(false); int serviceCount = 100; this.host.testStart(serviceCount * 3); String[] links = new String[serviceCount]; for (int i = 0; i < serviceCount; i++) { URI u = UriUtils.buildUri(this.host, UUID.randomUUID().toString()); links[i] = u.getPath(); this.host.registerForServiceAvailability(this.host.getCompletion(), u.getPath()); this.host.startService(Operation.createPost(u), ExampleService.createFactory()); this.host.registerForServiceAvailability(this.host.getCompletion(), u.getPath()); } this.host.registerForServiceAvailability(this.host.getCompletion(), links); this.host.testWait(); }
@Test public void registerForServiceAvailabilityBeforeAndAfterMultiple() throws Throwable { setUp(false); int serviceCount = 100; this.host.testStart(serviceCount * 3); String[] links = new String[serviceCount]; for (int i = 0; i < serviceCount; i++) { URI u = UriUtils.buildUri(this.host, UUID.randomUUID().toString()); links[i] = u.getPath(); this.host.registerForServiceAvailability(this.host.getCompletion(), u.getPath()); this.host.startService(Operation.createPost(u), ExampleService.createFactory()); this.host.registerForServiceAvailability(this.host.getCompletion(), u.getPath()); } this.host.registerForServiceAvailability(this.host.getCompletion(), links); this.host.testWait(); }
@Test public void testProjectSelfLinkShouldBeRemovedFromTenantLinksSingleProject() throws Throwable { ProjectState projectState = new ProjectState(); projectState.name = "test-project"; projectState = doPost(projectState, ProjectFactoryService.SELF_LINK); List<String> tenantLinks = new ArrayList<String>(); tenantLinks.add("project1"); tenantLinks.add("project2"); tenantLinks.add(projectState.documentSelfLink); projectState.tenantLinks = tenantLinks; doPatch(projectState, projectState.documentSelfLink); host.registerForServiceAvailability(ProjectsTransformationBootstrapService.startTask(host), true, ProjectsTransformationBootstrapService.FACTORY_LINK); String projectSelfLink = projectState.documentSelfLink; waitFor(() -> { ProjectState state = getDocument(ProjectState.class, projectSelfLink); return !state.tenantLinks.contains(state.documentSelfLink); }); }
private void startHosts() throws Throwable { for (int i = 0; i < this.nodeCount; i++) { Arguments args = new Arguments(); args.port = 0; args.id = "node-" + i; args.sandbox = this.sandboxRoot.resolve(args.id); VerificationHost h = VerificationHost.create(args); h.start(); startServicesOnHost(h); this.hosts.add(h); } joinNodesAndVerifyConvergence(); for (VerificationHost host : this.hosts) { TestContext ctx = host.testCreate(this.services.size()); host.registerForServiceAvailability(ctx.getCompletion(), true, this.services.toArray(new String[] {})); ctx.await(); } }
private void startHosts() throws Throwable { for (int i = 0; i < this.nodeCount; i++) { Arguments args = new Arguments(); args.port = 0; args.id = "node-" + i; args.sandbox = this.sandboxRoot.resolve(args.id); VerificationHost h = VerificationHost.create(args); h.start(); startServicesOnHost(h); this.hosts.add(h); } joinNodesAndVerifyConvergence(); for (VerificationHost host : this.hosts) { TestContext ctx = host.testCreate(this.services.size()); host.registerForServiceAvailability(ctx.getCompletion(), true, this.services.toArray(new String[] {})); ctx.await(); } }
}; host.registerForServiceAvailability(ch, nodeSelectorPath, true, uri.getPath()); ctx.await();
}; host.registerForServiceAvailability(ch, nodeSelectorPath, true, uri.getPath()); ctx.await();
@Override public void registerForServiceAvailability(Operation.CompletionHandler completion, String nodeSelectorPath, boolean checkReplica, String... servicePaths) { log("servicePaths %s: %s", checkReplica, Utils.toJson(servicePaths)); if (enablePostgres && checkReplica) { PostgresHostUtils.registerForReplicatedServiceAvailability(this, completion, isStarted() ? getSystemAuthorizationContext() : null, nodeSelectorPath, servicePaths); return; } super.registerForServiceAvailability(completion, nodeSelectorPath, checkReplica, servicePaths); }
protected void startServices(VerificationHost host) throws Throwable { HostInitCommonServiceConfig.startServices(host); HostInitPhotonModelServiceConfig.startServices(host); HostInitComputeServicesConfig.startServices(host, true); HostInitAuthServiceConfig.startServices(host); host.registerForServiceAvailability(AuthBootstrapService.startTask(host), true, AuthBootstrapService.FACTORY_LINK); }
protected void startServices(VerificationHost host) throws Throwable { HostInitCommonServiceConfig.startServices(host); HostInitPhotonModelServiceConfig.startServices(host); HostInitComputeServicesConfig.startServices(host, true); HostInitAuthServiceConfig.startServices(host); HostInitHarborServices.startServices(host, true); host.registerForServiceAvailability(AuthBootstrapService.startTask(host), true, AuthBootstrapService.FACTORY_LINK); }
doPatch(thirdState, thirdState.documentSelfLink); host.registerForServiceAvailability(ProjectsTransformationBootstrapService.startTask(host), true, ProjectsTransformationBootstrapService.FACTORY_LINK);
private static void startFactoryServices(BaseModelTest test) throws Throwable { test.getHost().startService( Operation.createPost(UriUtils.buildUri(test.getHost(), AuthTranslationService.class)), new AuthTranslationService()); test.testStart(1); test.getHost().registerForServiceAvailability(test.getCompletion(), AuthTranslationService.SELF_LINK); test.testWait(); }
protected void startServices(VerificationHost h) throws Throwable { h.registerForServiceAvailability(CaSigningCertService.startTask(h), true, CaSigningCertService.FACTORY_LINK); HostInitTestDcpServicesConfig.startServices(h); HostInitPhotonModelServiceConfig.startServices(h); HostInitCommonServiceConfig.startServices(h); HostInitComputeServicesConfig.startServices(h, true); HostInitRequestServicesConfig.startServices(h); HostInitDockerAdapterServiceConfig.startServices(h, true); HostInitKubernetesAdapterServiceConfig.startServices(h, true); for (String factoryLink : getFactoryServiceList()) { waitForServiceAvailability(factoryLink); } // Default services: waitForServiceAvailability(h, ResourceNamePrefixService.DEFAULT_RESOURCE_NAME_PREFIX_SELF_LINK); waitForServiceAvailability(h, DEFAULT_GROUP_RESOURCE_POLICY); waitForServiceAvailability(h, SystemContainerDescriptions.AGENT_CONTAINER_DESCRIPTION_LINK); waitForServiceAvailability(h, HostContainerListDataCollection.DEFAULT_HOST_CONTAINER_LIST_DATA_COLLECTION_LINK); waitForServiceAvailability(h, ContainerControlLoopService.CONTROL_LOOP_INFO_LINK); waitForServiceAvailability(ManagementUriParts.AUTH_CREDENTIALS_CA_LINK); waitForInitialBootServiceToBeSelfStopped(ComputeInitialBootService.SELF_LINK); waitForInitialBootServiceToBeSelfStopped(RequestInitialBootService.SELF_LINK); }
newHost.registerForServiceAvailability(ctx.getCompletion(), ServiceUriPaths.PROCESS_LOG); ctx.await();