import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
+import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker;
import org.opendaylight.netconf.sal.restconf.impl.BrokerFacade;
import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
import org.opendaylight.netconf.sal.restconf.impl.RestconfImpl;
import org.opendaylight.netconf.sal.streams.listeners.ListenerAdapter;
import org.opendaylight.netconf.sal.streams.listeners.Notificator;
+import org.opendaylight.netconf.sal.streams.websockets.WebSocketServer;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.yang.gen.v1.urn.sal.restconf.event.subscription.rev140708.NotificationOutputTypeGrouping.NotificationOutputType;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
public class RestconfImplNotificationSubscribingTest {
private final String identifier = "data-change-event-subscription/datastore=OPERATIONAL/scope=ONE";
- private static SchemaContext schemaContext;
+ private static EffectiveModelContext schemaContext;
@Mock
private BrokerFacade broker;
private UriInfo uriInfo;
private ControllerContext controllerContext;
+ private RestconfImpl restconfImpl;
@BeforeClass
public static void init() throws FileNotFoundException {
schemaContext = YangParserTestUtils.parseYangFiles(TestRestconfUtils.loadFiles("/notifications"));
}
+ @AfterClass
+ public static void cleanUp() {
+ WebSocketServer.destroyInstance(); // NETCONF-604
+ }
+
@Before
public void setup() throws Exception {
MockitoAnnotations.initMocks(this);
- RestconfImpl.getInstance().setBroker(this.broker);
-
controllerContext = TestRestconfUtils.newControllerContext(schemaContext);
- RestconfImpl.getInstance().setControllerContext(controllerContext);
+ restconfImpl = RestconfImpl.newInstance(broker, controllerContext);
final YangInstanceIdentifier path = Mockito.mock(YangInstanceIdentifier.class);
final PathArgument pathValue = NodeIdentifier.create(QName.create("module", "2016-12-14", "localName"));
set.add(entry);
}
Mockito.when(map.entrySet()).thenReturn(set);
- RestconfImpl.getInstance().subscribeToStream(this.identifier, this.uriInfo);
+ restconfImpl.subscribeToStream(this.identifier, this.uriInfo);
}
}