@Test
public void testImportChain() {
final DMNRuntime runtime = DMNRuntimeUtil.createRuntimeWithAdditionalResources("Sayhello1ID1D.dmn",
this.getClass(),
"ModelB.dmn",
"ModelB2.dmn",
"ModelC.dmn");
final DMNModelImpl modelA = (DMNModelImpl) getAndAssertModelNoErrors(runtime, "http://www.trisotech.com/dmn/definitions/_ae5b3c17-1ac3-4e1d-b4f9-2cf861aec6d9", "Say hello 1ID1D");
assertThat(modelA.getImportChainAliases().entrySet(), hasSize(0));
final DMNModelImpl modelB = (DMNModelImpl) getAndAssertModelNoErrors(runtime, "http://www.trisotech.com/dmn/definitions/_2a1d771a-a899-4fef-abd6-fc894332337c", "Model B");
assertThat(modelB.getImportChainAliases().entrySet(), hasSize(1));
assertThat(modelB.getImportChainAliases(), hasEntry(is("http://www.trisotech.com/dmn/definitions/_ae5b3c17-1ac3-4e1d-b4f9-2cf861aec6d9"),
contains(Collections.singletonList("modelA"))));
final DMNModelImpl modelC = (DMNModelImpl) getAndAssertModelNoErrors(runtime, "http://www.trisotech.com/dmn/definitions/_10435dcd-8774-4575-a338-49dd554a0928", "Model C");
assertThat(modelC.getImportChainAliases().entrySet(), hasSize(3));
assertThat(modelC.getImportChainAliases(), hasEntry(is("http://www.trisotech.com/dmn/definitions/_2a1d771a-a899-4fef-abd6-fc894332337c"),
contains(Collections.singletonList("Model B"))));
assertThat(modelC.getImportChainAliases(), hasEntry(is("http://www.trisotech.com/definitions/_9d46ece4-a96c-4cb0-abc0-0ca121ac3768"),
contains(Collections.singletonList("Model B2"))));
assertThat(modelC.getImportChainAliases(), hasEntry(is("http://www.trisotech.com/dmn/definitions/_ae5b3c17-1ac3-4e1d-b4f9-2cf861aec6d9"),
containsInAnyOrder(Arrays.asList("Model B2", "modelA"),
Arrays.asList("Model B", "modelA"))));
}
}