diff --git a/basyx.submodelservice/basyx.submodelservice-core/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/SubmodelServiceSuite.java b/basyx.submodelservice/basyx.submodelservice-core/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/SubmodelServiceSuite.java index 94820e893..df0da52b5 100644 --- a/basyx.submodelservice/basyx.submodelservice-core/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/SubmodelServiceSuite.java +++ b/basyx.submodelservice/basyx.submodelservice-core/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/SubmodelServiceSuite.java @@ -305,9 +305,11 @@ public void createSubmodelElement() { property.setValue("205"); SubmodelService submodelService = getSubmodelService(technicalData); - submodelService.createSubmodelElement(property); + SubmodelElement responseSubmodelElement = submodelService.createSubmodelElement(property); SubmodelElement submodelEl = submodelService.getSubmodelElement("test123"); + + assertEquals(submodelEl, responseSubmodelElement); assertEquals("test123", submodelEl.getIdShort()); } @@ -334,18 +336,20 @@ public void createNestedSubmodelElement() { Property propertyInSmeList = new DefaultProperty.Builder().idShort("test456").category("cat1").value("305").valueType(DataTypeDefXsd.INTEGER).build(); String idShortPathPropertyInSmeCol = DummySubmodelFactory.SUBMODEL_OPERATIONAL_DATA_ELEMENT_COLLECTION_ID_SHORT; - submodelService.createSubmodelElement(idShortPathPropertyInSmeCol, propertyInSmeCol); + SubmodelElement responseSubmodelElementCol = submodelService.createSubmodelElement(idShortPathPropertyInSmeCol, propertyInSmeCol); String idShortPathPropertyInSmeList = DummySubmodelFactory.SUBMODEL_OPERATIONAL_DATA_ELEMENT_COLLECTION_ID_SHORT + "." + DummySubmodelFactory.SUBMODEL_OPERATIONAL_DATA_ELEMENT_LIST_ID_SHORT; - submodelService.createSubmodelElement(idShortPathPropertyInSmeList, propertyInSmeList); + SubmodelElement responseSubmodelElementList = submodelService.createSubmodelElement(idShortPathPropertyInSmeList, propertyInSmeList); idShortPathPropertyInSmeCol = idShortPathPropertyInSmeCol.concat(".test123"); SubmodelElement propertyInCollectionCreated = submodelService.getSubmodelElement(idShortPathPropertyInSmeCol); assertEquals("test123", propertyInCollectionCreated.getIdShort()); + assertEquals(propertyInCollectionCreated, responseSubmodelElementCol); idShortPathPropertyInSmeList = idShortPathPropertyInSmeList.concat("[1]"); SubmodelElement propertyInSmeListCreated = submodelService.getSubmodelElement(idShortPathPropertyInSmeList); assertEquals("test456", propertyInSmeListCreated.getIdShort()); + assertEquals(propertyInSmeListCreated, responseSubmodelElementList); } @Test @@ -372,13 +376,14 @@ public void updateNonNestedSME() { String idShortPath = "dummyProperty"; Property property = createDummyProperty(idShortPath); - submodelService.createSubmodelElement(property); + SubmodelElement responseSubmodelElement = submodelService.createSubmodelElement(property); Property expectedUpdatedProperty = SubmodelServiceHelper.createDummyProperty(idShortPath, "arbitraryValue", DataTypeDefXsd.STRING); submodelService.updateSubmodelElement(idShortPath, expectedUpdatedProperty); Property actualUpdatedProperty = (Property) submodelService.getSubmodelElement(idShortPath); assertEquals(expectedUpdatedProperty, actualUpdatedProperty); + assertEquals(submodelService.getSubmodelElement(idShortPath), responseSubmodelElement); } @Test diff --git a/basyx.submodelservice/basyx.submodelservice-feature-mqtt/src/test/java/org/eclipse/digitaltwin/basyx/submodelrepository/feature/mqtt/TestMqttSubmodelObserver.java b/basyx.submodelservice/basyx.submodelservice-feature-mqtt/src/test/java/org/eclipse/digitaltwin/basyx/submodelrepository/feature/mqtt/TestMqttSubmodelObserver.java index 75eab2b75..1e6293dca 100644 --- a/basyx.submodelservice/basyx.submodelservice-feature-mqtt/src/test/java/org/eclipse/digitaltwin/basyx/submodelrepository/feature/mqtt/TestMqttSubmodelObserver.java +++ b/basyx.submodelservice/basyx.submodelservice-feature-mqtt/src/test/java/org/eclipse/digitaltwin/basyx/submodelrepository/feature/mqtt/TestMqttSubmodelObserver.java @@ -97,34 +97,37 @@ public static void tearDownClass() { public void createSubmodelElementEvent() throws DeserializationException { SubmodelElement submodelElement = createSubmodelElementDummy("createSubmodelElementEventId"); - submodelService.createSubmodelElement(submodelElement); + SubmodelElement responseSubmodelElement = submodelService.createSubmodelElement(submodelElement); assertEquals(topicFactory.createCreateSubmodelElementTopic(submodelElement.getIdShort()), listener.lastTopic); assertEquals(submodelElement, deserializeSubmodelElementPayload(listener.lastPayload)); + assertEquals(submodelElement, responseSubmodelElement); } @Test public void updateSubmodelElementEvent() throws DeserializationException { SubmodelElement submodelElement = createSubmodelElementDummy("updateSubmodelElementEventId"); - submodelService.createSubmodelElement(submodelElement); + SubmodelElement responseSubmodelElement = submodelService.createSubmodelElement(submodelElement); SubmodelElementValue value = new PropertyValue("updatedValue"); submodelService.setSubmodelElementValue(submodelElement.getIdShort(), value); assertEquals(topicFactory.createUpdateSubmodelElementTopic(submodelElement.getIdShort()), listener.lastTopic); assertEquals(submodelElement, deserializeSubmodelElementPayload(listener.lastPayload)); + assertEquals(submodelElement, responseSubmodelElement); } @Test public void deleteSubmodelElementEvent() throws DeserializationException { SubmodelElement submodelElement = createSubmodelElementDummy("deleteSubmodelElementEventId"); - submodelService.createSubmodelElement(submodelElement); + SubmodelElement responseSubmodelElement = submodelService.createSubmodelElement(submodelElement); submodelService.deleteSubmodelElement(submodelElement.getIdShort()); assertEquals(topicFactory.createDeleteSubmodelElementTopic(submodelElement.getIdShort()), listener.lastTopic); assertEquals(submodelElement, deserializeSubmodelElementPayload(listener.lastPayload)); + assertEquals(submodelElement, responseSubmodelElement); } @Test @@ -133,13 +136,14 @@ public void createSubmodelElementWithoutValueEvent() throws DeserializationExcep SubmodelElement submodelElement = createSubmodelElementDummy("noValueSubmodelElementEventId"); List qualifierList = createNoValueQualifierList(); submodelElement.setQualifiers(qualifierList); - submodelService.createSubmodelElement(submodelElement); + SubmodelElement responseSubmodelElement = submodelService.createSubmodelElement(submodelElement); assertEquals(topicFactory.createCreateSubmodelElementTopic(submodelElement.getIdShort()), listener.lastTopic); assertNotEquals(submodelElement, deserializeSubmodelElementPayload(listener.lastPayload)); ((Property) submodelElement).setValue(null); assertEquals(submodelElement, deserializeSubmodelElementPayload(listener.lastPayload)); + assertEquals(submodelElement, responseSubmodelElement); } private List createNoValueQualifierList() {