You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2020/03/24 02:03:58 UTC

[james-project] 02/05: JAMES-3078 Remove Jetty utilities

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit acb112e67df90d06bd2a9dbbc90ab53f54c9af61
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sat Mar 21 11:03:33 2020 +0700

    JAMES-3078 Remove Jetty utilities
    
    No longer in use
---
 pom.xml                                            |  21 ---
 server/container/jetty/pom.xml                     |  88 ------------
 .../org/apache/james/http/jetty/Configuration.java | 149 -------------------
 .../james/http/jetty/ConfigurationException.java   |  31 ----
 .../apache/james/http/jetty/JettyHttpServer.java   | 123 ----------------
 .../java/org/apache/james/http/jetty/Bad400.java   |  38 -----
 .../apache/james/http/jetty/ConfigurationTest.java | 109 --------------
 .../james/http/jetty/JettyHttpServerTest.java      | 159 ---------------------
 .../java/org/apache/james/http/jetty/Ok200.java    |  37 -----
 server/pom.xml                                     |   1 -
 10 files changed, 756 deletions(-)

diff --git a/pom.xml b/pom.xml
index e987ecb..994d419 100644
--- a/pom.xml
+++ b/pom.xml
@@ -619,7 +619,6 @@
         <jackson.version>2.9.9</jackson.version>
         <feign.version>10.3.0</feign.version>
         <feign-form.version>3.8.0</feign-form.version>
-        <jetty.version>9.4.19.v20190610</jetty.version>
         <metrics.version>4.1.0</metrics.version>
         <testcontainers.version>1.12.0</testcontainers.version>
         <assertj.version>3.3.0</assertj.version>
@@ -1517,11 +1516,6 @@
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
-                <artifactId>james-server-jetty</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${james.groupId}</groupId>
                 <artifactId>james-server-jmap-draft</artifactId>
                 <version>${project.version}</version>
             </dependency>
@@ -2504,21 +2498,6 @@
                 <version>${bouncycastle.version}</version>
             </dependency>
             <dependency>
