@Override protected ServiceHost startService(Operation post, Service service, Operation onDemandTriggeringOp) { if (enablePostgres) { PostgresHostUtils .handleServiceStart(this, post, service, this.postgresDocumentIndexService); } return super.startService(post, service, onDemandTriggeringOp); }
public void setupDockerAdapterService() { dockerAdapterServiceUri = UriUtils.buildUri(host, DockerAdapterService.class); dockerAdapterService = new DockerAdapterService() { @Override protected DockerAdapterCommandExecutor getCommandExecutor() { return getTestCommandExecutor(); } }; host.startService(Operation.createPost(dockerAdapterServiceUri), dockerAdapterService); }
public void setupDockerVolumeAdapterService() { dockerVolumeAdapterServiceUri = UriUtils.buildUri(host, DockerVolumeAdapterService.class); dockerVolumeAdapterService = new DockerVolumeAdapterService() { @Override protected DockerAdapterCommandExecutor getCommandExecutor() { return getTestCommandExecutor(); } }; host.startService(Operation.createPost(dockerVolumeAdapterServiceUri), dockerVolumeAdapterService); }
@Before public void setUp() throws Throwable { expectedResultFound.set(false); errors.set(false); host.startService(new RegistryFactoryService()); waitForServiceAvailability(RegistryFactoryService.SELF_LINK); }
@Before public void startServices() throws Throwable { // set up a service that serves a docker image tar file from the filesystem. // note that to work with an external docker server the IP must be the external // one (not localhost) URL testImageResource = DockerAdapterServiceTest.class.getResource(TEST_IMAGE_FILE); assertNotNull("Missing test resource: " + TEST_IMAGE_FILE, testImageResource); File file = new File(testImageResource.toURI()); URI imageReference = UriUtils.buildPublicUri(host, TEST_IMAGE_URL_PATH); host.startService(Operation.createPost(imageReference), new FileContentService(file)); }
private void startFactoryService() throws Throwable { if (this.host.getServiceStage(this.factoryUri.getPath()) != null) { return; } this.host.startService( Operation.createPost(this.factoryUri), new SomeFactoryService()); this.host.waitForServiceAvailable(SomeFactoryService.SELF_LINK); }
@Before public void setUp() throws Throwable { host.startService(new RegistryFactoryService()); waitForServiceAvailability(RegistryFactoryService.SELF_LINK); }
private SynchTestFactoryService startSynchFactoryService(VerificationHost h) throws Throwable { SynchTestFactoryService factoryService = new SynchTestFactoryService(); h.startService( Operation.createPost(this.factoryUri), factoryService); h.waitForServiceAvailable(SynchTestFactoryService.SELF_LINK); return factoryService; }
private void startFactoryService() throws Throwable { if (this.host.getServiceStage(this.factoryUri.getPath()) != null) { return; } this.host.startService( Operation.createPost(this.factoryUri), new SomeFactoryService()); this.host.waitForServiceAvailable(SomeFactoryService.SELF_LINK); }
private void createBackupFileService(URI localFileUri, String serviceLink) { LocalFileServiceState initialState = new LocalFileServiceState(); initialState.fileOptions = EnumSet.of(StandardOpenOption.WRITE); initialState.localFileUri = localFileUri; Operation post = Operation.createPost(this.host, serviceLink).setBody(initialState); this.host.startService(post, new LocalFileService()); this.host.waitForServiceAvailable(serviceLink); }
private VerificationHost createVerificationHost() throws Throwable { VerificationHost host = VerificationHost.create(0); host.start(); // in-memory index related services host.addPrivilegedService(InMemoryLuceneDocumentIndexService.class); InMemoryLuceneDocumentIndexService inMemoryIndexService = new InMemoryLuceneDocumentIndexService(); Service inMemoryExampleFactory = InMemoryExampleService.createFactory(); host.startService(Operation.createPost(host, ServiceUriPaths.CORE_IN_MEMORY_DOCUMENT_INDEX), inMemoryIndexService); host.startService(Operation.createPost(host, InMemoryExampleService.FACTORY_LINK), inMemoryExampleFactory); host.waitForServiceAvailable(ServiceUriPaths.CORE_IN_MEMORY_DOCUMENT_INDEX, InMemoryExampleService.FACTORY_LINK); return host; }
@Before public void startServices() throws Throwable { mockDockerHost.startService( Operation.createPost(UriUtils.buildUri( mockDockerHost, MockDockerHostService.SELF_LINK)), new MockDockerHostService()); }
private void createRestoreFileService(URI localFileUri, String serviceLink) { LocalFileServiceState initialState = new LocalFileServiceState(); initialState.localFileUri = localFileUri; Operation post = Operation.createPost(this.host, serviceLink).setBody(initialState); this.host.startService(post, new LocalFileService()); this.host.waitForServiceAvailable(serviceLink); }
private void createRestoreFileService(URI localFileUri, String serviceLink) { LocalFileServiceState initialState = new LocalFileServiceState(); initialState.localFileUri = localFileUri; Operation post = Operation.createPost(this.host, serviceLink).setBody(initialState); this.host.startService(post, new LocalFileService()); this.host.waitForServiceAvailable(serviceLink); }
@Test public void getDocumentTemplate() throws Throwable { URI uri = UriUtils.buildUri(this.host, "testGetDocumentInstance"); // starting the service will call getDocumentTemplate - which should throw a RuntimeException, which causes // post to fail. Operation post = Operation.createPost(uri); this.host.startService(post, new GetIllegalDocumentService()); assertEquals(500, post.getStatusCode()); assertTrue(post.getErrorResponseBody().message.contains("myLink")); }
@Before public void startServices() throws Throwable { HostInitTestDcpServicesConfig.startServices(host); HostInitCommonServiceConfig.startServices(host); host.startService(Operation.createPost(UriUtils.buildUri(host, MockTaskFactoryService.SELF_LINK)), new MockTaskFactoryService()); waitForServiceAvailability(ConfigurationFactoryService.SELF_LINK); }
@Before public void startServices() throws Throwable { service = new MockKubernetesHost(); // Set the service to handle all subpaths of its main path service.toggleOption(ServiceOption.URI_NAMESPACE_OWNER, true); mockKubernetesHost.startService( Operation.createPost(UriUtils.buildUri( mockKubernetesHost, MockKubernetesHostService.SELF_LINK)), service); testKubernetesCredentialsLink = createTestKubernetesAuthCredentials(); kubernetesHostState = createKubernetesHostComputeState(testKubernetesCredentialsLink); }
@Before public void setUp() throws Throwable { HostInitKubernetesAdapterServiceConfig.startServices(host, true); host.startService(Operation.createPost(UriUtils.buildUri(host, PKSPlanListService.class)), new PKSPlanListService()); waitForServiceAvailability(MockPKSAdapterService.SELF_LINK); waitForServiceAvailability(PKSPlanListService.SELF_LINK); waitForServiceAvailability(PKSEndpointFactoryService.SELF_LINK); waitForServiceAvailability(ComputeService.FACTORY_LINK); sender = host.getTestRequestSender(); }
@Before public void setUp() throws Throwable { HostInitKubernetesAdapterServiceConfig.startServices(host, true); host.startService(Operation.createPost(UriUtils.buildUri(host, PKSClusterListService.class)), new PKSClusterListService()); waitForServiceAvailability(MockPKSAdapterService.SELF_LINK); waitForServiceAvailability(PKSClusterListService.SELF_LINK); waitForServiceAvailability(PKSEndpointFactoryService.SELF_LINK); waitForServiceAvailability(ComputeService.FACTORY_LINK); sender = host.getTestRequestSender(); }
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(); }