import org.opendaylight.controller.eos.akka.registry.candidate.command.UnregisterCandidate;
import org.opendaylight.controller.eos.akka.registry.listener.type.command.RegisterListener;
import org.opendaylight.controller.eos.akka.registry.listener.type.command.TypeListenerRegistryCommand;
+import org.opendaylight.mdsal.binding.dom.codec.impl.BindingCodecContext;
+import org.opendaylight.mdsal.binding.generator.impl.DefaultBindingRuntimeGenerator;
+import org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeGenerator;
+import org.opendaylight.mdsal.binding.runtime.spi.BindingRuntimeHelpers;
import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipChange;
import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipListener;
"akka://ClusterSystem@127.0.0.1:2552",
"akka://ClusterSystem@127.0.0.1:2553");
+ private static final BindingRuntimeGenerator BINDING_RUNTIME_GENERATOR = new DefaultBindingRuntimeGenerator();
+
+ protected static BindingCodecContext CODEC_CONTEXT
+ = new BindingCodecContext(BindingRuntimeHelpers.createRuntimeContext());
+
private static final String REMOTE_PROTOCOL = "akka";
private static final String PORT_PARAM = "akka.remote.artery.canonical.port";
private static final String ROLE_PARAM = "akka.cluster.roles";
// Create a classic Akka system since thats what we will have in osgi
final akka.actor.ActorSystem system = akka.actor.ActorSystem.create("ClusterSystem", config);
final ActorRef<BootstrapCommand> eosBootstrap =
- Adapter.spawn(system, EOSMain.create(), "EOSBootstrap");
+ Adapter.spawn(system, EOSMain.create(CODEC_CONTEXT.getInstanceIdentifierCodec()), "EOSBootstrap");
final CompletionStage<RunningContext> ask = AskPattern.ask(eosBootstrap,
GetRunningContext::new,
}
private static Behavior<BootstrapCommand> rootBehavior() {
- return Behaviors.setup(context -> EOSMain.create());
+ return Behaviors.setup(context -> EOSMain.create(CODEC_CONTEXT.getInstanceIdentifierCodec()));
}
protected static void registerCandidates(final ClusterNode node, final DOMEntity entity, final String... members) {
}
protected static void verifyNoNotifications(final MockEntityOwnershipListener listener) {
- await().pollDelay(2, TimeUnit.SECONDS).until(() -> listener.getChanges().isEmpty());
+ verifyNoNotifications(listener, 2);
+ }
+
+ protected static void verifyNoNotifications(final MockEntityOwnershipListener listener, long delaySeconds) {
+ await().pollDelay(delaySeconds, TimeUnit.SECONDS).until(() -> listener.getChanges().isEmpty());
+ }
+
+ protected static void verifyNoAdditionalNotifications(
+ final MockEntityOwnershipListener listener, long delaySeconds) {
+ listener.resetListener();
+ verifyNoNotifications(listener, delaySeconds);
}
protected static final class ClusterNode {
public List<DOMEntityOwnershipChange> getChanges() {
return changes;
}
+
+ public void resetListener() {
+ changes.clear();
+ }
}
protected static final class MockNativeEntityOwnershipService extends AkkaEntityOwnershipService {
protected MockNativeEntityOwnershipService(ActorSystem classicActorSystem)
throws ExecutionException, InterruptedException {
- super(classicActorSystem);
+ super(classicActorSystem, CODEC_CONTEXT);
this.classicActorSystem = classicActorSystem;
}