Skip to content

Commit

Permalink
moved GatewayException and its (rightful) implementations to new modu…
Browse files Browse the repository at this point in the history
…le "gateway-api"

* added first "pass through" implementation of ConnectionEnforcerActor and ConnectivityCommandEnforcement
* made CleanupCommand a SudoCommand
* moved Signal.hasTypePrefix to WithType.hasTypePrefix and added constants for commonly known commands in WithType
* moved exceptions around and fixed DittoRuntimeExceptions with missing prefixes, e.g. added ProtocolAdapterException for ditto-protocol-adapter

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
  • Loading branch information
thjaeckle committed May 3, 2022
1 parent c3c3e38 commit 93023fb
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -24,6 +24,8 @@
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

import org.eclipse.ditto.base.model.exceptions.DittoInternalErrorException;
import org.eclipse.ditto.base.model.headers.DittoHeaders;
import org.eclipse.ditto.client.internal.AbstractDittoClientTest;
import org.eclipse.ditto.client.streaming.SpliteratorSubscriber;
import org.eclipse.ditto.client.twin.SearchQueryBuilder;
Expand All @@ -32,10 +34,8 @@
import org.eclipse.ditto.json.JsonFieldSelector;
import org.eclipse.ditto.json.JsonObject;
import org.eclipse.ditto.json.JsonPointer;
import org.eclipse.ditto.base.model.headers.DittoHeaders;
import org.eclipse.ditto.things.model.Thing;
import org.eclipse.ditto.things.model.ThingId;
import org.eclipse.ditto.base.model.signals.commands.exceptions.GatewayInternalErrorException;
import org.eclipse.ditto.thingsearch.model.signals.commands.subscription.CancelSubscription;
import org.eclipse.ditto.thingsearch.model.signals.commands.subscription.CreateSubscription;
import org.eclipse.ditto.thingsearch.model.signals.commands.subscription.RequestFromSubscription;
Expand Down Expand Up @@ -125,12 +125,12 @@ public void partialFailure() {
reply(SubscriptionCreated.of(subscriptionId, createSubscription.getDittoHeaders()));
expectMsgClass(RequestFromSubscription.class);
reply(hasNext(subscriptionId, 0, 1));
reply(SubscriptionFailed.of(subscriptionId, GatewayInternalErrorException.newBuilder().message("sorry").build(),
reply(SubscriptionFailed.of(subscriptionId, DittoInternalErrorException.newBuilder().message("sorry").build(),
DittoHeaders.empty()));
final AtomicReference<Thing> thingBox = new AtomicReference<>();
assertThat(searchResultSpliterator.tryAdvance(thingBox::set)).isTrue();
assertThat(thingBox).hasValue(Thing.newBuilder().setId(ThingId.of("x:0")).build());
assertThatExceptionOfType(GatewayInternalErrorException.class)
assertThatExceptionOfType(DittoInternalErrorException.class)
.isThrownBy(() -> searchResultSpliterator.forEachRemaining(thing -> {}));
}

Expand Down

0 comments on commit 93023fb

Please sign in to comment.