2 * Copyright (c) 2019 Red Hat, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.sal.restconf.impl.test;
10 import static org.junit.Assert.assertEquals;
12 import com.google.inject.AbstractModule;
13 import java.io.IOException;
14 import java.net.URISyntaxException;
15 import javax.inject.Inject;
16 import org.junit.Rule;
17 import org.junit.Test;
18 import org.opendaylight.aaa.filterchain.configuration.CustomFilterAdapterConfiguration;
19 import org.opendaylight.aaa.web.WebServer;
20 import org.opendaylight.aaa.web.testutils.TestWebClient;
21 import org.opendaylight.aaa.web.testutils.WebTestModule;
22 import org.opendaylight.controller.sal.restconf.impl.test.incubate.InMemoryMdsalModule;
23 import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule;
24 import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
25 import org.opendaylight.netconf.sal.restconf.api.RestConfConfig;
26 import org.opendaylight.netconf.sal.restconf.impl.Bierman02RestConfWiring;
29 * Tests if the {@link Bierman02RestConfWiring} works.
31 * @author Michael Vorburger.ch
33 public class Bierman02RestConfWiringTest {
35 public static class TestModule extends AbstractModule {
37 protected void configure() {
38 bind(Bierman02RestConfWiring.class).asEagerSingleton();
39 bind(RestConfConfig.class).toInstance(() -> 9090);
40 bind(CustomFilterAdapterConfiguration.class).toInstance(listener -> { });
44 public @Rule GuiceRule guice = new GuiceRule(TestModule.class,
45 InMemoryMdsalModule.class, WebTestModule.class, AnnotationsModule.class);
47 @Inject WebServer webServer;
48 @Inject TestWebClient webClient;
51 public void testWiring() throws IOException, InterruptedException, URISyntaxException {
52 assertEquals(200, webClient.request("GET", "/restconf/modules/").statusCode());