|
6 | 6 | import com.marklogic.client.io.Format; |
7 | 7 | import com.marklogic.hub.AbstractHubCoreTest; |
8 | 8 | import com.marklogic.hub.dataservices.EntitySearchService; |
| 9 | +import com.marklogic.hub.dataservices.FlowService; |
9 | 10 | import com.marklogic.hub.flow.FlowInputs; |
10 | 11 | import com.marklogic.hub.flow.FlowRunner; |
11 | 12 | import com.marklogic.hub.flow.impl.FlowRunnerImpl; |
|
21 | 22 | public class GetRecordTest extends AbstractHubCoreTest { |
22 | 23 |
|
23 | 24 | private EntitySearchService service; |
| 25 | + private FlowService flowService; |
24 | 26 |
|
25 | 27 | @BeforeEach |
26 | 28 | void beforeEach() { |
27 | 29 | service = EntitySearchService.on(getHubClient().getFinalClient()); |
| 30 | + flowService = FlowService.on(getHubClient().getFinalClient()); |
28 | 31 | } |
29 | 32 |
|
30 | 33 | @Test |
@@ -201,4 +204,25 @@ public void testRecordHistoryTestWithNoProvenanceRecord() { |
201 | 204 | history = (ArrayNode) response.get("history"); |
202 | 205 | assertEquals(0, history.size()); |
203 | 206 | } |
| 207 | + |
| 208 | + @Test |
| 209 | + public void provenanceDataContainsADeletedFlow() { |
| 210 | + installProjectInFolder("test-projects/provenance-test"); |
| 211 | + String path = "test-projects/provenance-test/data/customers"; |
| 212 | + |
| 213 | + FlowInputs inputs = new FlowInputs("inline", "1"); |
| 214 | + inputs.setInputFilePath(readFileFromClasspath(path).getAbsolutePath()); |
| 215 | + FlowRunner flowRunner = new FlowRunnerImpl(getHubClient()); |
| 216 | + flowRunner.runFlow(inputs); |
| 217 | + flowRunner.awaitCompletion(); |
| 218 | + |
| 219 | + // delete a flow |
| 220 | + flowService.deleteFlow("inline"); |
| 221 | + |
| 222 | + ObjectNode response = (ObjectNode) service.getRecord("/customers/customer1.json"); |
| 223 | + ArrayNode history = (ArrayNode) response.get("history"); |
| 224 | + assertEquals(1, history.size()); |
| 225 | + assertNull(history.get(0).get("flow")); |
| 226 | + assertNull(history.get(0).get("step")); |
| 227 | + } |
204 | 228 | } |
0 commit comments