Skip to content

Commit f877f95

Browse files
committed
try to stabilize MigrateThingDefinitionStrategyTest
1 parent c18f7ba commit f877f95

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

things/service/src/test/java/org/eclipse/ditto/things/service/persistence/actors/strategies/commands/AbstractCommandStrategyTest.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public abstract class AbstractCommandStrategyTest {
6161
protected static final long THING_SIZE_LIMIT_BYTES = Long.parseLong(
6262
System.getProperty(DittoSystemProperties.DITTO_LIMITS_THINGS_MAX_SIZE_BYTES, "-1"));
6363

64-
private static final Duration COMPLETION_WAIT_TIME = Duration.ofSeconds(15);
64+
private static final Duration COMPLETION_WAIT_TIME = Duration.ofSeconds(30);
6565

6666
protected static DittoDiagnosticLoggingAdapter logger;
6767

@@ -228,7 +228,6 @@ protected static <T extends ThingModifiedEvent<?>> T assertStagedModificationRes
228228
CompletableFutureAssert.assertThatCompletionStage(responseStage.getValue())
229229
.isCompletedWithValueMatchingWithin(r -> r.equals(expectedResponse), COMPLETION_WAIT_TIME);
230230

231-
responseStage.getValue().toCompletableFuture().join();
232231
return (T) eventStage.getValue().toCompletableFuture().join();
233232
}
234233

things/service/src/test/java/org/eclipse/ditto/things/service/persistence/actors/strategies/commands/MigrateThingDefinitionStrategyTest.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import org.apache.pekko.actor.ActorSystem;
2020
import org.eclipse.ditto.base.model.headers.DittoHeaders;
2121
import org.eclipse.ditto.internal.utils.persistentactors.commands.CommandStrategy;
22-
import org.eclipse.ditto.internal.utils.persistentactors.results.Result;
2322
import org.eclipse.ditto.json.JsonFactory;
2423
import org.eclipse.ditto.json.JsonObject;
2524
import org.eclipse.ditto.things.model.Thing;
@@ -29,7 +28,6 @@
2928
import org.eclipse.ditto.things.model.signals.commands.modify.MigrateThingDefinition;
3029
import org.eclipse.ditto.things.model.signals.commands.modify.MigrateThingDefinitionResponse;
3130
import org.eclipse.ditto.things.model.signals.events.ThingDefinitionMigrated;
32-
import org.eclipse.ditto.things.model.signals.events.ThingEvent;
3331
import org.eclipse.ditto.things.service.persistence.actors.ETagTestUtils;
3432
import org.junit.Before;
3533
import org.junit.Test;
@@ -44,12 +42,11 @@ public final class MigrateThingDefinitionStrategyTest extends AbstractCommandStr
4442
private MigrateThingDefinitionStrategy underTest;
4543

4644
@Before
47-
public void setUp() throws Exception {
45+
public void setUp() {
4846
final ActorSystem actorSystem = ActorSystem.create("test", ConfigFactory.load("test"));
4947
underTest = new MigrateThingDefinitionStrategy(actorSystem);
5048
}
5149

52-
5350
@Test
5451
public void migrateExistingThing() {
5552
final CommandStrategy.Context<ThingId> context = getDefaultContext();
@@ -60,7 +57,8 @@ public void migrateExistingThing() {
6057
.set("attributes", JsonFactory.newObjectBuilder().set("manufacturer", "New Corp").build())
6158
.build();
6259

63-
final String thingDefinitionUrl = "https://eclipse.dev/ditto/wot/example-models/dimmable-colored-lamp-1.0.0.tm.jsonld";
60+
final String thingDefinitionUrl =
61+
"https://eclipse.dev/ditto/wot/example-models/dimmable-colored-lamp-1.0.0.tm.jsonld";
6462

6563
final MigrateThingDefinition command = MigrateThingDefinition.of(
6664
thingId,
@@ -76,8 +74,8 @@ public void migrateExistingThing() {
7674
getMergedThing(thingDefinitionUrl),
7775
command.getDittoHeaders());
7876

79-
final Result<ThingEvent<?>> result = underTest.apply(context, existingThing, NEXT_REVISION, command);
80-
assertStagedModificationResult(result, ThingDefinitionMigrated.class, expectedResponse, false);
77+
assertStagedModificationResult(underTest, existingThing, command, ThingDefinitionMigrated.class,
78+
expectedResponse);
8179
}
8280

8381
private static JsonObject getThingJson(String thingDefinitionUrl) {

0 commit comments

Comments
 (0)