Skip to content

Commit

Permalink
fixed unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
  • Loading branch information
thjaeckle committed Jul 14, 2022
1 parent 4896fe0 commit ebbdf8e
Showing 1 changed file with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.eclipse.ditto.base.model.auth.DittoAuthorizationContextType;
import org.eclipse.ditto.base.model.headers.DittoHeaders;
import org.eclipse.ditto.base.model.headers.WithDittoHeaders;
import org.eclipse.ditto.base.model.json.FieldType;
import org.eclipse.ditto.base.model.json.JsonSchemaVersion;
import org.eclipse.ditto.base.model.signals.events.Event;
import org.eclipse.ditto.internal.utils.pubsub.StreamingType;
Expand All @@ -39,7 +38,6 @@
import org.eclipse.ditto.messages.model.signals.commands.MessageCommand;
import org.eclipse.ditto.messages.model.signals.commands.SendFeatureMessage;
import org.eclipse.ditto.messages.model.signals.commands.SendThingMessage;
import org.eclipse.ditto.policies.api.commands.sudo.SudoRetrievePolicyResponse;
import org.eclipse.ditto.policies.enforcement.PolicyEnforcer;
import org.eclipse.ditto.policies.model.Permissions;
import org.eclipse.ditto.policies.model.PoliciesModelFactory;
Expand Down Expand Up @@ -248,20 +246,32 @@ public void correlationIdSameAfterResponseSuccessful() {
assertThat(retrieveThingResponse.getDittoHeaders().getCorrelationId()).isEqualTo(
read.getDittoHeaders().getCorrelationId());

supervisor.tell(read, getRef());
final DittoHeaders headers2 = headers.toBuilder()
.correlationId(headers.getCorrelationId().get() + "2")
.build();
final ThingCommand<?> read2 = getRetrieveThingCommand(headers2);
final var responseHeaders2 = headers2.toBuilder()
.authorizationContext(AuthorizationContext.newInstance(
DittoAuthorizationContextType.PRE_AUTHENTICATED_CONNECTION,
AuthorizationSubject.newInstance("myIssuer:mySubject")))
.build();

final ThingCommandResponse<?> readResponse2 = getRetrieveThingResponse(responseHeaders2);

supervisor.tell(read2, getRef());

expectAndAnswerSudoRetrieveThing(sudoRetrieveThingResponse);

expectPubsubLiveCommandPublish("publish live read command", read.getEntityId());
expectPubsubLiveCommandPublish("publish live read command", read2.getEntityId());

supervisor.tell(readResponse, getRef());
supervisor.tell(readResponse2, getRef());

expectAndAnswerSudoRetrieveThing(sudoRetrieveThingResponse);
expectAndAnswerSudoRetrieveThing(sudoRetrieveThingResponse);

final RetrieveThingResponse retrieveThingResponse2 = expectMsgClass(RetrieveThingResponse.class);
assertThat(retrieveThingResponse2.getDittoHeaders().getCorrelationId()).isEqualTo(
read.getDittoHeaders().getCorrelationId());
read2.getDittoHeaders().getCorrelationId());
}};
}

Expand Down

0 comments on commit ebbdf8e

Please sign in to comment.