-                <groupId>org.eclipse.jetty</groupId>
-                <artifactId>jetty-http</artifactId>
-                <version>${jetty.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.eclipse.jetty</groupId>
-                <artifactId>jetty-server</artifactId>
-                <version>${jetty.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.eclipse.jetty</groupId>
-                <artifactId>jetty-servlet</artifactId>
-                <version>${jetty.version}</version>
-            </dependency>
-            <dependency>
                 <groupId>org.hamcrest</groupId>
                 <artifactId>java-hamcrest</artifactId>
                 <version>2.0.0.0</version>
diff --git a/server/container/jetty/pom.xml b/server/container/jetty/pom.xml
deleted file mode 100644
index 32c5963..0000000
--- a/server/container/jetty/pom.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements. See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership. The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License. You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied. See the License for the
-    specific language governing permissions and limitations
-    under the License.
--->
-<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/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.james</groupId>
-        <artifactId>james-server</artifactId>
-        <version>3.5.0-SNAPSHOT</version>
-        <relativePath>../../pom.xml</relativePath>
-    </parent>
-
-    <artifactId>james-server-jetty</artifactId>
-    <packaging>jar</packaging>
-
-    <name>Apache James :: Server :: Jetty</name>
-
-    <dependencies>
-        <dependency>
-            <groupId>${james.groupId}</groupId>
-            <artifactId>james-core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>${james.groupId}</groupId>
-            <artifactId>james-server-core</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>${james.groupId}</groupId>
-            <artifactId>james-server-util</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>${james.groupId}</groupId>
-            <artifactId>testing-base</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>commons-beanutils</groupId>
-            <artifactId>commons-beanutils</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.rest-assured</groupId>
-            <artifactId>rest-assured</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-configuration2</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-server</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-servlet</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>jcl-over-slf4j</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>log4j-over-slf4j</artifactId>
-        </dependency>
-    </dependencies>
-</project>
diff --git a/server/container/jetty/src/main/java/org/apache/james/http/jetty/Configuration.java b/server/container/jetty/src/main/java/org/apache/james/http/jetty/Configuration.java
deleted file mode 100644
index f975a62..0000000
--- a/server/container/jetty/src/main/java/org/apache/james/http/jetty/Configuration.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-package org.apache.james.http.jetty;
-
-import java.util.Objects;
-import java.util.Optional;
-
-import javax.servlet.Servlet;
-
-import org.apache.james.util.Port;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableListMultimap;
-import com.google.common.collect.ImmutableMap;
-
-public class Configuration {
-
-    public static Configuration defaultConfiguration() {
-        return builder().build();
-    }
-
-    public static Configuration.Builder builder() {
-        return new Builder();
-    }
-    
-    public static class Builder {
-
-        private final ImmutableMap.Builder<String, Object> mappings;
-        private final ImmutableListMultimap.Builder<String, Object> filters;
-        private Optional<Integer> port;
-        
-        public class ServletBinder {
-            private final String mappingUrl;
-
-            private ServletBinder(String mappingUrl) {
-                this.mappingUrl = mappingUrl;
-            }
-            
-            public Configuration.Builder with(Servlet servlet) {
-                Preconditions.checkNotNull(servlet);
-                mappings.put(mappingUrl, servlet);
-                return Builder.this;
-            }
-
-            public Configuration.Builder with(Class<? extends Servlet> servletClass) {
-                Preconditions.checkNotNull(servletClass);
-                mappings.put(mappingUrl, servletClass);
-                return Builder.this;
-            }
-        }
-        
-        private Builder() {
-            mappings = ImmutableMap.builder();
-            filters = ImmutableListMultimap.builder();
-            port = Optional.empty();
-        }
-        
-        public ServletBinder serve(String mappingUrl) {
-            urlPreconditions(mappingUrl);
-            return new ServletBinder(mappingUrl);
-        }
-
-        private void urlPreconditions(String mappingUrl) {
-            Preconditions.checkNotNull(mappingUrl);
-            Preconditions.checkArgument(!mappingUrl.trim().isEmpty());
-        }
-
-        public Builder port(int port) {
-            Port.assertValid(port);
-            this.port = Optional.of(port);
-            return this;
-        }
-
-        public Builder randomPort() {
-            this.port = Optional.empty();
-            return this;
-        }
-        
-        public Configuration build() {
-            return new Configuration(mappings.build(), filters.build(), port);
-        }
-    }
-
-    private final ImmutableMap<String, Object> mappings;
-    private final ImmutableListMultimap<String, Object> filters;
-    private final Optional<Integer> port;
-
-    private Configuration(ImmutableMap<String, Object> mappings, ImmutableListMultimap<String, Object> filters, Optional<Integer> port) {
-        this.mappings = mappings;
-        this.filters = filters;
-        this.port = port;
-    }
-    
-    public ImmutableMap<String, Object> getMappings() {
-        return mappings;
-    }
-
-    public ImmutableListMultimap<String, Object> getFilters() {
-        return filters;
-    }
-
-    
-    public Optional<Integer> getPort() {
-        return port;
-    }
-    
-    @Override
-    public int hashCode() {
-        return Objects.hash(mappings, port);
-    }
-    
-    @Override
-    public boolean equals(Object that) {
-        if (that instanceof Configuration) {
-            Configuration other = (Configuration) that;
-            return Objects.equals(mappings, other.mappings)
-                    && Objects.equals(filters, other.filters)
-                    && Objects.equals(port, other.port);
-        }
-        return false;
-    }
-    
-    @Override
-    public String toString() {
-        return MoreObjects.toStringHelper(getClass())
-                .add("mappings", mappings)
-                .add("filters", filters)
-                .add("port", port)
-                .toString();
-    }
-
-}
\ No newline at end of file
diff --git a/server/container/jetty/src/main/java/org/apache/james/http/jetty/ConfigurationException.java b/server/container/jetty/src/main/java/org/apache/james/http/jetty/ConfigurationException.java
deleted file mode 100644
index b0585b2..0000000
--- a/server/container/jetty/src/main/java/org/apache/james/http/jetty/ConfigurationException.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-package org.apache.james.http.jetty;
-
-public class ConfigurationException extends RuntimeException {
-
-    public ConfigurationException(String message, ClassNotFoundException e) {
-        super(message, e);
-    }
-
-    public ConfigurationException(String message) {
-        super(message);
-    }
-
-}
diff --git a/server/container/jetty/src/main/java/org/apache/james/http/jetty/JettyHttpServer.java b/server/container/jetty/src/main/java/org/apache/james/http/jetty/JettyHttpServer.java
deleted file mode 100644
index 8c33b92..0000000
--- a/server/container/jetty/src/main/java/org/apache/james/http/jetty/JettyHttpServer.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.http.jetty;
-
-import java.io.Closeable;
-import java.util.Collection;
-import java.util.EnumSet;
-import java.util.function.BiConsumer;
-
-import javax.servlet.DispatcherType;
-import javax.servlet.Filter;
-import javax.servlet.Servlet;
-
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlet.ServletHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.util.thread.QueuedThreadPool;
-
-import com.google.common.collect.Maps;
-import com.google.common.collect.Multimaps;
-
-public class JettyHttpServer implements Closeable {
-    
-    private static final int A_SINGLE_THREAD = 1;
-    private static final int MAX_THREAD = 200;
-
-    public static JettyHttpServer create(Configuration configuration) {
-        return new JettyHttpServer(configuration);
-    }
-
-    private final Server server;
-    private ServerConnector serverConnector;
-    private final Configuration configuration;
-
-    private JettyHttpServer(Configuration configuration) {
-        this.configuration = configuration;
-        this.server = new Server(new QueuedThreadPool(MAX_THREAD, A_SINGLE_THREAD));
-        this.server.addConnector(buildServerConnector(configuration));
-        this.server.setHandler(buildServletHandler(configuration));
-    }
-
-    private ServerConnector buildServerConnector(Configuration configuration) {
-        this.serverConnector = new ServerConnector(server);
-        configuration.getPort().ifPresent(serverConnector::setPort);
-        return serverConnector;
-    }
-
-    private ServletHandler buildServletHandler(Configuration configuration) {
-        ServletHandler servletHandler = new ServletHandler();
-        
-        BiConsumer<String, ServletHolder> addServletMapping = (path, servletHolder) -> servletHandler.addServletWithMapping(servletHolder, path);
-        BiConsumer<String, Collection<FilterHolder>> addFilterMappings = 
-                (path, filterHolders) -> filterHolders.forEach(
-                        filterHolder -> servletHandler.addFilterWithMapping(filterHolder, path, EnumSet.of(DispatcherType.REQUEST)));
-                
-        Maps.transformEntries(configuration.getMappings(), this::toServletHolder).forEach(addServletMapping);
-        Multimaps.transformEntries(configuration.getFilters(), this::toFilterHolder).asMap().forEach(addFilterMappings);
-        return servletHandler;
-    }
-
-    
-    @SuppressWarnings("unchecked")
-    private ServletHolder toServletHolder(String path, Object value) {
-        if (value instanceof Servlet) {
-            return new ServletHolder((Servlet) value);
-        }
-        return new ServletHolder((Class<? extends Servlet>)value);
-    }
-    
-    @SuppressWarnings("unchecked")
-    private FilterHolder toFilterHolder(String path, Object value) {
-        if (value instanceof Filter) {
-            return new FilterHolder((Filter)value);
-        }
-        return new FilterHolder((Class<? extends Filter>)value);
-    }
-    
-    public JettyHttpServer start() throws Exception {
-        server.start();
-        return this;
-    }
-    
-    public void stop() throws Exception {
-        server.stop();
-    }
-
-    public int getPort() {
-        return serverConnector.getLocalPort();
-    }
-
-    public Configuration getConfiguration() {
-        return configuration;
-    }
-    
-    @Override
-    public void close() {
-        try {
-            stop();
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-    
-}
diff --git a/server/container/jetty/src/test/java/org/apache/james/http/jetty/Bad400.java b/server/container/jetty/src/test/java/org/apache/james/http/jetty/Bad400.java
deleted file mode 100644
index 7841146..0000000
--- a/server/container/jetty/src/test/java/org/apache/james/http/jetty/Bad400.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-package org.apache.james.http.jetty;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-public class Bad400 extends HttpServlet {
-
-    @Override
-    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-            throws ServletException, IOException {
-        resp.setStatus(400);
-        resp.getWriter().println("Bad");
-        resp.flushBuffer();
-    }
-    
-}
diff --git a/server/container/jetty/src/test/java/org/apache/james/http/jetty/ConfigurationTest.java b/server/container/jetty/src/test/java/org/apache/james/http/jetty/ConfigurationTest.java
deleted file mode 100644
index b2ee526..0000000
--- a/server/container/jetty/src/test/java/org/apache/james/http/jetty/ConfigurationTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-package org.apache.james.http.jetty;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-
-import javax.servlet.Servlet;
-
-import org.junit.Test;
-
-public class ConfigurationTest {
-
-    @Test
-    public void defaultConfigurationDefinition() {
-        Configuration defaultConfiguration = Configuration.defaultConfiguration();
-        assertThat(defaultConfiguration.getPort()).isEmpty();
-        assertThat(defaultConfiguration.getMappings()).isEmpty();
-    }
-
-    @Test
-    public void shouldAllowWorkingDefinition() {
-        Bad400 bad400 = new Bad400();
-        Configuration testee = Configuration
-                .builder()
-                .port(2000)
-                .serve("/abc")
-                .with(Ok200.class)
-                .serve("/def")
-                .with(bad400)
-                .build();
-        assertThat(testee.getPort()).isPresent().contains(2000);
-        assertThat(testee.getMappings())
-            .hasSize(2)
-            .containsEntry("/abc", Ok200.class)
-            .containsEntry("/def", bad400);
-    }
-
-    @Test
-    public void shouldAllowRandomPort() {
-        Configuration testee = Configuration.builder().randomPort().build();
-        assertThat(testee.getPort()).isEmpty();
-    }
-    
-    @Test
-    public void shouldNotAllowNegativePort() {
-        assertThatThrownBy(() -> Configuration.builder().port(-1)).isInstanceOf(IllegalArgumentException.class);
-    }
-
-    @Test
-    public void shouldNotAllowZeroPort() {
-        assertThatThrownBy(() -> Configuration.builder().port(0)).isInstanceOf(IllegalArgumentException.class);
-    }
-
-
-    @Test
-    public void shouldNotAllowTooLargePort() {
-        assertThatThrownBy(() -> Configuration.builder().port(65536)).isInstanceOf(IllegalArgumentException.class);
-    }
-    
-    @Test
-    public void shouldNotAllowOverridingPortWithRandom() {
-        Configuration configuration = Configuration.builder().port(143).randomPort().build();
-        assertThat(configuration.getPort()).isEmpty();
-    }
-    
-    @Test
-    public void shouldNotAllowNullServletMappingUrl() {
-        assertThatThrownBy(() -> Configuration.builder().serve(null)).isInstanceOf(NullPointerException.class);
-    }
-
-    @Test
-    public void shouldNotAllowEmptyServletMappingUrl() {
-        assertThatThrownBy(() -> Configuration.builder().serve("")).isInstanceOf(IllegalArgumentException.class);
-    }
-
-
-    @Test
-    public void shouldNotAllowWhitespaceOnlyServletMappingUrl() {
-        assertThatThrownBy(() -> Configuration.builder().serve("    ")).isInstanceOf(IllegalArgumentException.class);
-    }
-    
-
-    @Test
-    public void shouldNotAllowNullServlet() {
-        assertThatThrownBy(() -> Configuration.builder().serve("/").with((Servlet)null)).isInstanceOf(NullPointerException.class);
-    }
-    
-    @Test
-    public void shouldNotAllowNullServletClassname() {
-        assertThatThrownBy(() -> Configuration.builder().serve("/").with((Class<? extends Servlet>)null)).isInstanceOf(NullPointerException.class);
-    }
-}
diff --git a/server/container/jetty/src/test/java/org/apache/james/http/jetty/JettyHttpServerTest.java b/server/container/jetty/src/test/java/org/apache/james/http/jetty/JettyHttpServerTest.java
deleted file mode 100644
index d9a12bf..0000000
--- a/server/container/jetty/src/test/java/org/apache/james/http/jetty/JettyHttpServerTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.http.jetty;
-
-import static io.restassured.RestAssured.when;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.james.util.Port;
-import org.hamcrest.Matchers;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.google.common.io.Closeables;
-
-import io.restassured.RestAssured;
-
-public class JettyHttpServerTest {
-
-    @FunctionalInterface
-    private interface ServletMethod {
-        void handle(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException;
-    }
-    
-    private static HttpServlet get(ServletMethod method) {
-        return new HttpServlet() {
-            @Override
-            protected void doGet(HttpServletRequest req,
-                    HttpServletResponse resp) throws ServletException, IOException {
-                method.handle(req, resp);
-            }
-        };
-    }
-    
-    private JettyHttpServer testee;
-    private Configuration.Builder configurationBuilder;
-    
-    @Before
-    public void setup() {
-        configurationBuilder = Configuration.builder().randomPort();
-    }
-    
-    @After
-    public void teardown() throws Exception {
-        Closeables.close(testee, false);
-    }
-    
-    @Test
-    public void shouldStartOnRandomPort() throws Exception {
-        try (JettyHttpServer first = JettyHttpServer.create(configurationBuilder.build()).start();
-             JettyHttpServer second = JettyHttpServer.create(configurationBuilder.build()).start()) {
-            assertThat(first.getPort()).isNotEqualTo(second.getPort());
-        }
-    }
-    
-    @Test
-    public void shouldStartOnConfiguredPort() throws Exception {
-        int port = Port.generateValidUnprivilegedPort();
-        testee = JettyHttpServer.create(configurationBuilder.port(port).build()).start();
-        assertThat(testee.getPort()).isEqualTo(port);
-    }
-    
-    @Test
-    public void shouldReturn404WhenNoServletConfigured() throws Exception {
-        testee = JettyHttpServer.create(configurationBuilder.build()).start();
-        RestAssured.port = testee.getPort();
-        when()
-            .get("/")
-        .then()
-            .assertThat()
-                .statusCode(404);
-    }
-    
-    @Test
-    public void shouldLetConfiguredServletHandleIncomingRequestWhenServletConfigured() throws Exception {
-        ServletMethod getHandler = (req, resp) -> resp.getWriter().append("served").close();
-        
-        testee = JettyHttpServer.create(configurationBuilder
-                                        .serve("/")
-                                        .with(get(getHandler)).build())
-                                .start();
-        
-        RestAssured.port = testee.getPort();
-        
-        when()
-            .get("/")
-        .then()
-            .assertThat()
-                .statusCode(200)
-                .body(Matchers.equalTo("served"));
-    }
-    
-    @Test
-    public void shouldDispatchToRightServletWhenTwoServletConfigured() throws Exception {
-        ServletMethod fooGetHandler = (req, resp) -> resp.getWriter().append("served").close();
-        ServletMethod barGetMethod = (req, resp) -> resp.sendError(400, "should not be called");
-        
-        testee = JettyHttpServer.create(configurationBuilder
-                                        .serve("/foo")
-                                        .with(get(fooGetHandler))
-                                        .serve("/bar")
-                                        .with(get(barGetMethod))
-                                        .build())
-                                .start();
-        
-        RestAssured.port = testee.getPort();
-        
-        when()
-            .get("/foo")
-        .then()
-            .assertThat()
-                .statusCode(200)
-                .body(Matchers.equalTo("served"));
-    }
-    
-    @Test
-    public void shouldLetConfiguredServletHandleIncomingRequestWhenServletConfiguredByName() throws Exception {
-        
-        testee = JettyHttpServer.create(configurationBuilder
-                                        .serve("/foo")
-                                        .with(Ok200.class)
-                                        .build())
-                                .start();
-        
-        RestAssured.port = testee.getPort();
-        
-        when()
-            .get("/foo")
-        .then()
-            .assertThat()
-                .statusCode(200)
-                .body(Matchers.equalTo("Ok"));
-    }
-    
-}
diff --git a/server/container/jetty/src/test/java/org/apache/james/http/jetty/Ok200.java b/server/container/jetty/src/test/java/org/apache/james/http/jetty/Ok200.java
deleted file mode 100644
index 0fcd442..0000000
--- a/server/container/jetty/src/test/java/org/apache/james/http/jetty/Ok200.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-package org.apache.james.http.jetty;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-public class Ok200 extends HttpServlet {
-
-    @Override
-    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-            throws ServletException, IOException {
-        resp.getWriter().print("Ok");
-        resp.flushBuffer();
-    }
-    
-}
diff --git a/server/pom.xml b/server/pom.xml
index 1cf1d76..da0eade 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -47,7 +47,6 @@
         <module>container/core</module>
         <module>container/filesystem-api</module>
         <module>container/guice</module>
-        <module>container/jetty</module>
         <module>container/lifecycle-api</module>
         <module>container/mailbox-adapter</module>
         <module>container/mailbox-jmx</module>


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org