/** * Notify the transaction coordinator of a new service */ static Operation notifyTransactionCoordinatorOfNewServiceOp(FactoryService factoryService, Service childService, Operation op) { // some of the basic properties of the child service being created are not // yet set at the point we're intercepting the POST, so we need to set them here childService.setHost(factoryService.getHost()); URI childServiceUri = op.getUri().normalize(); String childServicePath = UriUtils.normalizeUriPath(childServiceUri.getPath()); childService.setSelfLink(childServicePath); // TODO: remove cast by changing childService type at the origin (FactoryService) return notifyTransactionCoordinatorOp((StatefulService) childService, op, null); }
private ServiceDocument getChildTemplate(String childLink) { if (this.childTemplate == null) { try { Service s = createServiceInstance(); s.setHost(getHost()); s.setSelfLink(childLink); s.toggleOption(ServiceOption.FACTORY_ITEM, true); this.childTemplate = s.getDocumentTemplate(); } catch (Throwable e) { logSevere(e); return null; } } return this.childTemplate; }
@Test public void testServiceUiDefaultPath() { class MyService extends StatelessService { } Service s = new MyService(); s.setHost(new VerificationHost()); Path path = Paths.get(Utils.UI_DIRECTORY_NAME, Utils.buildServicePath(MyService.class)); assertEquals(path, Utils.getServiceUiResourcePath(s)); }
@Test public void testServiceUiDefaultPath() { class MyService extends StatelessService { } Service s = new MyService(); s.setHost(new VerificationHost()); Path path = Paths.get(Utils.UI_DIRECTORY_NAME, Utils.buildServicePath(MyService.class)); assertEquals(path, Utils.getServiceUiResourcePath(s)); }
webSocketService.setHost(this); startUiFileContentServices(webSocketService);
serviceInstance.setHost(host); assertNotNull(serviceInstance);
service.setHost(this);
s.setHost(getHost()); if (this.childTemplate == null) {
@Before public void beforeForAuthBase() throws Throwable { AuthUtil.resetProviders(); host.setSystemAuthorizationContext(); startServices(host); waitForServiceAvailability(AuthInitialBootService.SELF_LINK); waitForInitialBootServiceToBeSelfStopped(AuthInitialBootService.SELF_LINK); waitForDefaultRoles(); waitForDefaultUsersAndGroups(); TestContext ctx = new TestContext(1, Duration.ofSeconds(DEFAULT_WAIT_SECONDS_FOR_AUTH_SERVICES)); AuthUtil.getPreferredAuthConfigProvider().waitForInitBootConfig(host, ((CustomizationVerificationHost) host).localUsers, ctx::completeIteration, ctx::failIteration); ctx.await(); privilegedTestService = host.startServiceAndWait(PrivilegedTestService.class, PrivilegedTestService.SELF_LINK); host.resetAuthorizationContext(); testService = new TestService(); testService.setSelfLink(TestService.SELF_LINK); testService.setHost(host); }
@Test public void testBuildServiceConfig() { Service exampleService = new ExampleService(); exampleService.setHost(VerificationHost.create()); ServiceConfiguration config = new ServiceConfiguration(); Utils.buildServiceConfig(config, exampleService); assertEquals(exampleService.getOptions(), config.options); assertEquals(exampleService.getMaintenanceIntervalMicros(), config.maintenanceIntervalMicros); assertEquals(ExampleServiceState.VERSION_RETENTION_LIMIT, config.versionRetentionLimit); assertEquals(ExampleServiceState.VERSION_RETENTION_FLOOR, config.versionRetentionFloor); assertEquals(exampleService.getPeerNodeSelectorPath(), config.peerNodeSelectorPath); assertEquals(exampleService.getDocumentIndexPath(), config.documentIndexPath); }
@Test public void testBuildServiceConfig() { Service exampleService = new ExampleService(); exampleService.setHost(VerificationHost.create()); ServiceConfiguration config = new ServiceConfiguration(); Utils.buildServiceConfig(config, exampleService); assertEquals(exampleService.getOptions(), config.options); assertEquals(exampleService.getMaintenanceIntervalMicros(), config.maintenanceIntervalMicros); assertEquals(ExampleServiceState.VERSION_RETENTION_LIMIT, config.versionRetentionLimit); assertEquals(ExampleServiceState.VERSION_RETENTION_FLOOR, config.versionRetentionFloor); assertEquals(exampleService.getPeerNodeSelectorPath(), config.peerNodeSelectorPath); assertEquals(exampleService.getDocumentIndexPath(), config.documentIndexPath); }