diff --git a/pom.xml b/pom.xml
index b76c3f5..ac7e025 100644
--- a/pom.xml
+++ b/pom.xml
@@ -285,6 +285,12 @@
+
+ org.opendaylight.aaa.web
+ testutils
+ 0.9.0-SNAPSHOT
+ test
+
org.opendaylight.infrautils
infrautils-testutils
diff --git a/src/main/java/org/opendaylight/infrautils/web/WebModule.java b/src/main/java/org/opendaylight/infrautils/web/WebModule.java
index 1885228..32ad205 100644
--- a/src/main/java/org/opendaylight/infrautils/web/WebModule.java
+++ b/src/main/java/org/opendaylight/infrautils/web/WebModule.java
@@ -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
diff --git a/src/test/java/org/opendaylight/infrautils/testutils/TestHttpClient.java b/src/test/java/org/opendaylight/infrautils/testutils/TestHttpClient.java
deleted file mode 100644
index f15dffb..0000000
--- a/src/test/java/org/opendaylight/infrautils/testutils/TestHttpClient.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2018 Red Hat, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.infrautils.testutils;
-
-import java.io.IOException;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-import org.opendaylight.aaa.web.WebServer;
-import org.opendaylight.infrautils.testutils.web.TestWebClient;
-import org.opendaylight.infrautils.testutils.web.TestWebClient.Method;
-
-/**
- * HTTP Client.
- *
- * @author Michael Vorburger.ch
- */
-@Singleton
-public class TestHttpClient {
-
- private final TestWebClient webClient;
-
- @Inject
- public TestHttpClient(WebServer webServer) {
- this.webClient = new TestWebClient(webServer.getBaseURL());
- }
-
- public int responseCode(Method httpMethod, String path) throws IOException {
- return webClient.request(httpMethod, path).getStatus();
- }
-}
diff --git a/src/test/java/org/opendaylight/neutron/simple/test/NeutronModuleTest.java b/src/test/java/org/opendaylight/neutron/simple/test/NeutronModuleTest.java
index b5a0328..74f4ab9 100644
--- a/src/test/java/org/opendaylight/neutron/simple/test/NeutronModuleTest.java
+++ b/src/test/java/org/opendaylight/neutron/simple/test/NeutronModuleTest.java
@@ -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;
@@ -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);
}
}
diff --git a/src/test/java/org/opendaylight/openflowplugin/simple/test/OpenFlowPluginModuleTest.java b/src/test/java/org/opendaylight/openflowplugin/simple/test/OpenFlowPluginModuleTest.java
index 58a0902..221da56 100644
--- a/src/test/java/org/opendaylight/openflowplugin/simple/test/OpenFlowPluginModuleTest.java
+++ b/src/test/java/org/opendaylight/openflowplugin/simple/test/OpenFlowPluginModuleTest.java
@@ -12,6 +12,7 @@
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;
@@ -19,7 +20,6 @@
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;
@@ -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;
diff --git a/src/test/java/org/opendaylight/restconf/simple/test/RestConfModuleTest.java b/src/test/java/org/opendaylight/restconf/simple/test/RestConfModuleTest.java
index 76b51ed..b03a38a 100644
--- a/src/test/java/org/opendaylight/restconf/simple/test/RestConfModuleTest.java
+++ b/src/test/java/org/opendaylight/restconf/simple/test/RestConfModuleTest.java
@@ -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;
@@ -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
}