Convert to jersey 2 10/72210/3
authorTom Pantelis <tompantelis@gmail.com>
Wed, 23 May 2018 22:08:51 +0000 (18:08 -0400)
committerTom Pantelis <tompantelis@gmail.com>
Thu, 24 May 2018 17:31:54 +0000 (13:31 -0400)
Modified the WenInitializer to use the new servlet API and changed
the jersey client version to 2.25.1. Also modified the UTs to jersey 2
test framework.

JIRA: TSC-113

Change-Id: I3864bd217126954e93308699e095f67afc2e53da
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
20 files changed:
aaa-authn-api/pom.xml
aaa-shiro/api/pom.xml
aaa-shiro/impl/pom.xml
aaa-shiro/impl/src/main/java/org/opendaylight/aaa/provider/GsonProvider.java
aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/idm/DomainHandler.java
aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/idm/IdmLightApplication.java
aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/realm/MoonRealm.java
aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/realm/util/http/SimpleHttpClient.java
aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/realm/util/http/SimpleHttpRequest.java
aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/web/env/WebInitializer.java
aaa-shiro/impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
aaa-shiro/impl/src/test/java/org/opendaylight/aaa/shiro/idm/rest/test/DomainHandlerTest.java
aaa-shiro/impl/src/test/java/org/opendaylight/aaa/shiro/idm/rest/test/HandlerTest.java
aaa-shiro/impl/src/test/java/org/opendaylight/aaa/shiro/idm/rest/test/RoleHandlerTest.java
aaa-shiro/impl/src/test/java/org/opendaylight/aaa/shiro/idm/rest/test/UserHandlerTest.java
aaa-shiro/impl/src/test/java/org/opendaylight/aaa/shiro/realm/util/http/SimpleHttpRequestTest.java
features/odl-aaa-api/pom.xml
features/odl-aaa-jersey-1/pom.xml [deleted file]
features/odl-aaa-shiro/pom.xml
features/pom.xml

index 126535665803abd44f1cde373fb7f80504951706..0aff3ec5b924cacee5dec0fee7914ae9dc8d6593 100644 (file)
   <dependencies>
     <!-- external dependencies -->
     <dependency>
-      <groupId>com.sun.jersey</groupId>
-      <artifactId>jersey-server</artifactId>
-      <scope>provided</scope>
+      <groupId>javax.ws.rs</groupId>
+      <artifactId>javax.ws.rs-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>javax.servlet-api</artifactId>
     </dependency>
-      <dependency>
-          <groupId>javax.servlet</groupId>
-          <artifactId>javax.servlet-api</artifactId>
-      </dependency>
   </dependencies>
 </project>
index 8474aae330c05dfee36465cb3178f3e86cfc56c3..033b4db634be24b5a53fbc58dcbb053d9339c7d9 100644 (file)
@@ -30,4 +30,22 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
       <version>${project.version}</version>
     </dependency>
   </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Import-Package>
+              !javax.annotation,
+              *
+            </Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
 </project>
index 3d1d0be5cd9e9947d1d7a15b22323784cc5aeef6..aa935377c8134988d95ad4e74720cf431ce89bfb 100644 (file)
@@ -32,8 +32,9 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
 
         <!-- jersey client for moon authN -->
         <dependency>
-            <groupId>com.sun.jersey</groupId>
+            <groupId>org.glassfish.jersey.core</groupId>
             <artifactId>jersey-client</artifactId>
+            <version>2.25.1</version>
             <scope>provided</scope>
         </dependency>
         <!-- OAuth2 dependencies for moon -->
@@ -89,14 +90,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
             <groupId>org.opendaylight.aaa</groupId>
             <artifactId>aaa-filterchain</artifactId>
         </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-server</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>javax.servlet-api</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.compendium</artifactId>
@@ -136,7 +129,10 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
         <dependency>
             <groupId>org.opendaylight.aaa.web</groupId>
             <artifactId>web-api</artifactId>
-            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.aaa.web</groupId>
+            <artifactId>servlet-api</artifactId>
         </dependency>
 
         <!-- Testing Dependencies -->
@@ -145,16 +141,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>jul-to-slf4j</artifactId>
-            <version>1.7.21</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-servlet</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-core</artifactId>
@@ -176,14 +162,14 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>com.sun.jersey.jersey-test-framework</groupId>
-            <artifactId>jersey-test-framework-grizzly2</artifactId>
+            <groupId>org.glassfish.jersey.test-framework.providers</groupId>
+            <artifactId>jersey-test-framework-provider-grizzly2</artifactId>
+            <version>2.25.1</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.mortbay.jetty</groupId>
             <artifactId>jetty-servlet-tester</artifactId>
-            <version>7.0.0.pre5</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -215,6 +201,10 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
                             org.opendaylight.aaa.shiro.web.env,
                             org.opendaylight.aaa.datastore.h2.*,
                         </Export-Package>
+                        <Import-Package>
+                           !javax.annotation,
+                           *
+                        </Import-Package>
                     </instructions>
                 </configuration>
             </plugin>
