labels);
/**
- * Delete all versions for a specific SCL File using it's ID.
+ * Delete all versions for a specific SCL File using its ID.
*
* @param type The type of SCL where to find the SCL File
* @param id The ID of the SCL File to delete.
*/
- @Transactional(REQUIRED)
void delete(SclFileType type, UUID id);
/**
- * Delete passed versions for a specific SCL File using it's ID.
+ * Delete passed versions for a specific SCL File using its ID.
*
* @param type The type of SCL where to find the SCL File
* @param id The ID of the SCL File to delete.
* @param version The version of that SCL File to delete.
*/
- @Transactional(REQUIRED)
void delete(SclFileType type, UUID id, Version version);
}
diff --git a/repository/src/main/java/org/lfenergy/compas/scl/data/util/SclElementProcessor.java b/repository/src/main/java/org/lfenergy/compas/scl/data/util/SclElementProcessor.java
index 2453cf3c..88d6db2c 100644
--- a/repository/src/main/java/org/lfenergy/compas/scl/data/util/SclElementProcessor.java
+++ b/repository/src/main/java/org/lfenergy/compas/scl/data/util/SclElementProcessor.java
@@ -8,6 +8,7 @@
import org.w3c.dom.Element;
import org.w3c.dom.Node;
+import javax.enterprise.context.ApplicationScoped;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@@ -22,6 +23,7 @@
* Support class to work with the SCL XML in a generic way as W3C Element/Node class.
* This way multiple versions of the SCL XSD can easily be supported.
*/
+@ApplicationScoped
public class SclElementProcessor {
/**
* Search for the SCL Header in the SCL Root Element and return that.
@@ -96,9 +98,50 @@ public Element addCompasElement(Element compasPrivate, String localName, String
return element;
}
+ /**
+ * The method will remove all newer Hitem Element, including the version passed from the History Element.
+ * It will search for Hitem Element where the Revision Attribute is empty and the version has the
+ * pattern "Major version"."Minor version"."Patch version".
+ *
+ * If the version is the same or newer the Hitem will be removed from the History Element.
+ *
+ * @param headerElement The Header Element containing the History Items.
+ * @param version The version from which to remove.
+ */
+ public void cleanupHistoryItem(Element headerElement, Version version) {
+ var history = getChildNodesByName(headerElement, SCL_HISTORY_ELEMENT_NAME, SCL_NS_URI).stream().findFirst();
+ history.ifPresent(historyElement ->
+ getChildNodesByName(historyElement, SCL_HITEM_ELEMENT_NAME, SCL_NS_URI)
+ .stream()
+ .filter(hItemElement -> hItemElement.getAttribute("revision").isBlank())
+ .forEach(hItemElement -> {
+ if (shouldRemoveHItem(hItemElement, version)) {
+ historyElement.removeChild(hItemElement);
+ }
+ })
+ );
+ }
+
+ /**
+ * Check if the version uses the pattern that matches the one used by CoMPAS and if this is the case
+ * compare the two versions and determine if the HItem version is smaller or the same as the new one
+ * being created.
+ *
+ * @param hItemElement The HItem Element to check the version attribute from.
+ * @param version The new version that will be created.
+ * @return True if the HItem has a smaller or the same version and should be removed.
+ */
+ boolean shouldRemoveHItem(Element hItemElement, Version version) {
+ var hItemVersion = hItemElement.getAttribute("version");
+ if (hItemVersion.isBlank() || !hItemVersion.matches(Version.PATTERN)) {
+ return false;
+ }
+ return version.compareTo(new Version(hItemVersion)) <= 0;
+ }
+
/**
* Add a Hitem to the History Element from the Header. If the Header doesn't contain a History Element
- * this Element will also be created. The revision attribute will be empty, the when will be set to the
+ * this Element will also be created. The revision attribute will be empty, the "when" will be set to the
* current date.
*
* @param header The Header Element from SCL under which the History Element can be found/added.
@@ -138,7 +181,7 @@ public Element addHistoryItem(Element header, String who, String fullmessage, Ve
*/
public Optional getAttributeValue(Element element, String attributeName) {
var value = element.getAttribute(attributeName);
- return (value != null && !value.isBlank()) ? Optional.of(value) : Optional.empty();
+ return (!value.isBlank()) ? Optional.of(value) : Optional.empty();
}
/**
diff --git a/repository/src/test/java/org/lfenergy/compas/scl/data/exception/CompasSclDataServiceExceptionTest.java b/repository/src/test/java/org/lfenergy/compas/scl/data/exception/CompasSclDataServiceExceptionTest.java
index 1dce9665..5ba8184d 100644
--- a/repository/src/test/java/org/lfenergy/compas/scl/data/exception/CompasSclDataServiceExceptionTest.java
+++ b/repository/src/test/java/org/lfenergy/compas/scl/data/exception/CompasSclDataServiceExceptionTest.java
@@ -6,14 +6,14 @@
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.lfenergy.compas.scl.data.exception.CompasSclDataServiceErrorCode.UNKNOWN_CHANGE_SET_TYPE_ERROR_CODE;
+import static org.lfenergy.compas.scl.data.exception.CompasSclDataServiceErrorCode.CREATION_ERROR_CODE;
class CompasSclDataServiceExceptionTest {
@Test
void constructor_WhenCalledWithOnlyMessage_ThenMessageCanBeRetrieved() {
String expectedMessage = "The message";
CompasSclDataServiceException exception =
- new CompasSclDataServiceException(UNKNOWN_CHANGE_SET_TYPE_ERROR_CODE, expectedMessage);
+ new CompasSclDataServiceException(CREATION_ERROR_CODE, expectedMessage);
assertEquals(expectedMessage, exception.getMessage());
}
@@ -23,7 +23,7 @@ void constructor_WhenCalledWithCauseAndMessage_ThenCauseAndMessageCanBeRetrieved
String expectedMessage = "The message";
Exception expectedCause = new RuntimeException();
CompasSclDataServiceException exception =
- new CompasSclDataServiceException(UNKNOWN_CHANGE_SET_TYPE_ERROR_CODE, expectedMessage, expectedCause);
+ new CompasSclDataServiceException(CREATION_ERROR_CODE, expectedMessage, expectedCause);
assertEquals(expectedMessage, exception.getMessage());
assertEquals(expectedCause, exception.getCause());
diff --git a/repository/src/test/java/org/lfenergy/compas/scl/data/model/VersionTest.java b/repository/src/test/java/org/lfenergy/compas/scl/data/model/VersionTest.java
index 90f4a9c8..ff96f076 100644
--- a/repository/src/test/java/org/lfenergy/compas/scl/data/model/VersionTest.java
+++ b/repository/src/test/java/org/lfenergy/compas/scl/data/model/VersionTest.java
@@ -13,7 +13,6 @@ void constructor_WhenCalledWithNullOrEmptyValue_ThenExceptionThrown() {
var expectedMessage = "Version can't be null or empty";
assertThrows(IllegalArgumentException.class, () -> new Version(null), expectedMessage);
-
assertThrows(IllegalArgumentException.class, () -> new Version(""), expectedMessage);
}
@@ -93,4 +92,25 @@ void equals_WhenTwoSameObject_ThenEqualsShouldAlsoBeTheSame() {
void toString_WhenCalled_ThenCorrectStringReturned() {
assertEquals("1.5.8", new Version(1, 5, 8).toString());
}
+
+ @Test
+ void compareTo_WhenWhenMajorVersionAreDifferent_ThenCorrectResult() {
+ assertEquals(-1, new Version("1.0.0").compareTo(new Version("2.0.0")));
+ assertEquals(0, new Version("1.0.0").compareTo(new Version("1.0.0")));
+ assertEquals(1, new Version("2.0.0").compareTo(new Version("1.0.0")));
+ }
+
+ @Test
+ void compareTo_WhenWhenMinorVersionAreDifferent_ThenCorrectResult() {
+ assertEquals(-1, new Version("1.1.0").compareTo(new Version("1.2.0")));
+ assertEquals(0, new Version("1.1.0").compareTo(new Version("1.1.0")));
+ assertEquals(1, new Version("1.2.0").compareTo(new Version("1.1.0")));
+ }
+
+ @Test
+ void compareTo_WhenWhenPathVersionAreDifferent_ThenCorrectResult() {
+ assertEquals(-1, new Version("1.1.1").compareTo(new Version("1.1.2")));
+ assertEquals(0, new Version("1.1.1").compareTo(new Version("1.1.1")));
+ assertEquals(1, new Version("1.1.2").compareTo(new Version("1.1.1")));
+ }
}
\ No newline at end of file
diff --git a/repository/src/test/java/org/lfenergy/compas/scl/data/repository/AbstractCompasSclDataRepositoryTest.java b/repository/src/test/java/org/lfenergy/compas/scl/data/repository/AbstractCompasSclDataRepositoryTest.java
index 51cd112a..f16b2fb3 100644
--- a/repository/src/test/java/org/lfenergy/compas/scl/data/repository/AbstractCompasSclDataRepositoryTest.java
+++ b/repository/src/test/java/org/lfenergy/compas/scl/data/repository/AbstractCompasSclDataRepositoryTest.java
@@ -12,6 +12,7 @@
import org.lfenergy.compas.scl.data.util.SclElementProcessor;
import org.lfenergy.compas.scl.extensions.model.SclFileType;
+import java.util.List;
import java.util.UUID;
import static org.junit.jupiter.api.Assertions.*;
@@ -26,6 +27,7 @@ public abstract class AbstractCompasSclDataRepositoryTest {
protected static final String NAME_1 = "SCL-NAME1";
protected static final String NAME_2 = "SCL-NAME2";
protected static final String WHO = "User 1";
+ protected static final List LABELS = List.of("Label-1", "Label-2");
// Use different types, so tests don't conflict with each other.
protected static final SclFileType LIST1_TYPE = SclFileType.CID;
@@ -51,7 +53,7 @@ void list_WhenRecordAdded_ThenRecordFound() {
var version = new Version(1, 0, 0);
var uuid = UUID.randomUUID();
var scl = readCompasSCL(uuid, version, NAME_1);
- getRepository().create(LIST2_TYPE, uuid, NAME_1, scl, version, WHO);
+ getRepository().create(LIST2_TYPE, uuid, NAME_1, scl, version, WHO, LABELS);
var items = getRepository().list(LIST2_TYPE);
@@ -71,10 +73,10 @@ void list_WhenTwoRecordAdded_ThenBothRecordsFound() {
var version = new Version(1, 0, 0);
var uuid = UUID.randomUUID();
var scl = readStandardSCL(uuid, version, NAME_1);
- getRepository().create(LIST3_TYPE, uuid, NAME_1, scl, version, WHO);
+ getRepository().create(LIST3_TYPE, uuid, NAME_1, scl, version, WHO, LABELS);
uuid = UUID.randomUUID();
scl = readCompasSCL(uuid, version, NAME_2);
- getRepository().create(LIST3_TYPE, uuid, NAME_2, scl, version, WHO);
+ getRepository().create(LIST3_TYPE, uuid, NAME_2, scl, version, WHO, LABELS);
var items = getRepository().list(LIST3_TYPE);
@@ -87,10 +89,10 @@ void list_WhenTwoVersionsOfARecordAdded_ThenLatestRecordFound() {
var version = new Version(1, 0, 0);
var uuid = UUID.randomUUID();
var scl = readCompasSCL(uuid, version, NAME_1);
- getRepository().create(LIST4_TYPE, uuid, NAME_1, scl, version, WHO);
+ getRepository().create(LIST4_TYPE, uuid, NAME_1, scl, version, WHO, LABELS);
version = new Version(1, 1, 0);
scl = readCompasSCL(uuid, version, NAME_2);
- getRepository().create(LIST4_TYPE, uuid, NAME_2, scl, version, WHO);
+ getRepository().create(LIST4_TYPE, uuid, NAME_2, scl, version, WHO, LABELS);
var items = getRepository().list(LIST4_TYPE);
@@ -121,10 +123,10 @@ void listVersionsByUUID_WhenTwoVersionsOfARecordAdded_ThenAllRecordAreFound() {
var version = new Version(1, 0, 0);
var uuid = UUID.randomUUID();
var scl = readStandardSCL(uuid, version, NAME_1);
- getRepository().create(TYPE, uuid, NAME_1, scl, version, WHO);
+ getRepository().create(TYPE, uuid, NAME_1, scl, version, WHO, LABELS);
version = new Version(1, 1, 0);
scl = readStandardSCL(uuid, version, NAME_2);
- getRepository().create(TYPE, uuid, NAME_2, scl, version, WHO);
+ getRepository().create(TYPE, uuid, NAME_2, scl, version, WHO, LABELS);
var items = getRepository().listVersionsByUUID(TYPE, uuid);
@@ -156,10 +158,10 @@ void findByUUID_WhenTwoVersionsOfARecordAdded_ThenLastRecordIsFound() {
var version = new Version(1, 0, 0);
var uuid = UUID.randomUUID();
var scl = readStandardSCL(uuid, version, NAME_1);
- getRepository().create(TYPE, uuid, NAME_1, scl, version, WHO);
+ getRepository().create(TYPE, uuid, NAME_1, scl, version, WHO, LABELS);
version = new Version(1, 1, 0);
scl = readStandardSCL(uuid, version, NAME_2);
- getRepository().create(TYPE, uuid, NAME_2, scl, version, WHO);
+ getRepository().create(TYPE, uuid, NAME_2, scl, version, WHO, LABELS);
var foundScl = getRepository().findByUUID(TYPE, uuid);
@@ -175,7 +177,7 @@ void findByUUIDWithVersion_WhenCalledWithUnknownVersion_ThenExceptionIsThrown()
var scl = readStandardSCL(uuid, version, NAME_1);
var repository = getRepository();
- repository.create(TYPE, uuid, NAME_1, scl, version, WHO);
+ repository.create(TYPE, uuid, NAME_1, scl, version, WHO, LABELS);
var unknownVersion = new Version(1, 1, 1);
var exception = assertThrows(CompasNoDataFoundException.class,
@@ -188,10 +190,10 @@ void findByUUIDWithVersion_WhenTwoVersionsOfARecordAdded_ThenCorrectRecordIsFoun
var expectedVersion = new Version(1, 0, 0);
var uuid = UUID.randomUUID();
var scl = readStandardSCL(uuid, expectedVersion, NAME_1);
- getRepository().create(TYPE, uuid, NAME_1, scl, expectedVersion, WHO);
+ getRepository().create(TYPE, uuid, NAME_1, scl, expectedVersion, WHO, LABELS);
var version = new Version(1, 1, 0);
scl = readStandardSCL(uuid, version, NAME_1);
- getRepository().create(TYPE, uuid, NAME_1, scl, version, WHO);
+ getRepository().create(TYPE, uuid, NAME_1, scl, version, WHO, LABELS);
var foundScl = getRepository().findByUUID(TYPE, uuid, expectedVersion);
@@ -205,7 +207,7 @@ void hasDuplicateSclName_WhenUsingSclNameThatHasNotBeenUsedYet_ThenNoDuplicateIs
var expectedVersion = new Version(1, 0, 0);
var uuid = UUID.randomUUID();
var scl = readStandardSCL(uuid, expectedVersion, NAME_1);
- getRepository().create(TYPE, uuid, NAME_1, scl, expectedVersion, WHO);
+ getRepository().create(TYPE, uuid, NAME_1, scl, expectedVersion, WHO, LABELS);
assertFalse(getRepository().hasDuplicateSclName(TYPE, "Some other name"));
}
@@ -215,10 +217,10 @@ void findMetaInfoByUUID_WhenTwoVersionsOfARecordAdded_ThenLastRecordIsFound() {
var version = new Version(1, 0, 0);
var uuid = UUID.randomUUID();
var scl = readStandardSCL(uuid, version, NAME_1);
- getRepository().create(TYPE, uuid, NAME_1, scl, version, WHO);
+ getRepository().create(TYPE, uuid, NAME_1, scl, version, WHO, LABELS);
version = new Version(1, 1, 0);
scl = readStandardSCL(uuid, version, NAME_2);
- getRepository().create(TYPE, uuid, NAME_2, scl, version, WHO);
+ getRepository().create(TYPE, uuid, NAME_2, scl, version, WHO, LABELS);
var metaInfo = getRepository().findMetaInfoByUUID(TYPE, uuid);
@@ -243,7 +245,7 @@ void createAndFind_WhenSclAdded_ThenScLStoredAndLastVersionCanBeFound() {
var version = new Version(1, 0, 0);
var uuid = UUID.randomUUID();
var scl = readStandardSCL(uuid, version, NAME_1);
- getRepository().create(TYPE, uuid, NAME_1, scl, version, WHO);
+ getRepository().create(TYPE, uuid, NAME_1, scl, version, WHO, LABELS);
var foundScl = getRepository().findByUUID(TYPE, uuid);
@@ -257,11 +259,11 @@ void createAndFind_WhenMoreVersionOfSclAdded_ThenDefaultSCLLastVersionReturned()
var version = new Version(1, 0, 0);
var uuid = UUID.randomUUID();
var scl = readStandardSCL(uuid, version, NAME_1);
- getRepository().create(TYPE, uuid, NAME_1, scl, version, WHO);
+ getRepository().create(TYPE, uuid, NAME_1, scl, version, WHO, LABELS);
var nextVersion = version.getNextVersion(ChangeSetType.MAJOR);
var nextScl = readStandardSCL(uuid, nextVersion, NAME_1);
- getRepository().create(TYPE, uuid, NAME_1, nextScl, nextVersion, WHO);
+ getRepository().create(TYPE, uuid, NAME_1, nextScl, nextVersion, WHO, LABELS);
var foundScl = getRepository().findByUUID(TYPE, uuid);
@@ -275,11 +277,11 @@ void createAndFind_WhenMoreVersionOfSCLAdded_ThenSCLOldVersionCanBeFound() {
var version = new Version(1, 0, 0);
var uuid = UUID.randomUUID();
var scl = readStandardSCL(uuid, version, NAME_1);
- getRepository().create(TYPE, uuid, NAME_1, scl, version, WHO);
+ getRepository().create(TYPE, uuid, NAME_1, scl, version, WHO, LABELS);
var nextVersion = version.getNextVersion(ChangeSetType.MAJOR);
var nextScl = readStandardSCL(uuid, nextVersion, NAME_1);
- getRepository().create(TYPE, uuid, NAME_1, nextScl, nextVersion, WHO);
+ getRepository().create(TYPE, uuid, NAME_1, nextScl, nextVersion, WHO, LABELS);
var foundScl = getRepository().findByUUID(TYPE, uuid, version);
@@ -292,10 +294,10 @@ void createAndFind_WhenMoreVersionOfSCLAdded_ThenSCLOldVersionCanBeFound() {
void createAndDelete_WhenSclAddedAndDelete_ThenScLStoredAndRemoved() {
var version = new Version(1, 0, 0);
var uuid = UUID.randomUUID();
- var scl = readStandardSCL(uuid, version, NAME_1);
+ var scl = readCompasSCL(uuid, version, NAME_1);
var repository = getRepository();
- repository.create(TYPE, uuid, NAME_1, scl, version, WHO);
+ repository.create(TYPE, uuid, NAME_1, scl, version, WHO, LABELS);
var foundScl = repository.findByUUID(TYPE, uuid);
assertNotNull(foundScl);
assertEquals(getIdFromHeader(scl), getIdFromHeader(foundScl));
@@ -310,17 +312,17 @@ void createAndDelete_WhenSclAddedAndDelete_ThenScLStoredAndRemoved() {
void createAndDeleteAll_WhenSclAddedAndDelete_ThenScLStoredAndRemoved() {
var version = new Version(1, 0, 0);
var uuid = UUID.randomUUID();
- var scl = readStandardSCL(uuid, version, NAME_1);
+ var scl = readCompasSCL(uuid, version, NAME_1);
var repository = getRepository();
- repository.create(TYPE, uuid, NAME_1, scl, version, WHO);
+ repository.create(TYPE, uuid, NAME_1, scl, version, WHO, LABELS);
var foundScl = repository.findByUUID(TYPE, uuid);
assertNotNull(foundScl);
assertEquals(getIdFromHeader(scl), getIdFromHeader(foundScl));
assertEquals(getVersionFromHeader(scl), getVersionFromHeader(foundScl));
version = version.getNextVersion(ChangeSetType.MAJOR);
- repository.create(TYPE, uuid, NAME_1, scl, version, WHO);
+ repository.create(TYPE, uuid, NAME_1, scl, version, WHO, LABELS);
foundScl = repository.findByUUID(TYPE, uuid);
assertNotNull(foundScl);
assertEquals(getIdFromHeader(scl), getIdFromHeader(foundScl));
diff --git a/repository/src/test/java/org/lfenergy/compas/scl/data/util/SclElementProcessorTest.java b/repository/src/test/java/org/lfenergy/compas/scl/data/util/SclElementProcessorTest.java
index 8c88e0c2..d5930ffc 100644
--- a/repository/src/test/java/org/lfenergy/compas/scl/data/util/SclElementProcessorTest.java
+++ b/repository/src/test/java/org/lfenergy/compas/scl/data/util/SclElementProcessorTest.java
@@ -9,6 +9,9 @@
import org.lfenergy.compas.scl.data.model.Version;
import org.w3c.dom.Element;
+import java.util.List;
+import java.util.Optional;
+
import static org.junit.jupiter.api.Assertions.*;
import static org.lfenergy.compas.scl.data.SclDataServiceConstants.*;
import static org.lfenergy.compas.scl.data.exception.CompasSclDataServiceErrorCode.HEADER_NOT_FOUND_ERROR_CODE;
@@ -188,6 +191,73 @@ void getAttributeValue_WhenCalledForNonExistingAttribute_ThenOptionalEmptyReturn
assertFalse(result.isPresent());
}
+ @Test
+ void cleanupHistoryItem_WhenCalledWithVersion_ThenSameAndNewerVersionsAreRemoved() {
+ var scl = readSCL("scl_cleanup_history.scd");
+
+ assertEquals(7, getHItems(scl).size());
+ processor.cleanupHistoryItem(processor.getSclHeader(scl).orElseThrow(), new Version("1.0.2"));
+ assertEquals(5, getHItems(scl).size());
+ }
+
+ @Test
+ void shouldRemoveHItem_WhenCalledWithInvalidVersion_ThenFalseReturned() {
+ var scl = readSCL("scl_cleanup_history.scd");
+ var hItem = getHItem(scl, "Siemens");
+
+ assertFalse(processor.shouldRemoveHItem(hItem, new Version("1.0.2")));
+ }
+
+ @Test
+ void shouldRemoveHItem_WhenCalledWithEmptyVersion_ThenFalseReturned() {
+ var scl = readSCL("scl_cleanup_history.scd");
+ var hItem = getHItem(scl, "Empty");
+
+ assertFalse(processor.shouldRemoveHItem(hItem, new Version("1.0.2")));
+ }
+
+ @Test
+ void shouldRemoveHItem_WhenCalledWithOlderVersion_ThenFalseReturned() {
+ var scl = readSCL("scl_cleanup_history.scd");
+ var hItem = getHItem(scl, "Created");
+
+ assertFalse(processor.shouldRemoveHItem(hItem, new Version("1.0.2")));
+ }
+
+ @Test
+ void shouldRemoveHItem_WhenCalledWithSameVersion_ThenTrueReturned() {
+ var scl = readSCL("scl_cleanup_history.scd");
+ var hItem = getHItem(scl, "Updated 1");
+
+ assertTrue(processor.shouldRemoveHItem(hItem, new Version("1.0.2")));
+ }
+
+ @Test
+ void shouldRemoveHItem_WhenCalledWithNewerVersion_ThenTrueReturned() {
+ var scl = readSCL("scl_cleanup_history.scd");
+ var hItem = getHItem(scl, "Updated 2");
+
+ assertTrue(processor.shouldRemoveHItem(hItem, new Version("1.0.2")));
+ }
+
+ private List getHItems(Element scl) {
+ return processor.getSclHeader(scl)
+ .map(header -> processor.getChildNodeByName(header, SCL_HISTORY_ELEMENT_NAME, SCL_NS_URI))
+ .filter(Optional::isPresent)
+ .map(Optional::get)
+ .map(history -> processor.getChildNodesByName(history, SCL_HITEM_ELEMENT_NAME, SCL_NS_URI))
+ .stream()
+ .flatMap(List::stream)
+ .toList();
+ }
+
+ private Element getHItem(Element scl, String what) {
+ return getHItems(scl).stream()
+ .filter(element -> element.getAttribute("what").equals(what))
+ .findFirst()
+ .get();
+ }
+
private Element readSCL(String sclFilename) {
var inputStream = getClass().getResourceAsStream("/scl/" + sclFilename);
assert inputStream != null;
diff --git a/repository/src/test/resources/scl/scl_cleanup_history.scd b/repository/src/test/resources/scl/scl_cleanup_history.scd
new file mode 100644
index 00000000..8f7dfcf3
--- /dev/null
+++ b/repository/src/test/resources/scl/scl_cleanup_history.scd
@@ -0,0 +1,17 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/repository/src/test/resources/scl/scl_compas.scd b/repository/src/test/resources/scl/scl_compas.scd
index 222c7d2c..6753e424 100644
--- a/repository/src/test/resources/scl/scl_compas.scd
+++ b/repository/src/test/resources/scl/scl_compas.scd
@@ -9,6 +9,8 @@
Label-1
Label-2
+ Label-2
+ Label-2