Lines Matching refs:Service
58 WaitOnRunService service = new WaitOnRunService();
59 assertFalse(service.startUpCalled);
61 service.start().get();
62 assertTrue(service.startUpCalled);
63 assertEquals(Service.State.RUNNING, service.state());
65 enterRun.await(); // to avoid stopping the service until run() is invoked
67 service.stop().get();
68 assertTrue(service.shutDownCalled);
69 assertEquals(Service.State.TERMINATED, service.state());
75 WaitOnRunService service = new WaitOnRunService();
77 service.start();
78 service.start();
79 service.startAndWait();
80 assertEquals(Service.State.RUNNING, service.state());
81 service.startAndWait();
82 assertEquals(Service.State.RUNNING, service.state());
84 enterRun.await(); // to avoid stopping the service until run() is invoked
86 service.stop();
87 service.stop();
88 service.stopAndWait();
89 assertEquals(Service.State.TERMINATED, service.state());
90 service.stopAndWait();
91 assertEquals(Service.State.TERMINATED, service.state());
93 assertEquals(Service.State.RUNNING, service.start().get());
94 assertEquals(Service.State.RUNNING, service.startAndWait());
95 assertEquals(Service.State.TERMINATED, service.stop().get());
96 assertEquals(Service.State.TERMINATED, service.stopAndWait());
103 WaitOnRunService service = new WaitOnRunService();
104 service.expectedShutdownState = Service.State.RUNNING;
106 service.start().get();
107 assertTrue(service.startUpCalled);
108 assertEquals(Service.State.RUNNING, service.state());
110 exitRun.countDown(); // the service will exit voluntarily
113 assertTrue(service.shutDownCalled);
114 assertEquals(Service.State.TERMINATED, service.state());
117 service.stop().get(); // no-op
118 assertEquals(Service.State.TERMINATED, service.state());
119 assertTrue(service.shutDownCalled);
169 ThrowOnStartUpService service = new ThrowOnStartUpService();
170 assertFalse(service.startUpCalled);
172 Future<Service.State> startupFuture = service.start();
181 assertTrue(service.startUpCalled);
182 assertEquals(Service.State.FAILED, service.state());
204 ThrowOnRunService service = new ThrowOnRunService();
206 service.start().get();
209 assertTrue(service.shutDownCalled);
210 assertEquals(Service.State.FAILED, service.state());
215 ThrowOnRunService service = new ThrowOnRunService();
216 service.throwOnShutDown = true;
218 service.start().get();
221 assertTrue(service.shutDownCalled);
222 assertEquals(Service.State.FAILED, service.state());
247 ThrowOnShutDown service = new ThrowOnShutDown();
249 service.start().get();
250 assertEquals(Service.State.RUNNING, service.state());
252 service.stop();
256 assertEquals(Service.State.FAILED, service.state());
279 TimeoutOnStartUp service = new TimeoutOnStartUp();
282 service.start().get(1, TimeUnit.MILLISECONDS);
285 assertTrue(e.getMessage().contains(Service.State.STARTING.toString()));