Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

Commit

Permalink
replace TestHttpClient with upstream TestWebClient
Browse files Browse the repository at this point in the history
  • Loading branch information
vorburger committed Jan 23, 2019
1 parent 32ba701 commit 0c28792
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 43 deletions.
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@
</dependency>

<!-- Now <scope>test... -->
<dependency>
<groupId>org.opendaylight.aaa.web</groupId>
<artifactId>testutils</artifactId>
<version>0.9.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.infrautils</groupId>
<artifactId>infrautils-testutils</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/opendaylight/infrautils/web/WebModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
*/
public class WebModule extends AbstractModule {

// TODO note (new) org.opendaylight.aaa.web.testutils.WebTestModule .. integrate?

@Override
protected void configure() {
// TODO read port from a -D parameter or configuration file instead of hard-coding
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
import org.junit.Rule;
import org.junit.Test;
import org.opendaylight.aaa.web.WebServer;
import org.opendaylight.aaa.web.testutils.TestWebClient;
import org.opendaylight.controller.simple.InMemoryControllerModule;
import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule;
import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
import org.opendaylight.infrautils.simple.testutils.AbstractSimpleDistributionTest;
import org.opendaylight.infrautils.testutils.TestHttpClient;
import org.opendaylight.infrautils.web.WebModule;
import org.opendaylight.neutron.simple.NeutronModule;

Expand All @@ -34,9 +34,9 @@ public class NeutronModuleTest extends AbstractSimpleDistributionTest {
NeutronModule.class, InMemoryControllerModule.class, WebModule.class, AnnotationsModule.class);

@Inject WebServer webServer;
@Inject TestHttpClient http;
@Inject TestWebClient http;

@Test public void testNeutron() throws IOException {
assertThat(http.responseCode(GET, "/controller/nb/v2/neutron/networks")).isEqualTo(200);
assertThat(http.request(GET, "/controller/nb/v2/neutron/networks").getStatus()).isEqualTo(200);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
import javax.inject.Inject;
import org.junit.Rule;
import org.junit.Test;
import org.opendaylight.aaa.web.testutils.WebTestModule;
import org.opendaylight.controller.simple.InMemoryControllerModule;
import org.opendaylight.infrautils.inject.guice.GuiceClassPathBinder;
import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule;
import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
import org.opendaylight.infrautils.ready.guice.ReadyModule;
import org.opendaylight.infrautils.simple.DiagStatusModule;
import org.opendaylight.infrautils.simple.testutils.AbstractSimpleDistributionTest;
import org.opendaylight.infrautils.web.WebModule;
import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider;
import org.opendaylight.openflowplugin.simple.OpenFlowPluginModule;
import org.opendaylight.serviceutils.simple.ServiceUtilsModule;
Expand All @@ -31,7 +31,7 @@ public class OpenFlowPluginModuleTest extends AbstractSimpleDistributionTest {
private static final GuiceClassPathBinder CLASS_PATH_BINDER = new GuiceClassPathBinder("org.opendaylight");

public @Rule GuiceRule guice = new GuiceRule(new OpenFlowPluginModule(CLASS_PATH_BINDER),
new ServiceUtilsModule(), new InMemoryControllerModule(), new DiagStatusModule(), new WebModule(),
new ServiceUtilsModule(), new InMemoryControllerModule(), new DiagStatusModule(), new WebTestModule(),
new ReadyModule(), new AnnotationsModule());

@Inject OpenFlowPluginProvider ofpProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
import org.junit.Rule;
import org.junit.Test;
import org.opendaylight.aaa.web.WebServer;
import org.opendaylight.aaa.web.testutils.TestWebClient;
import org.opendaylight.controller.simple.InMemoryControllerModule;
import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule;
import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
import org.opendaylight.infrautils.simple.testutils.AbstractSimpleDistributionTest;
import org.opendaylight.infrautils.testutils.TestHttpClient;
import org.opendaylight.infrautils.web.WebModule;
import org.opendaylight.restconf.simple.RestConfModule;

Expand All @@ -34,10 +34,10 @@ public class RestConfModuleTest extends AbstractSimpleDistributionTest {
RestConfModule.class, InMemoryControllerModule.class, WebModule.class, AnnotationsModule.class);

@Inject WebServer webServer;
@Inject TestHttpClient http;
@Inject TestWebClient http;

@Test public void testRestConf() throws IOException {
assertThat(http.responseCode(GET, "/restconf/modules/")).isEqualTo(200);
assertThat(http.request(GET, "/restconf/modules/").getStatus()).isEqualTo(200);

// TODO test security; add auth support to TestHttpClient, check that w.o. auth it's 401
}
Expand Down

0 comments on commit 0c28792

Please sign in to comment.