@Override public void beforeHostStart(VerificationHost host) throws Throwable { host.setMaintenanceIntervalMicros(TimeUnit.MILLISECONDS.toMicros( VerificationHost.FAST_MAINT_INTERVAL_MILLIS)); this.host.addPrivilegedService(InMemoryLuceneDocumentIndexService.class); this.host.startServiceAndWait(InMemoryLuceneDocumentIndexService.class, InMemoryLuceneDocumentIndexService.SELF_LINK); this.host.startFactory(InMemoryExampleService.class, InMemoryExampleService::createFactory); this.host.startFactory(ExampleODLService.class, ExampleODLService::createFactory); }
@Override public void beforeHostStart(VerificationHost host) throws Throwable { host.setMaintenanceIntervalMicros(TimeUnit.MILLISECONDS.toMicros( VerificationHost.FAST_MAINT_INTERVAL_MILLIS)); this.host.addPrivilegedService(InMemoryLuceneDocumentIndexService.class); this.host.startServiceAndWait(InMemoryLuceneDocumentIndexService.class, InMemoryLuceneDocumentIndexService.SELF_LINK); this.host.startFactory(InMemoryExampleService.class, InMemoryExampleService::createFactory); this.host.startFactory(ExampleODLService.class, ExampleODLService::createFactory); }
@Before public void setUp() throws Throwable { Service serviceInstance; try { serviceInstance = TestTaskService.class.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException("Failed to create factory for " + TestTaskService.class, e); } host.startFactory(serviceInstance); waitForServiceAvailability(host, TestTaskService.FACTORY_LINK); }
@Before public void setUp() throws Throwable { sender = host.getTestRequestSender(); host.startFactory(ExtensibilitySubscriptionCallbackService.class.newInstance()); }
@Override @Before public void setUp() throws Throwable { host.startFactory(new TestTaskService()); waitForServiceAvailability(TestTaskService.FACTORY_LINK); }
private static void startFactoryServices(BaseModelTest test) throws Throwable { PhotonModelTaskServices.startServices(test.getHost()); MockAdapter.startFactories(test); test.getHost().startFactory(new SubnetRangeService()); test.getHost().startFactory(new IPAddressService()); test.getHost().startFactory(new IPAddressAllocationTaskService()); }
private void startServices() { host.startFactory(new ComputeService()); host.startService(new SslTrustCertificateFactoryService()); waitForServices( SslTrustCertificateService.FACTORY_LINK, ComputeService.FACTORY_LINK); }
@Before public void setUp() throws Throwable { sender = host.getTestRequestSender(); host.startFactory(new EventTopicService()); waitForServiceAvailability(EventTopicService.FACTORY_LINK); initializeChangeResourceNameTopics(); }
private static void startFactoryServices(BaseModelTest test) throws Throwable { PhotonModelTaskServices.startServices(test.getHost()); MockAdapter.startFactories(test); test.getHost().startFactory(new IPAddressService()); }
private VerificationHost restartHost(VerificationHost hostToRestart) throws Throwable { this.host.stopHostAndPreserveState(hostToRestart); this.host.waitForNodeGroupConvergence(this.nodeCount - 1, this.nodeCount - 1); hostToRestart.setPort(0); VerificationHost.restartStatefulHost(hostToRestart, false); // Start in-memory index service, and in-memory example factory. hostToRestart.addPrivilegedService(InMemoryLuceneDocumentIndexService.class); hostToRestart.startFactory(InMemoryExampleService.class, InMemoryExampleService::createFactory); hostToRestart.startServiceAndWait(InMemoryLuceneDocumentIndexService.class, InMemoryLuceneDocumentIndexService.SELF_LINK); hostToRestart.addPrivilegedService(ExampleODLService.class); hostToRestart.startFactory(ExampleODLService.class, ExampleODLService::createFactory); this.host.addPeerNode(hostToRestart); this.host.joinNodesAndVerifyConvergence(this.nodeCount); return hostToRestart; }
private VerificationHost restartHost(VerificationHost hostToRestart) throws Throwable { this.host.stopHostAndPreserveState(hostToRestart); this.host.waitForNodeGroupConvergence(this.nodeCount - 1, this.nodeCount - 1); hostToRestart.setPort(0); VerificationHost.restartStatefulHost(hostToRestart, false); // Start in-memory index service, and in-memory example factory. hostToRestart.addPrivilegedService(InMemoryLuceneDocumentIndexService.class); hostToRestart.startFactory(InMemoryExampleService.class, InMemoryExampleService::createFactory); hostToRestart.startServiceAndWait(InMemoryLuceneDocumentIndexService.class, InMemoryLuceneDocumentIndexService.SELF_LINK); hostToRestart.addPrivilegedService(ExampleODLService.class); hostToRestart.startFactory(ExampleODLService.class, ExampleODLService::createFactory); this.host.addPeerNode(hostToRestart); this.host.joinNodesAndVerifyConvergence(this.nodeCount); return hostToRestart; }
private void checkReusableHostAndCleanup(VerificationHost host) throws Throwable { if (host.isStopping() || !host.isStarted()) { host.start(); host.startFactory(new MigrationTaskService()); host.startFactory(new ImmutableExampleService()); host.waitForServiceAvailable(ExampleService.FACTORY_LINK); host.waitForServiceAvailable(ImmutableExampleService.FACTORY_LINK); host.waitForServiceAvailable(MigrationTaskService.FACTORY_LINK); } host.deleteAllChildServices(UriUtils.buildUri(host, MigrationTaskService.FACTORY_LINK)); host.deleteAllChildServices(UriUtils.buildUri(host, ExampleService.FACTORY_LINK)); }
private void checkReusableHostAndCleanup(VerificationHost host) throws Throwable { if (host.isStopping() || !host.isStarted()) { host.start(); host.startFactory(new MigrationTaskService()); host.startFactory(new ImmutableExampleService()); host.waitForServiceAvailable(ExampleService.FACTORY_LINK); host.waitForServiceAvailable(ImmutableExampleService.FACTORY_LINK); host.waitForServiceAvailable(MigrationTaskService.FACTORY_LINK); } host.deleteAllChildServices(UriUtils.buildUri(host, MigrationTaskService.FACTORY_LINK)); host.deleteAllChildServices(UriUtils.buildUri(host, ExampleService.FACTORY_LINK)); }
private void checkReusableHostAndCleanup(VerificationHost host) throws Throwable { if (host.isStopping() || !host.isStarted()) { host.start(); host.startFactory(new LegacyMigrationTaskService()); host.startFactory(new ImmutableExampleService()); host.waitForServiceAvailable(ExampleService.FACTORY_LINK); host.waitForServiceAvailable(ImmutableExampleService.FACTORY_LINK); host.waitForServiceAvailable(LegacyMigrationTaskService.FACTORY_LINK); } host.deleteAllChildServices(UriUtils.buildUri(host, LegacyMigrationTaskService.FACTORY_LINK)); host.deleteAllChildServices(UriUtils.buildUri(host, ExampleService.FACTORY_LINK)); }
@Before public void setUp() { this.graphQueryFactoryUri = UriUtils .buildUri(this.host, ServiceUriPaths.CORE_GRAPH_QUERIES); this.queryFactoryUri = UriUtils.buildUri(this.host, ServiceUriPaths.CORE_QUERY_TASKS); this.exampleFactoryUri = UriUtils.buildUri(this.host, ExampleService.FACTORY_LINK); this.queryTargetFactoryUri = UriUtils.buildUri(this.host, GraphQueryValidationTestService.FACTORY_LINK); this.host.startFactory(new GraphQueryValidationTestService()); this.isFailureExpected = false; CommandLineArgumentParser.parseFromProperties(this); }
@Before public void setUp() { this.graphQueryFactoryUri = UriUtils .buildUri(this.host, ServiceUriPaths.CORE_GRAPH_QUERIES); this.queryFactoryUri = UriUtils.buildUri(this.host, ServiceUriPaths.CORE_QUERY_TASKS); this.exampleFactoryUri = UriUtils.buildUri(this.host, ExampleService.FACTORY_LINK); this.queryTargetFactoryUri = UriUtils.buildUri(this.host, GraphQueryValidationTestService.FACTORY_LINK); this.host.startFactory(new GraphQueryValidationTestService()); this.isFailureExpected = false; CommandLineArgumentParser.parseFromProperties(this); }
@Before public void setUp() throws Throwable { sender = host.getTestRequestSender(); host.startServiceAndWait(ConfigurationFactoryService.class, ConfigurationFactoryService.SELF_LINK); manager = new ExtensibilitySubscriptionManager(); host.startServiceAndWait(manager, ExtensibilitySubscriptionManager.SELF_LINK, null); host.startServiceAndWait(ExtensibilitySubscriptionFactoryService.class, ExtensibilitySubscriptionFactoryService.SELF_LINK); host.startFactory(new EventTopicService()); waitForServiceAvailability(EventTopicService.FACTORY_LINK); }
@Test public void testHandleMaintenance() throws Throwable { LogServiceStub logService = new LogServiceStub(); logService.setHost(host); host.startFactory(logService); waitForServiceAvailability(LogServiceStub.FACTORY_LINK); LogServiceState logServiceState = doPost(new LogServiceState(), LogServiceStub.FACTORY_LINK); logService.doMaintenance(logServiceState.documentSelfLink); logServiceState = getDocumentNoWait(LogServiceState.class, logServiceState.documentSelfLink); assertNull(logServiceState); }
@Test public void testDocumentIndexingOptionUpdate() throws Throwable { host.startFactory(new ExampleDocumentIndexingOptionsService()); URI uri = UriUtils.buildUri(this.host, ExampleDocumentIndexingOptionsService.FACTORY_LINK); ExampleDocumentIndexingOptionsService.State initialState = new ExampleDocumentIndexingOptionsService.State(); initialState.name = "example1"; ExampleDocumentIndexingOptionsService.State serviceState = this.host.getTestRequestSender().sendAndWait( Operation.createPost(uri).setBody(initialState), ExampleDocumentIndexingOptionsService.State.class); assertEquals("example1", serviceState.name); }
@Test public void testDocumentIndexingOptionUpdate() throws Throwable { host.startFactory(new ExampleDocumentIndexingOptionsService()); URI uri = UriUtils.buildUri(this.host, ExampleDocumentIndexingOptionsService.FACTORY_LINK); ExampleDocumentIndexingOptionsService.State initialState = new ExampleDocumentIndexingOptionsService.State(); initialState.name = "example1"; ExampleDocumentIndexingOptionsService.State serviceState = this.host.getTestRequestSender().sendAndWait( Operation.createPost(uri).setBody(initialState), ExampleDocumentIndexingOptionsService.State.class); assertEquals("example1", serviceState.name); }