|
16 | 16 |
|
17 | 17 | package stroom.contentindex; |
18 | 18 |
|
| 19 | +import stroom.cluster.api.ClusterNodeManager; |
| 20 | +import stroom.cluster.lock.api.ClusterLockService; |
| 21 | +import stroom.cluster.lock.mock.MockClusterLockService; |
19 | 22 | import stroom.docref.DocRef; |
20 | 23 | import stroom.explorer.api.ExplorerNodeService; |
21 | 24 | import stroom.explorer.shared.DocContentHighlights; |
22 | 25 | import stroom.explorer.shared.DocContentMatch; |
23 | 26 | import stroom.explorer.shared.FetchHighlightsRequest; |
24 | 27 | import stroom.explorer.shared.FindInContentRequest; |
25 | 28 | import stroom.explorer.shared.StringMatch; |
| 29 | +import stroom.node.api.NodeInfo; |
26 | 30 | import stroom.pipeline.shared.XsltDoc; |
27 | 31 | import stroom.pipeline.xslt.XsltStore; |
28 | 32 | import stroom.security.mock.MockSecurityContext; |
29 | 33 | import stroom.task.api.ExecutorProvider; |
30 | 34 | import stroom.task.api.SimpleTaskContextFactory; |
31 | 35 | import stroom.task.shared.ThreadPool; |
32 | 36 | import stroom.test.AbstractCoreIntegrationTest; |
| 37 | +import stroom.util.io.PathCreator; |
| 38 | +import stroom.util.io.SimplePathCreator; |
| 39 | +import stroom.util.io.TempDirProvider; |
33 | 40 | import stroom.util.shared.PageRequest; |
34 | 41 | import stroom.util.shared.ResultPage; |
35 | 42 |
|
|
42 | 49 | import org.mockito.Mock; |
43 | 50 | import org.mockito.junit.jupiter.MockitoExtension; |
44 | 51 |
|
| 52 | +import java.nio.file.Path; |
45 | 53 | import java.util.Set; |
46 | 54 | import java.util.concurrent.Executor; |
47 | 55 | import java.util.concurrent.ExecutorService; |
@@ -85,14 +93,22 @@ public class TestLuceneContentIndex extends AbstractCoreIntegrationTest { |
85 | 93 | private static ExecutorService executorService; |
86 | 94 | private static ExecutorProvider executorProvider; |
87 | 95 |
|
| 96 | + private final ClusterLockService clusterLockService = new MockClusterLockService(); |
| 97 | + |
88 | 98 | @Inject |
89 | 99 | private XsltStore xsltStore; |
90 | 100 |
|
91 | 101 | private XsltDoc xsltDoc; |
92 | 102 | private DocRef docRef; |
| 103 | + private TempDirProvider tempDirProvider; |
| 104 | + private PathCreator pathCreator; |
93 | 105 |
|
94 | 106 | @Mock |
95 | 107 | ExplorerNodeService explorerNodeService; |
| 108 | + @Mock |
| 109 | + private NodeInfo mockNodeInfo; |
| 110 | + @Mock |
| 111 | + private ClusterNodeManager mockClusterNodeManager; |
96 | 112 |
|
97 | 113 | @BeforeAll |
98 | 114 | static void beforeAll() { |
@@ -121,6 +137,11 @@ void setup() { |
121 | 137 | docRef = xsltStore.createDocument("Test"); |
122 | 138 | xsltDoc = xsltStore.readDocument(docRef).copy().data(TEXT).build(); |
123 | 139 | xsltStore.writeDocument(xsltDoc); |
| 140 | + final Path testDir = getCurrentTestDir(); |
| 141 | + tempDirProvider = () -> testDir.resolve("temp"); |
| 142 | + pathCreator = new SimplePathCreator( |
| 143 | + () -> testDir.resolve("home"), |
| 144 | + tempDirProvider); |
124 | 145 | } |
125 | 146 |
|
126 | 147 | @Test |
@@ -167,12 +188,17 @@ void test(final StringMatch stringMatch, |
167 | 188 |
|
168 | 189 | private DocContentHighlights test(final StringMatch stringMatch) { |
169 | 190 | final LuceneContentIndex contentIndex = new LuceneContentIndex( |
170 | | - this::getCurrentTestDir, |
| 191 | + tempDirProvider, |
| 192 | + pathCreator, |
| 193 | + ContentIndexConfig::new, |
171 | 194 | Set.of(xsltStore), |
172 | 195 | new MockSecurityContext(), |
173 | 196 | new SimpleTaskContextFactory(), |
174 | 197 | explorerNodeService, |
175 | | - executorProvider); |
| 198 | + executorProvider, |
| 199 | + clusterLockService, |
| 200 | + mockNodeInfo, |
| 201 | + mockClusterNodeManager); |
176 | 202 | contentIndex.reindex(); |
177 | 203 | contentIndex.flush(); |
178 | 204 |
|
|
0 commit comments