import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
import org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult;
import org.opendaylight.mdsal.dom.api.DOMSchemaService;
-import org.opendaylight.restconf.nb.rfc8040.RestConnectorProvider;
import org.opendaylight.restconf.nb.rfc8040.TestUtils;
import org.opendaylight.restconf.nb.rfc8040.handlers.DOMDataBrokerHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.DOMMountPointServiceHandler;
@Mock
private DOMMountPointService mockMountPointService;
- @Mock
- private SchemaContextHandler mockSchemaContextHandler;
-
@Mock
private DOMDataBroker mockDOMDataBroker;
private JSONRestconfServiceRfc8040Impl service;
+ private final SchemaContextHandler schemaContextHandler = TestUtils.newSchemaContextHandler(schemaContext);
+
@BeforeClass
public static void init() throws IOException, ReactorException {
schemaContext = TestUtils.loadSchemaContext("/full-versions/yangs");
- SchemaContextHandler.setSchemaContext(schemaContext);
}
@SuppressWarnings("resource")
doReturn(mockTxChain).when(mockDOMDataBroker).createTransactionChain(any());
- doReturn(schemaContext).when(mockSchemaContextHandler).get();
-
final TransactionChainHandler txChainHandler = new TransactionChainHandler(mockDOMDataBroker);
final DOMMountPointServiceHandler mountPointServiceHandler =
- new DOMMountPointServiceHandler(mockMountPointService);
+ DOMMountPointServiceHandler.newInstance(mockMountPointService);
final DOMNotificationService mockNotificationService = mock(DOMNotificationService.class);
- ServicesWrapperImpl.getInstance().setHandlers(mockSchemaContextHandler, mountPointServiceHandler,
+ ServicesWrapperImpl.getInstance().setHandlers(schemaContextHandler, mountPointServiceHandler,
txChainHandler, new DOMDataBrokerHandler(mockDOMDataBroker),
new RpcServiceHandler(mockRpcService),
new NotificationServiceHandler(mockNotificationService), domSchemaService);
- service = new JSONRestconfServiceRfc8040Impl(ServicesWrapperImpl.getInstance(), mountPointServiceHandler);
-
- new RestConnectorProvider<>(mockDOMDataBroker, domSchemaService, mockRpcService, mockNotificationService,
- mockMountPointService, txChainHandler, null).start();
-
- SchemaContextHandler.setSchemaContext(schemaContext);
+ service = new JSONRestconfServiceRfc8040Impl(ServicesWrapperImpl.getInstance(), mountPointServiceHandler,
+ schemaContextHandler);
}
private static String loadData(final String path) throws IOException {