diff --git a/storage/src/main/java/com/linkedpipes/etl/storage/distribution/ImportTemplate.java b/storage/src/main/java/com/linkedpipes/etl/storage/distribution/ImportTemplate.java index f27346a2..d6eb8e3e 100644 --- a/storage/src/main/java/com/linkedpipes/etl/storage/distribution/ImportTemplate.java +++ b/storage/src/main/java/com/linkedpipes/etl/storage/distribution/ImportTemplate.java @@ -203,8 +203,10 @@ private void importNewTemplates(Map knownMap) { while (runNextRound) { runNextRound = false; for (Container container : containers) { - if (getLocalResource(knownMap, container) != null) { - // This is a known template. + Resource localFromKnown = getLocalResource(knownMap, container); + if (localFromKnown != null) { + // This is a known template, we add a mapping. + knownMap.put(container.rawTemplate.resource, localFromKnown); continue; } Resource local; @@ -235,6 +237,7 @@ private Resource importNewTemplate( if (pluginFacade.isPluginTemplate(remote.template())) { localResource = remote.template(); } else { + // This is not recognized. localResource = knownMap.get(remote.template()); } if (localResource == null) { diff --git a/storage/src/test/java/com/linkedpipes/etl/storage/distribution/ImportTemplateTest.java b/storage/src/test/java/com/linkedpipes/etl/storage/distribution/ImportTemplateTest.java new file mode 100644 index 00000000..c65fedb0 --- /dev/null +++ b/storage/src/test/java/com/linkedpipes/etl/storage/distribution/ImportTemplateTest.java @@ -0,0 +1,12 @@ +package com.linkedpipes.etl.storage.distribution; + +public class ImportTemplateTest { + + public void importWithKnowParent() { + // Test situation where a template has a parent. + // The parent has already been imported. + // Yet as the parent has knowAs, its original resource must be saved + // to know map. + } + +}