- private PotentialSchemaSource<?> withSourceId(final SourceIdentifier identifier) {
- return argThat(new ArgumentMatcher<PotentialSchemaSource>() {
- @Override
- public boolean matches(final Object argument) {
- final PotentialSchemaSource potentialSchemaSource = (PotentialSchemaSource) argument;
- return identifier.equals(potentialSchemaSource.getSourceIdentifier());
- }
- });
+ private ActorRef registerSlaveMountPoint() {
+ SchemaResourcesDTO schemaResourceDTO2 = mock(SchemaResourcesDTO.class);
+ doReturn(mockRegistry).when(schemaResourceDTO2).getSchemaRegistry();
+ doReturn(mockSchemaRepository).when(schemaResourceDTO2).getSchemaRepository();
+ final ActorRef slaveRef = system.actorOf(NetconfNodeActor.props(
+ NetconfTopologySetupBuilder.create().setSchemaResourceDTO(schemaResourceDTO2).setActorSystem(system)
+ .build(), remoteDeviceId, TIMEOUT, mockMountPointService));
+
+ doReturn(Futures.immediateFuture(mockSchemaContext))
+ .when(mockSchemaContextFactory).createSchemaContext(any());
+
+ slaveRef.tell(new RegisterMountPoint(ImmutableList.of(SOURCE_IDENTIFIER1, SOURCE_IDENTIFIER2),
+ masterRef), testKit.getRef());
+
+ verify(mockMountPointBuilder, timeout(5000)).register();
+ verify(mockMountPointBuilder).addInitialSchemaContext(mockSchemaContext);
+ verify(mockMountPointBuilder).addService(eq(DOMDataBroker.class), any());
+ verify(mockMountPointBuilder).addService(eq(DOMRpcService.class), any());
+ verify(mockMountPointBuilder).addService(eq(DOMNotificationService.class), any());
+
+ testKit.expectMsgClass(Success.class);
+
+ return slaveRef;
+ }
+
+ private void initializeMaster(final List<SourceIdentifier> sourceIdentifiers) {
+ masterRef.tell(new CreateInitialMasterActorData(mockDOMDataBroker, sourceIdentifiers,
+ mockDOMRpcService), testKit.getRef());
+
+ testKit.expectMsgClass(MasterActorDataInitialized.class);
+ }
+
+ private void resetMountPointMocks() {
+ reset(mockMountPointReg, mockMountPointBuilder);
+
+ doNothing().when(mockMountPointReg).close();
+
+ doReturn(mockMountPointBuilder).when(mockMountPointBuilder).addInitialSchemaContext(any());
+ doReturn(mockMountPointBuilder).when(mockMountPointBuilder).addService(any(), any());
+ doReturn(mockMountPointReg).when(mockMountPointBuilder).register();