|
38 | 38 | import java.util.concurrent.atomic.AtomicInteger; |
39 | 39 | import java.util.concurrent.atomic.AtomicReference; |
40 | 40 |
|
| 41 | +import org.apache.hugegraph.api.gremlin.GremlinRestExecutor; |
41 | 42 | import org.apache.hugegraph.backend.store.BackendStoreProvider; |
42 | 43 | import org.apache.hugegraph.backend.tx.GraphTransaction; |
43 | 44 | import org.apache.hugegraph.config.HugeConfig; |
|
63 | 64 | import org.apache.hugegraph.util.Events; |
64 | 65 | import org.junit.Test; |
65 | 66 | import org.mockito.AdditionalAnswers; |
| 67 | +import org.mockito.InOrder; |
66 | 68 | import org.mockito.Mockito; |
67 | 69 | import org.apache.tinkerpop.gremlin.server.GremlinServer; |
68 | 70 |
|
@@ -489,12 +491,18 @@ protected void done() { |
489 | 491 | }).when(provider).close(); |
490 | 492 | Whitebox.setInternalState(graph, "storeProvider", provider); |
491 | 493 | HugeGraphServer server = Mockito.mock(HugeGraphServer.class, Mockito.CALLS_REAL_METHODS); |
| 494 | + GremlinRestExecutor restExecutor = Mockito.mock(GremlinRestExecutor.class); |
| 495 | + Whitebox.setInternalState(server, "gremlinRestExecutor", restExecutor); |
492 | 496 | Whitebox.setInternalState(server, "gremlinServer", gremlin); |
493 | 497 | Whitebox.setInternalState(server, "restServer", rest); |
494 | 498 | Whitebox.setInternalState(server, "memoryMonitor", Mockito.mock(MemoryMonitor.class)); |
495 | 499 |
|
496 | 500 | server.stop(); |
497 | 501 |
|
| 502 | + InOrder shutdown = Mockito.inOrder(restExecutor, gremlin, rest); |
| 503 | + shutdown.verify(restExecutor).beginShutdown(); |
| 504 | + shutdown.verify(gremlin).stop(); |
| 505 | + shutdown.verify(rest).shutdown(); |
498 | 506 | Assert.assertEquals(2, earlyCloses.get()); |
499 | 507 | Assert.assertEquals(TaskStatus.SUCCESS, task.status()); |
500 | 508 | Assert.assertTrue("Pending task must persist completion before owner close", completionPersisted.get()); |
|
0 commit comments