@@ -97,18 +97,23 @@ protected static void genericSetupClass(BaSyxAASServerConfiguration serverConfig
9797 }
9898
9999 @ Test
100- public void shellLifeCycle () {
100+ public void shellLifeCycle () throws InterruptedException {
101101 MqttV2AASAggregatorTopicFactory aasAggregatorFactory = new MqttV2AASAggregatorTopicFactory (new Base64URLEncoder ());
102102
103103 AssetAdministrationShell shell = createShell (shellIdentifier .getId (), shellIdentifier );
104104
105105 manager .createAAS (shell , getURL ());
106106
107+ waitForPropagation ();
108+
107109 assertEquals (aasAggregatorFactory .createCreateAASTopic (AAS_SERVER_ID ), listener .lastTopic );
108110
109111 assertEquals (shell .getIdShort (), manager .retrieveAAS (shellIdentifier ).getIdShort ());
110112
111113 manager .deleteAAS (shellIdentifier );
114+
115+ waitForPropagation ();
116+
112117 assertEquals (aasAggregatorFactory .createDeleteAASTopic (AAS_SERVER_ID ), listener .lastTopic );
113118 try {
114119 manager .retrieveAAS (shellIdentifier );
@@ -119,7 +124,7 @@ public void shellLifeCycle() {
119124 }
120125
121126 @ Test
122- public void submodelLifeCycle () {
127+ public void submodelLifeCycle () throws InterruptedException {
123128 MqttV2SubmodelAggregatorTopicFactory submodelAggregatorFactory = new MqttV2SubmodelAggregatorTopicFactory (new Base64URLEncoder ());
124129 IIdentifier shellIdentifierForSubmodel = new CustomId ("shellSubmodelId" );
125130 AssetAdministrationShell shell = createShell (shellIdentifierForSubmodel .getId (), shellIdentifierForSubmodel );
@@ -128,12 +133,16 @@ public void submodelLifeCycle() {
128133 Submodel submodel = createSubmodel (submodelIdentifier .getId (), submodelIdentifier );
129134 manager .createSubmodel (shellIdentifierForSubmodel , submodel );
130135
136+ waitForPropagation ();
137+
131138 assertTrue (listener .getTopics ().stream ().anyMatch (t -> t .equals (submodelAggregatorFactory .createCreateSubmodelTopic (shell .getIdentification ().getId (), AAS_SERVER_ID ))));
132139
133140 assertEquals (submodel .getIdShort (), manager .retrieveSubmodel (shellIdentifierForSubmodel , submodelIdentifier ).getIdShort ());
134141
135142 manager .deleteSubmodel (shellIdentifierForSubmodel , submodelIdentifier );
136143
144+ waitForPropagation ();
145+
137146 assertTrue (listener .getTopics ().stream ().anyMatch (t -> t .equals (submodelAggregatorFactory .createDeleteSubmodelTopic (shell .getIdentification ().getId (), AAS_SERVER_ID ))));
138147
139148 try {
@@ -145,6 +154,10 @@ public void submodelLifeCycle() {
145154 manager .deleteAAS (shellIdentifierForSubmodel );
146155 }
147156
157+ private void waitForPropagation () throws InterruptedException {
158+ Thread .sleep (1000 );
159+ }
160+
148161 protected static BaSyxContextConfiguration createBaSyxContextConfiguration () {
149162 BaSyxContextConfiguration config = new BaSyxContextConfiguration ();
150163 config .loadFromResource (BaSyxContextConfiguration .DEFAULT_CONFIG_PATH );
0 commit comments