Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Yannic Klem <Yannic.Klem@bosch.io>
  • Loading branch information
Yannic92 committed Jun 22, 2022
1 parent f261696 commit 47ca32b
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void setUp() {
actorSystem = ActorSystem.create("AkkaTestSystem", TestConstants.CONFIG);
protocolAdapterProvider = ProtocolAdapterProvider.load(TestConstants.PROTOCOL_CONFIG, actorSystem);
connectionActorProbe = TestProbe.apply("connectionActor", actorSystem);
MockProxyActor.create(actorSystem, connectionActorProbe.ref());
MockCommandForwarder.create(actorSystem, connectionActorProbe.ref());
proxyActor = connectionActorProbe.expectMsgClass(ActorRef.class);
}

Expand Down Expand Up @@ -173,7 +173,7 @@ void resetActorSystemWithCachingSignalEnrichmentProvider() {
)
);
final TestProbe probe = TestProbe.apply(actorSystem);
MockProxyActor.create(actorSystem, probe.ref());
MockCommandForwarder.create(actorSystem, probe.ref());
proxyActor = probe.expectMsgClass(ActorRef.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*/
package org.eclipse.ditto.connectivity.service.messaging;

import org.eclipse.ditto.edge.service.dispatching.EdgeCommandForwarderActor;

import akka.actor.AbstractActor;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
Expand All @@ -21,11 +23,11 @@
/**
* Mock actor that forwards all messages to the final ActorRef message.
*/
final class MockProxyActor extends AbstractActor {
final class MockCommandForwarder extends AbstractActor {

private final ActorRef notificationRecipient;

private MockProxyActor(final ActorRef notificationRecipient) {
private MockCommandForwarder(final ActorRef notificationRecipient) {
this.notificationRecipient = notificationRecipient;
}

Expand All @@ -36,12 +38,13 @@ private MockProxyActor(final ActorRef notificationRecipient) {
* @param actorSystem the actor system where the mock concierge forwarder is to be created.
*/
public static ActorRef create(final ActorSystem actorSystem, final ActorRef notificationRecipient) {
return actorSystem.actorOf(Props.create(MockProxyActor.class, notificationRecipient), "connectivityRoot");
return actorSystem.actorOf(Props.create(MockCommandForwarder.class, notificationRecipient), "connectivityRoot");
}

@Override
public void preStart() {
getContext().actorOf(Props.create(MockInnerActor.class, notificationRecipient), "connectivityProxyActor");
getContext().actorOf(Props.create(MockInnerActor.class, notificationRecipient),
EdgeCommandForwarderActor.ACTOR_NAME);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void setUp() {
protocolAdapterProvider = ProtocolAdapterProvider.load(TestConstants.PROTOCOL_CONFIG, actorSystem);
clientActorProbe = TestProbe.apply("clientActor", actorSystem);
proxyActorProbe = TestProbe.apply("proxyActor", actorSystem);
MockProxyActor.create(actorSystem, proxyActorProbe.ref());
MockCommandForwarder.create(actorSystem, proxyActorProbe.ref());
proxyActorProbe.expectMsgClass(ActorRef.class).tell(proxyActorProbe.ref(), proxyActorProbe.ref());
proxyActorProbe.expectMsgClass(ActorRef.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -915,11 +915,11 @@ public static ActorRef createConnectionSupervisorActor(final ConnectionId connec

public static ActorRef createConnectionSupervisorActor(final ConnectionId connectionId,
final ActorSystem actorSystem,
final ActorRef proxyActor,
final ActorRef commandForwarderActor,
final ActorRef pubSubMediator) {

final var enforcerActorPropsFactory = ConnectionEnforcerActorPropsFactory.get(actorSystem);
final Props props = ConnectionSupervisorActor.props(proxyActor, pubSubMediator, enforcerActorPropsFactory);
final Props props = ConnectionSupervisorActor.props(commandForwarderActor, pubSubMediator, enforcerActorPropsFactory);

final Props shardRegionMockProps = Props.create(ShardRegionMockActor.class, props, connectionId.toString());

Expand Down
Loading

0 comments on commit 47ca32b

Please sign in to comment.