index ae137e161f86c874411a5f1d7832c606abdb6ec0..775907ac87d3ad1f2e5a45c482b8623147014567 100644 (file)
@@ -87,7 +87,8 @@ public class GsonProvider<T> implements MessageBodyReader<T>, MessageBodyWriter<
 
         try (PrintWriter printWriter = new PrintWriter(entityStream)) {
             String json;
-            if (ui.getQueryParameters().containsKey(PRETTY_PRINT)) {
+            final MultivaluedMap<String, String> queryParameters = ui != null ? ui.getQueryParameters() : null;
+            if (queryParameters != null && queryParameters.containsKey(PRETTY_PRINT)) {
                 json = prettyGson.toJson(type);
             } else {
                 json = gson.toJson(type);
index 59e176722caac11f03e7d891b4fe4c56b0466744..bac9fb049db6a51464ec6d4f0f81e8525dcb90d1 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.aaa.shiro.idm;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
@@ -56,8 +57,8 @@ public class DomainHandler {
     private final ClaimCache claimCache;
 
     public DomainHandler(IIDMStore iidMStore, ClaimCache claimCache) {
-        this.iidMStore = iidMStore;
-        this.claimCache = claimCache;
+        this.iidMStore = Objects.requireNonNull(iidMStore);
+        this.claimCache = Objects.requireNonNull(claimCache);
     }
 
     /**
index d9b0f98000e957d05152836998e8bd5cc1c39fbc..975c93d975e27eec00c8789c4e5feec9963ae290 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.aaa.shiro.idm;
 
 import com.google.common.collect.ImmutableSet;
+import java.util.Objects;
 import java.util.Set;
 import javax.ws.rs.core.Application;
 import org.opendaylight.aaa.api.ClaimCache;
@@ -46,8 +47,8 @@ public class IdmLightApplication extends Application {
     private final ClaimCache claimCache;
 
     public IdmLightApplication(IIDMStore iidMStore, ClaimCache claimCache) {
-        this.iidMStore = iidMStore;
-        this.claimCache = claimCache;
+        this.iidMStore = Objects.requireNonNull(iidMStore);
+        this.claimCache = Objects.requireNonNull(claimCache);
     }
 
     @Override
index 14c3d516aa1c475091d8205afd936dc665284fcc..e288a96f9d677afc7f77add3093ab7be1db0332c 100644 (file)
@@ -10,15 +10,15 @@ package org.opendaylight.aaa.shiro.realm;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.LinkedHashSet;
 import java.util.Set;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
 import org.apache.shiro.authc.AuthenticationException;
 import org.apache.shiro.authc.AuthenticationInfo;
 import org.apache.shiro.authc.AuthenticationToken;
@@ -27,6 +27,7 @@ import org.apache.shiro.authc.UsernamePasswordToken;
 import org.apache.shiro.authz.AuthorizationInfo;
 import org.apache.shiro.realm.AuthorizingRealm;
 import org.apache.shiro.subject.PrincipalCollection;
+import org.glassfish.jersey.client.ClientConfig;
 import org.opendaylight.aaa.shiro.moon.MoonPrincipal;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -81,9 +82,8 @@ public class MoonRealm extends AuthorizingRealm {
     }
 
     public MoonPrincipal moonAuthenticate(final String username, final String password, final String domain) {
-        final String output;
-        final ClientConfig config = new DefaultClientConfig();
-        final Client client = Client.create(config);
+        final ClientConfig config = new ClientConfig();
+        final Client client = ClientBuilder.newClient(config);
 
         final String hostFromShiro = moonServerURL != null ? moonServerURL.getHost() : null;
         final String server;
@@ -105,11 +105,11 @@ public class MoonRealm extends AuthorizingRealm {
 
         final String url = String.format("http://%s:%s/moon/auth/tokens", server, port);
         LOG.debug("Moon server is at: {}:{} and will be accessed through {}", server, port, url);
-        final WebResource webResource = client.resource(url);
+        WebTarget webTarget = client.target(url);
         final String input = "{\"username\": \"" + username + "\"," + "\"password\":" + "\"" + password + "\","
                 + "\"project\":" + "\"" + domain + "\"" + "}";
-        final ClientResponse response = webResource.type("application/json").post(ClientResponse.class, input);
-        output = response.getEntity(String.class);
+        final String output = webTarget.request(MediaType.APPLICATION_JSON)
+                .post(Entity.entity(input, MediaType.APPLICATION_JSON), String.class);
 
         final JsonElement element = new JsonParser().parse(output);
         if (!element.isJsonObject()) {
index f88d17868c5e05a82eb2261b9294263c29872da2..ea2bc47063365061fd6df60da123863b26e6f8dc 100644 (file)
@@ -8,14 +8,13 @@
 
 package org.opendaylight.aaa.shiro.realm.util.http;
 
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.client.urlconnection.HTTPSProperties;
 import java.util.HashSet;
 import java.util.Set;
 import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.SSLContext;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import org.glassfish.jersey.client.ClientConfig;
 
 /**
  * An utility that represents an HTTP client that allows to make
@@ -99,12 +98,10 @@ public class SimpleHttpClient {
          * @return the client.
          */
         public SimpleHttpClient build() {
-            final ClientConfig clientConfig = new DefaultClientConfig();
-            clientConfig.getClasses().addAll(providers);
-            clientConfig.getProperties().put(
-                    HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
-                    new HTTPSProperties(hostnameVerifier, sslContext));
-            final Client client = Client.create(clientConfig);
+            final ClientConfig clientConfig = new ClientConfig();
+            providers.forEach(clientConfig::register);
+            Client client = ClientBuilder.newBuilder().sslContext(sslContext).hostnameVerifier(hostnameVerifier)
+                    .withConfig(clientConfig).build();
             return new SimpleHttpClient(client);
         }
 
index 0df5bd74d6a021c28d0072295100b71011fa9f74..a3bf7eecaa5249b9a1089f50e6a43884958e24c4 100644 (file)
@@ -8,14 +8,14 @@
 
 package org.opendaylight.aaa.shiro.realm.util.http;
 
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.WebResource;
 import java.net.URI;
 import java.util.HashMap;
 import java.util.Map;
+import javax.ws.rs.ProcessingException;
 import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
@@ -48,21 +48,22 @@ public class SimpleHttpRequest<T> {
      *
      * @return the result of the http request.
      */
+    @SuppressWarnings("unchecked")
     public T execute() {
-        WebResource webResource = client.resource(uri).path(path);
+        WebTarget webTarget = client.target(uri).path(path);
 
         // add the query params
-        queryParams.forEach(webResource::queryParam);
+        queryParams.forEach(webTarget::queryParam);
 
         try {
             if (outputType == Response.class) {
-                ClientResponse output = webResource.type(mediaType).method(method, ClientResponse.class, entity);
-                return outputType.cast(clientResponseToResponse(output));
+                return (T) webTarget.request(mediaType)
+                        .method(method, Entity.entity(entity, mediaType), Response.class);
             } else {
-                return webResource.type(mediaType).method(method, outputType, entity);
+                return webTarget.request(mediaType).method(method, Entity.entity(entity, mediaType), outputType);
             }
-        } catch (UniformInterfaceException theException) {
-            throw new WebApplicationException(theException, clientResponseToResponse(theException.getResponse()));
+        } catch (ProcessingException e) {
+            throw new WebApplicationException(e);
         }
     }
 
@@ -79,13 +80,6 @@ public class SimpleHttpRequest<T> {
         return new Builder<>(client, outputType);
     }
 
-    private static Response clientResponseToResponse(final ClientResponse clientResponse) {
-        Response.ResponseBuilder rb = Response.status(clientResponse.getStatus());
-        clientResponse.getHeaders().forEach((header, values) -> values.forEach(value -> rb.header(header, value)));
-        rb.entity(clientResponse.getEntityInputStream());
-        return rb.build();
-    }
-
     public static class Builder<T> {
         private final SimpleHttpRequest<T> request;
 
index 05e9074bb54dfd1516b715e2b8d67f26c756c424..5db7add7d384586a7d640eebf757744769ee2707 100644 (file)
@@ -20,6 +20,7 @@ import org.opendaylight.aaa.web.WebContextBuilder;
 import org.opendaylight.aaa.web.WebContextRegistration;
 import org.opendaylight.aaa.web.WebContextSecurer;
 import org.opendaylight.aaa.web.WebServer;
+import org.opendaylight.aaa.web.servlet.ServletSupport;
 
 /**
  * Initializer for web components.
@@ -34,15 +35,13 @@ public class WebInitializer {
     private final WebContextRegistration registraton;
 
     public WebInitializer(WebServer webServer, ClaimCache claimCache, IIDMStore iidMStore,
-            WebContextSecurer webContextSecurer,
+            WebContextSecurer webContextSecurer, ServletSupport servletSupport,
             CustomFilterAdapterConfiguration customFilterAdapterConfig) throws ServletException {
 
         WebContextBuilder webContextBuilder = WebContext.builder().contextPath("auth").supportsSessions(true)
 
-            .addServlet(ServletDetails.builder().servlet(new com.sun.jersey.spi.container.servlet.ServletContainer(
-                    new IdmLightApplication(iidMStore, claimCache)))
-                .putInitParam("com.sun.jersey.api.json.POJOMappingFeature", "true")
-                .putInitParam("jersey.config.server.provider.packages", "org.opendaylight.aaa.impl.provider")
+            .addServlet(ServletDetails.builder().servlet(servletSupport.createHttpServletBuilder(
+                    new IdmLightApplication(iidMStore, claimCache)).build())
                 .addUrlPattern("/*").build())
 
             // Allows user to add javax.servlet.Filter(s) in front of REST services
index 3e3718caf4b31a4e3f367d75c60a6ed59c6d32ac..909140b6ee660a7cf3a2e756a5351f354418e4b7 100644 (file)
@@ -101,11 +101,14 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
 
   <reference id="webServer" interface="org.opendaylight.aaa.web.WebServer" />
 
+  <reference id="servletSupport" interface="org.opendaylight.aaa.web.servlet.ServletSupport" />
+
   <bean id="webInitializer" class="org.opendaylight.aaa.shiro.web.env.WebInitializer" destroy-method="close">
     <argument ref="webServer"/>
     <argument ref="idmLightProxy"/>
     <argument ref="idmStore"/>
     <argument ref="webContextSecurer"/>
+    <argument ref="servletSupport"/>
     <argument ref="customFilterAdapterConfig"/>
   </bean>
 </blueprint>
index a03168d23fe10cbe88b5c9048d5e8ca35475a3a6..fc605943f5cc40c841543bfa1c9374849456ebbf 100644 (file)
@@ -13,42 +13,37 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.UniformInterfaceException;
 import java.util.HashMap;
 import java.util.Map;
-import javax.ws.rs.core.MediaType;
-import org.junit.Ignore;
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.core.Response;
 import org.junit.Test;
 import org.opendaylight.aaa.api.model.Domain;
 import org.opendaylight.aaa.api.model.Domains;
 import org.opendaylight.aaa.api.model.IDMError;
 import org.opendaylight.aaa.api.model.Roles;
 
-@Ignore
 public class DomainHandlerTest extends HandlerTest {
 
     @Test
     public void testDomainHandler() {
         // check default domains
-        Domains domains = resource().path("/v1/domains").get(Domains.class);
+        Domains domains = target("/v1/domains").request().get(Domains.class);
         assertNotNull(domains);
         assertEquals(1, domains.getDomains().size());
         assertTrue(domains.getDomains().get(0).getName().equals("sdn"));
 
         // check existing domain
-        Domain domain = resource().path("/v1/domains/0").get(Domain.class);
+        Domain domain = target("/v1/domains/0").request().get(Domain.class);
         assertNotNull(domain);
         assertTrue(domain.getName().equals("sdn"));
 
         // check not exist domain
         try {
-            resource().path("/v1/domains/5").get(IDMError.class);
-            fail("Should failed with 404!");
-        } catch (UniformInterfaceException e) {
-            ClientResponse resp = e.getResponse();
-            assertEquals(404, resp.getStatus());
-            assertTrue(resp.getEntity(IDMError.class).getMessage().contains("Not found! domain id"));
+            target("/v1/domains/5").request().get(IDMError.class);
+            fail("Should fail with 404!");
+        } catch (NotFoundException e) {
+            // expected
         }
 
         // check create domain
@@ -56,84 +51,74 @@ public class DomainHandlerTest extends HandlerTest {
         domainData.put("name", "dom1");
         domainData.put("description", "test dom");
         domainData.put("enabled", "true");
-        ClientResponse clientResponse = resource().path("/v1/domains").type(MediaType.APPLICATION_JSON)
-                .post(ClientResponse.class, domainData);
+        Response clientResponse = target("/v1/domains").request().post(entity(domainData));
         assertEquals(201, clientResponse.getStatus());
 
         // check update domain data
         domainData.put("name", "dom1Update");
-        clientResponse = resource().path("/v1/domains/1").type(MediaType.APPLICATION_JSON).put(ClientResponse.class,
-                domainData);
+        clientResponse = target("/v1/domains/1").request().put(entity(domainData));
         assertEquals(200, clientResponse.getStatus());
-        domain = resource().path("/v1/domains/1").get(Domain.class);
+        domain = target("/v1/domains/1").request().get(Domain.class);
         assertNotNull(domain);
         assertTrue(domain.getName().equals("dom1Update"));
 
         // check create grant
         Map<String, String> grantData = new HashMap<>();
         grantData.put("roleid", "1");
-        clientResponse = resource().path("/v1/domains/1/users/0/roles").type(MediaType.APPLICATION_JSON)
-                .post(ClientResponse.class, grantData);
+        clientResponse = target("/v1/domains/1/users/0/roles").request().post(entity(grantData));
         assertEquals(201, clientResponse.getStatus());
 
         // check create existing grant
-        clientResponse = resource().path("/v1/domains/1/users/0/roles").type(MediaType.APPLICATION_JSON)
-                .post(ClientResponse.class, grantData);
+        clientResponse = target("/v1/domains/1/users/0/roles").request().post(entity(grantData));
         assertEquals(403, clientResponse.getStatus());
 
         // check create grant with invalid domain id
-        clientResponse = resource().path("/v1/domains/5/users/0/roles").type(MediaType.APPLICATION_JSON)
-                .post(ClientResponse.class, grantData);
+        clientResponse = target("/v1/domains/5/users/0/roles").request().post(entity(grantData));
         assertEquals(404, clientResponse.getStatus());
 
         // check validate user (admin)
         Map<String, String> usrPwdData = new HashMap<>();
         usrPwdData.put("username", "admin");
         usrPwdData.put("userpwd", "admin");
-        clientResponse = resource().path("/v1/domains/0/users/roles").type(MediaType.APPLICATION_JSON)
-                .post(ClientResponse.class, usrPwdData);
+        clientResponse = target("/v1/domains/0/users/roles").request().post(entity(usrPwdData));
         assertEquals(200, clientResponse.getStatus());
 
         // check validate user (admin) with wrong password
         usrPwdData.put("userpwd", "1234");
-        clientResponse = resource().path("/v1/domains/0/users/roles").type(MediaType.APPLICATION_JSON)
-                .post(ClientResponse.class, usrPwdData);
+        clientResponse = target("/v1/domains/0/users/roles").request().post(entity(usrPwdData));
         assertEquals(401, clientResponse.getStatus());
 
         // check get user (admin) roles
-        Roles usrRoles = resource().path("/v1/domains/0/users/0/roles").get(Roles.class);
+        Roles usrRoles = target("/v1/domains/0/users/0/roles").request().get(Roles.class);
         assertNotNull(usrRoles);
         assertTrue(usrRoles.getRoles().size() > 1);
 
         // check get invalid user roles
         try {
-            resource().path("/v1/domains/0/users/5/roles").get(IDMError.class);
-            fail("Should failed with 404!");
-        } catch (UniformInterfaceException e) {
-            ClientResponse resp = e.getResponse();
-            assertEquals(404, resp.getStatus());
+            target("/v1/domains/0/users/5/roles").request().get(IDMError.class);
+            fail("Should fail with 404!");
+        } catch (NotFoundException e) {
+            // expected
         }
 
         // check delete grant
-        clientResponse = resource().path("/v1/domains/0/users/0/roles/0").delete(ClientResponse.class);
+        clientResponse = target("/v1/domains/0/users/0/roles/0").request().delete();
         assertEquals(204, clientResponse.getStatus());
 
         // check delete grant for invalid domain
-        clientResponse = resource().path("/v1/domains/3/users/0/roles/0").delete(ClientResponse.class);
+        clientResponse = target("/v1/domains/3/users/0/roles/0").request().delete();
         assertEquals(404, clientResponse.getStatus());
 
         // check delete domain
-        clientResponse = resource().path("/v1/domains/1").delete(ClientResponse.class);
+        clientResponse = target("/v1/domains/1").request().delete();
         assertEquals(204, clientResponse.getStatus());
 
         // check delete not existing domain
         try {
-            resource().path("/v1/domains/1").delete(IDMError.class);
-            fail("Shoulda failed with 404!");
-        } catch (UniformInterfaceException e) {
-            ClientResponse resp = e.getResponse();
-            assertEquals(404, resp.getStatus());
-            assertTrue(resp.getEntity(IDMError.class).getMessage().contains("Not found! Domain id"));
+            target("/v1/domains/1").request().delete(IDMError.class);
+            fail("Should fail with 404!");
+        } catch (NotFoundException e) {
+            // expected
         }
 
         // Bug 8382: if a domain id is specified, 400 is returned
@@ -142,16 +127,14 @@ public class DomainHandlerTest extends HandlerTest {
         domainData.put("description", "test dom");
         domainData.put("domainid", "dom1");
         domainData.put("enabled", "true");
-        clientResponse = resource().path("/v1/domains").type(MediaType.APPLICATION_JSON).post(ClientResponse.class,
-                domainData);
+        clientResponse = target("/v1/domains").request().post(entity(domainData));
         assertEquals(400, clientResponse.getStatus());
 
         // Bug 8382: if a grant id is specified, 400 is returned
         grantData = new HashMap<>();
         grantData.put("roleid", "1");
         grantData.put("grantid", "grantid");
-        clientResponse = resource().path("/v1/domains/1/users/0/roles").type(MediaType.APPLICATION_JSON)
-                .post(ClientResponse.class, grantData);
+        clientResponse = target("/v1/domains/1/users/0/roles").request().post(entity(grantData));
         assertEquals(400, clientResponse.getStatus());
     }
 }
index ed22668826f96d832a2ac9c591c4503b20202c4b..3fc5c4758d4e4fe92eb8e65ea0834b07640ef6da 100644 (file)
@@ -8,38 +8,42 @@
 
 package org.opendaylight.aaa.shiro.idm.rest.test;
 
-import com.sun.jersey.spi.container.servlet.WebComponent;
-import com.sun.jersey.test.framework.AppDescriptor;
-import com.sun.jersey.test.framework.JerseyTest;
-import com.sun.jersey.test.framework.WebAppDescriptor;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.Application;
+import javax.ws.rs.core.MediaType;
+import org.glassfish.jersey.client.ClientConfig;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.test.JerseyTest;
 import org.junit.Before;
 import org.opendaylight.aaa.api.IIDMStore;
 import org.opendaylight.aaa.api.StoreBuilder;
+import org.opendaylight.aaa.provider.GsonProvider;
 import org.opendaylight.aaa.shiro.idm.IdmLightApplication;
-import org.slf4j.bridge.SLF4JBridgeHandler;
+import org.opendaylight.aaa.shiro.idm.IdmLightProxy;
 
 public abstract class HandlerTest extends JerseyTest {
 
-    protected IDMTestStore testStore = new IDMTestStore();
+    protected IDMTestStore testStore;
 
     @Override
-    protected AppDescriptor configure() {
-        return new WebAppDescriptor.Builder()
-                .initParam(WebComponent.RESOURCE_CONFIG_CLASS, IdmLightApplication.class.getName())
-                .initParam("com.sun.jersey.config.feature.Trace", "true")
-                .initParam("com.sun.jersey.spi.container.ContainerResponseFilters",
-                           "com.sun.jersey.api.container.filter.LoggingFilter")
-                .initParam("jersey.config.server.provider.packages",
-                        "org.opendaylight.aaa.impl.provider")
-                .build();
+    protected Application configure() {
+        testStore = new IDMTestStore();
+        return ResourceConfig.forApplication(new IdmLightApplication(testStore, new IdmLightProxy(testStore)));
+    }
+
+    @Override
+    protected void configureClient(final ClientConfig config) {
+        config.register(new GsonProvider<>());
     }
 
     @Before
     @Override
     public void setUp() throws Exception {
-        SLF4JBridgeHandler.removeHandlersForRootLogger();
-        SLF4JBridgeHandler.install();
         super.setUp();
         new StoreBuilder(testStore).initWithDefaultUsers(IIDMStore.DEFAULT_DOMAIN);
     }
+
+    static <T> Entity<T> entity(T obj) {
+        return Entity.entity(obj, MediaType.APPLICATION_JSON);
+    }
 }
index c9d3884813449e565b9387f9eea3ecda750310b7..43b31e358099f315b4aafe41f4d7261bb7c8da6e 100644 (file)
@@ -13,25 +13,23 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.UniformInterfaceException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import javax.ws.rs.core.MediaType;
-import org.junit.Ignore;
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
 import org.junit.Test;
 import org.opendaylight.aaa.api.model.IDMError;
 import org.opendaylight.aaa.api.model.Role;
 import org.opendaylight.aaa.api.model.Roles;
 
-@Ignore
 public class RoleHandlerTest extends HandlerTest {
 
     @Test
     public void testRoleHandler() {
         // check default roles
-        Roles roles = resource().path("/v1/roles").get(Roles.class);
+        Roles roles = target("/v1/roles").request().get(Roles.class);
         assertNotNull(roles);
         List<Role> roleList = roles.getRoles();
         assertEquals(2, roleList.size());
@@ -40,18 +38,16 @@ public class RoleHandlerTest extends HandlerTest {
         }
 
         // check existing role
-        Role role = resource().path("/v1/roles/0").get(Role.class);
+        Role role = target("/v1/roles/0").request().get(Role.class);
         assertNotNull(role);
         assertTrue(role.getName().equals("admin"));
 
         // check not exist Role
         try {
-            resource().path("/v1/roles/5").get(IDMError.class);
-            fail("Should failed with 404!");
-        } catch (UniformInterfaceException e) {
-            ClientResponse resp = e.getResponse();
-            assertEquals(404, resp.getStatus());
-            assertTrue(resp.getEntity(IDMError.class).getMessage().contains("role not found"));
+            target("/v1/roles/5").request().get(IDMError.class);
+            fail("Should fail with 404!");
+        } catch (NotFoundException e) {
+            // expected
         }
 
         // check create Role
@@ -59,42 +55,36 @@ public class RoleHandlerTest extends HandlerTest {
         roleData.put("name", "role1");
         roleData.put("description", "test Role");
         roleData.put("domainid", "0");
-        ClientResponse clientResponse = resource().path("/v1/roles").type(MediaType.APPLICATION_JSON)
-                .post(ClientResponse.class, roleData);
+        Response clientResponse = target("/v1/roles").request().post(entity(roleData));
         assertEquals(201, clientResponse.getStatus());
 
         // check create Role missing name data
         roleData.remove("name");
         try {
-            clientResponse = resource().path("/v1/roles").type(MediaType.APPLICATION_JSON).post(ClientResponse.class,
-                    roleData);
+            clientResponse = target("/v1/roles").request().post(entity(roleData));
             assertEquals(404, clientResponse.getStatus());
-        } catch (UniformInterfaceException e) {
-            ClientResponse resp = e.getResponse();
-            assertEquals(500, resp.getStatus());
+        } catch (WebApplicationException e) {
+            assertEquals(500, e.getResponse().getStatus());
         }
 
         // check update Role data
         roleData.put("name", "role1Update");
-        clientResponse = resource().path("/v1/roles/2").type(MediaType.APPLICATION_JSON).put(ClientResponse.class,
-                roleData);
+        clientResponse = target("/v1/roles/2").request().put(entity(roleData));
         assertEquals(200, clientResponse.getStatus());
-        role = resource().path("/v1/roles/2").get(Role.class);
+        role = target("/v1/roles/2").request().get(Role.class);
         assertNotNull(role);
         assertTrue(role.getName().equals("role1Update"));
 
         // check delete Role
-        clientResponse = resource().path("/v1/roles/2").delete(ClientResponse.class);
+        clientResponse = target("/v1/roles/2").request().delete();
         assertEquals(204, clientResponse.getStatus());
 
         // check delete not existing Role
         try {
-            resource().path("/v1/roles/2").delete(IDMError.class);
-            fail("Should failed with 404!");
-        } catch (UniformInterfaceException e) {
-            ClientResponse resp = e.getResponse();
-            assertEquals(404, resp.getStatus());
-            assertTrue(resp.getEntity(IDMError.class).getMessage().contains("role id not found"));
+            target("/v1/roles/2").request().delete(IDMError.class);
+            fail("Should fail with 404!");
+        } catch (NotFoundException e) {
+            // expected
         }
 
         // Bug 8382: if a role id is specified, 400 is returned
@@ -103,8 +93,7 @@ public class RoleHandlerTest extends HandlerTest {
         roleData.put("description", "test Role");
         roleData.put("domainid", "0");
         roleData.put("roleid", "roleid");
-        clientResponse = resource().path("/v1/roles").type(MediaType.APPLICATION_JSON).post(ClientResponse.class,
-                roleData);
+        clientResponse = target("/v1/roles").request().post(entity(roleData));
         assertEquals(400, clientResponse.getStatus());
     }
 }
index 742781a9823cf274c0a9a469e5cb063fcc2a07cc..43f8c0725c0575b1a9bee0da01e91c8c57e66953 100644 (file)
@@ -13,12 +13,12 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.UniformInterfaceException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import javax.ws.rs.core.MediaType;
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.opendaylight.aaa.api.model.IDMError;
@@ -31,7 +31,7 @@ public class UserHandlerTest extends HandlerTest {
     @Test
     public void testUserHandler() {
         // check default users
-        Users users = resource().path("/v1/users").get(Users.class);
+        Users users = target("/v1/users").request().get(Users.class);
         assertNotNull(users);
         List<User> usrList = users.getUsers();
         assertEquals(1, usrList.size());
@@ -40,18 +40,16 @@ public class UserHandlerTest extends HandlerTest {
         }
 
         // check existing user
-        User usr = resource().path("/v1/users/0").get(User.class);
+        User usr = target("/v1/users/0").request().get(User.class);
         assertNotNull(usr);
         assertTrue(usr.getName().equals("admin"));
 
         // check not exist user
         try {
-            resource().path("/v1/users/5").get(IDMError.class);
-            fail("Should failed with 404!");
-        } catch (UniformInterfaceException e) {
-            ClientResponse resp = e.getResponse();
-            assertEquals(404, resp.getStatus());
-            assertTrue(resp.getEntity(IDMError.class).getMessage().contains("user not found"));
+            target("/v1/users/5").request().get(IDMError.class);
+            fail("Should fail with 404!");
+        } catch (NotFoundException e) {
+            // expected
         }
 
         // check create user
@@ -62,42 +60,36 @@ public class UserHandlerTest extends HandlerTest {
         usrData.put("email", "user1@usr.org");
         usrData.put("password", "ChangeZbadPa$$w0rd");
         usrData.put("domainid", "0");
-        ClientResponse clientResponse = resource().path("/v1/users").type(MediaType.APPLICATION_JSON)
-                .post(ClientResponse.class, usrData);
+        Response clientResponse = target("/v1/users").request().post(entity(usrData));
         assertEquals(201, clientResponse.getStatus());
 
         // check create user missing name data
         usrData.remove("name");
         try {
-            clientResponse = resource().path("/v1/users").type(MediaType.APPLICATION_JSON).post(ClientResponse.class,
-                    usrData);
+            clientResponse = target("/v1/users").request().post(entity(usrData));
             assertEquals(400, clientResponse.getStatus());
-        } catch (UniformInterfaceException e) {
-            ClientResponse resp = e.getResponse();
-            assertEquals(500, resp.getStatus());
+        } catch (WebApplicationException e) {
+            assertEquals(500, e.getResponse().getStatus());
         }
 
         // check update user data
         usrData.put("name", "usr1Update");
-        clientResponse = resource().path("/v1/users/1").type(MediaType.APPLICATION_JSON).put(ClientResponse.class,
-                usrData);
+        clientResponse = target("/v1/users/1").request().put(entity(usrData));
         assertEquals(200, clientResponse.getStatus());
-        usr = resource().path("/v1/users/1").get(User.class);
+        usr = target("/v1/users/1").request().get(User.class);
         assertNotNull(usr);
         assertTrue(usr.getName().equals("usr1Update"));
 
         // check delete user
-        clientResponse = resource().path("/v1/users/1").delete(ClientResponse.class);
+        clientResponse = target("/v1/users/1").request().delete();
         assertEquals(204, clientResponse.getStatus());
 
         // check delete not existing user
         try {
-            resource().path("/v1/users/1").delete(IDMError.class);
-            fail("Should failed with 404!");
-        } catch (UniformInterfaceException e) {
-            ClientResponse resp = e.getResponse();
-            assertEquals(404, resp.getStatus());
-            assertTrue(resp.getEntity(IDMError.class).getMessage().contains("Couldn't find user"));
+            target("/v1/users/1").request().delete(IDMError.class);
+            fail("Should fail with 404!");
+        } catch (NotFoundException e) {
+            // expected
         }
 
         // Bug 8382: if a user id is specified, 400 is returned
@@ -109,8 +101,7 @@ public class UserHandlerTest extends HandlerTest {
         usrData.put("password", "ChangeZbadPa$$w0rd");
         usrData.put("userid", "userid");
         usrData.put("domainid", "0");
-        clientResponse = resource().path("/v1/users").type(MediaType.APPLICATION_JSON).post(ClientResponse.class,
-                usrData);
+        clientResponse = target("/v1/users").request().post(entity(usrData));
         assertEquals(400, clientResponse.getStatus());
     }
 }
index 6660359e9701809755445cbd5d7b96f15b704b8f..f522cdb48baca60ee4a70a7e6951bfd45ccf82c2 100644 (file)
@@ -10,93 +10,74 @@ package org.opendaylight.aaa.shiro.realm.util.http;
 
 import static org.hamcrest.Matchers.is;
 import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.when;
 
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Collections;
+import com.google.common.collect.ImmutableList;
+import javax.ws.rs.HttpMethod;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Application;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.test.JerseyTest;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Answers;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.aaa.provider.GsonProvider;
 import org.opendaylight.aaa.shiro.keystone.domain.KeystoneToken;
+import org.opendaylight.aaa.shiro.realm.util.http.SimpleHttpRequest.Builder;
 
-@RunWith(MockitoJUnitRunner.class)
-public class SimpleHttpRequestTest {
+public class SimpleHttpRequestTest extends JerseyTest {
+    private static final KeystoneToken.Token.Role ROLE = new KeystoneToken.Token.Role("name", "id");
+    private static final KeystoneToken KEYSTONE_TOKEN = new KeystoneToken(
+            new KeystoneToken.Token(ImmutableList.of(ROLE)));
 
-    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
-    private Client client;
+    @Path("keystone")
+    public static class KeystoneHandler {
+        @POST
+        public KeystoneToken keystoneToken(String input) {
+            return KEYSTONE_TOKEN;
+        }
+    }
 
-    @Mock
-    private ClientResponse clientResponse;
+    @Path("simple")
+    public static class SimpleResponseHandler {
+        @POST
+        public Response handle(String input) {
+            return Response.ok("hello").build();
+        }
+    }
 
-    @Mock
-    KeystoneToken theToken;
+    @Override
+    protected Application configure() {
+        return new ResourceConfig(KeystoneHandler.class, SimpleResponseHandler.class, GsonProvider.class);
+    }
 
     @Test
-    public void execute() throws Exception {
-        URI uri = new URL("http://example.com").toURI();
-        String path = "path";
-        MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
-        headers.put("header1", Collections.singletonList("value1"));
-        headers.put("header2", Collections.singletonList("value2"));
-        SimpleHttpRequest<Response> request = SimpleHttpRequest.builder(client, Response.class)
-                .uri(uri)
-                .path(path)
-                .mediaType(MediaType.APPLICATION_JSON_TYPE)
-                .method("POST")
-                .entity("entity")
-                .build();
-        when(client.resource(uri)
-                .path(path)
-                .type(MediaType.APPLICATION_JSON_TYPE)
-                .method("POST", ClientResponse.class, "entity"))
-            .thenReturn(clientResponse);
-        when(clientResponse.getStatus()).thenReturn(200);
-        when(clientResponse.getHeaders()).thenReturn(headers);
+    public void testSimpleResponse() {
+        final Builder<Response> builder = SimpleHttpClient.clientBuilder()
+                .hostnameVerifier(UntrustedSSL.getHostnameVerifier())
+                .sslContext(UntrustedSSL.getSSLContext()).provider(GsonProvider.class).build()
+                .requestBuilder(Response.class);
 
-        SimpleHttpRequest<Response> spiedRequest = Mockito.spy(request);
-
-        Response response = spiedRequest.execute();
+        SimpleHttpRequest<Response> request = builder.uri(getBaseUri()).path("simple")
+                .mediaType(MediaType.TEXT_PLAIN_TYPE).method(HttpMethod.POST).entity("input").build();
 
+        Response response = request.execute();
         assertThat(response.getStatus(), is(200));
-        assertThat(response.getMetadata(), is(headers));
     }
 
     @Test
-    public void keystoneTokenGetter() throws MalformedURLException, URISyntaxException {
-        URI uri = new URL("http://example.com").toURI();
-        String path = "path";
+    public void testKeystoneTokenGetter() {
+        final Builder<KeystoneToken> builder = SimpleHttpClient.clientBuilder()
+                .hostnameVerifier(UntrustedSSL.getHostnameVerifier())
+                .sslContext(UntrustedSSL.getSSLContext()).provider(GsonProvider.class).build()
+                .requestBuilder(KeystoneToken.class);
 
-        KeystoneToken.Token ksToken = new KeystoneToken.Token();
-        when(theToken.getToken()).thenReturn(ksToken);
+        SimpleHttpRequest<KeystoneToken> request = builder.uri(getBaseUri()).path("keystone")
+                .mediaType(MediaType.APPLICATION_JSON_TYPE).method(HttpMethod.POST).entity("input").build();
 
-        SimpleHttpRequest<KeystoneToken> request = SimpleHttpRequest.builder(client, KeystoneToken.class)
-                .uri(uri)
-                .path(path)
-                .mediaType(MediaType.APPLICATION_JSON_TYPE)
-                .method("POST")
-                .entity("entity")
-                .queryParam("nocatalog", "true")
-                .build();
-        when(client.resource(uri)
-                .path(path)
-                .type(MediaType.APPLICATION_JSON_TYPE)
-                .method("POST", KeystoneToken.class, "entity"))
-                .thenReturn(theToken);
-        SimpleHttpRequest<KeystoneToken> spiedRequest = Mockito.spy(request);
-        KeystoneToken response = spiedRequest.execute();
-        assertThat(response.getToken().getRoles().size(), is(0));
+        KeystoneToken response = request.execute();
+        assertThat(response.getToken().getRoles().size(), is(1));
+        assertThat(response.getToken().getRoles().get(0).getName(), is(ROLE.getName()));
+        assertThat(response.getToken().getRoles().get(0).getId(), is(ROLE.getId()));
     }
-
 }
index 35e5f4953d4d76dafc5dc64141b6cc05374db32c..15b31918294fc8242b8bb7bc3cb8cc0ad2c7581e 100644 (file)
     <name>ODL :: aaa :: ${project.artifactId}</name>
 
     <dependencies>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-server</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-core</artifactId>
-        </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>aaa-authn-api</artifactId>
diff --git a/features/odl-aaa-jersey-1/pom.xml b/features/odl-aaa-jersey-1/pom.xml
deleted file mode 100644 (file)
index 4dd3e0c..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright © 2018 Red Hat, Inc. and others.
-
- 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
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.opendaylight.odlparent</groupId>
-        <artifactId>single-feature-parent</artifactId>
-        <version>3.1.0</version>
-        <relativePath/>
-    </parent>
-
-    <groupId>org.opendaylight.aaa</groupId>
-    <artifactId>odl-aaa-jersey-1</artifactId>
-    <version>0.8.0-SNAPSHOT</version>
-    <packaging>feature</packaging>
-
-    <!-- odl-aaa-jersey-1 feature which provides Jersey 1 -->
-    <name>ODL :: aaa :: ${project.artifactId}</name>
-
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>aaa-parent</artifactId>
-                <version>${project.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
-    <dependencies>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-servlet</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-server</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-client</artifactId>
-        </dependency>
-    </dependencies>
-</project>
index d79e09e6337701bf5c85452beaef46b4732ac821..dca7674c8354b09d65e268c14654db7411e97844 100644 (file)
     </dependencyManagement>
 
     <dependencies>
-        <dependency>
-            <!-- We need to depend on a separate Jersey feature to ensure that
-                 it’s all initialised before we start using it; see also the
-                 prerequisite setup below -->
-            <groupId>org.opendaylight.aaa</groupId>
-            <artifactId>odl-aaa-jersey-1</artifactId>
-            <version>${project.version}</version>
-            <classifier>features</classifier>
-            <type>xml</type>
-        </dependency>
-
         <!-- OSGI -->
         <dependency>
             <groupId>org.apache.felix</groupId>
             <type>xml</type>
             <classifier>features</classifier>
         </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-servlet</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-server</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-client</artifactId>
-        </dependency>
 
         <!-- EhCache -->
         <dependency>
                 <plugin>
                     <groupId>org.apache.karaf.tooling</groupId>
                     <artifactId>karaf-maven-plugin</artifactId>
-                    <configuration>
-                        <prerequisiteFeatures>
-                            <prerequisiteFeature>odl-aaa-jersey-1</prerequisiteFeature>
-                        </prerequisiteFeatures>
-                    </configuration>
                 </plugin>
             </plugins>
         </pluginManagement>
index 1751f8b3782bfa87587ffeecb6716df545c9003c..df9cbd901cce570350fa3a691e583fced450e8fb 100644 (file)
@@ -27,7 +27,6 @@
         <module>odl-aaa-cert</module>
         <module>odl-aaa-cli</module>
         <module>odl-aaa-encryption-service</module>
-        <module>odl-aaa-jersey-1</module>
         <module>odl-aaa-password-service</module>
         <module>odl-aaa-shiro</module>
         <module>odl-aaa-web</module>