Author: matthieu
Date: Fri Dec 11 10:03:52 2015
New Revision: 1719296
URL: http://svn.apache.org/viewvc?rev=1719296&view=rev
Log:
JAMES-1639 Create a jetty server that answers to get
Added:
james/project/trunk/server/container/jetty/
james/project/trunk/server/container/jetty/pom.xml
james/project/trunk/server/container/jetty/src/
james/project/trunk/server/container/jetty/src/main/
james/project/trunk/server/container/jetty/src/main/java/
james/project/trunk/server/container/jetty/src/main/java/org/
james/project/trunk/server/container/jetty/src/main/java/org/apache/
james/project/trunk/server/container/jetty/src/main/java/org/apache/james/
james/project/trunk/server/container/jetty/src/main/java/org/apache/james/http/
james/project/trunk/server/container/jetty/src/main/java/org/apache/james/http/jetty/
james/project/trunk/server/container/jetty/src/main/java/org/apache/james/http/jetty/JettyHttpServer.java
james/project/trunk/server/container/jetty/src/test/
james/project/trunk/server/container/jetty/src/test/java/
james/project/trunk/server/container/jetty/src/test/java/org/
james/project/trunk/server/container/jetty/src/test/java/org/apache/
james/project/trunk/server/container/jetty/src/test/java/org/apache/james/
james/project/trunk/server/container/jetty/src/test/java/org/apache/james/http/
james/project/trunk/server/container/jetty/src/test/java/org/apache/james/http/jetty/
james/project/trunk/server/container/jetty/src/test/java/org/apache/james/http/jetty/JettyHttpServerTest.java
Modified:
james/project/trunk/server/pom.xml
Added: james/project/trunk/server/container/jetty/pom.xml
URL:
http://svn.apache.org/viewvc/james/project/trunk/server/container/jetty/pom.xml?rev=1719296&view=auto
==============================================================================
--- james/project/trunk/server/container/jetty/pom.xml (added)
+++ james/project/trunk/server/container/jetty/pom.xml Fri Dec 11 10:03:52 2015
@@ -0,0 +1,197 @@
+<?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>
+ <artifactId>james-server</artifactId>
+ <groupId>org.apache.james</groupId>
+ <version>3.0.0-beta5-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>james-server-jetty</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Apache James :: Server :: Jetty</name>
+ <profiles>
+ <profile>
+ <id>disable-build-for-older-jdk</id>
+ <activation>
+ <jdk>(,1.8)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>jar</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>test-jar</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-compile</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testCompile</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-install</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-resources</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>default-testResources</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-descriptor</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>build-for-jdk-8</id>
+ <activation>
+ <jdk>[1.8,)</jdk>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>com.jayway.restassured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <version>2.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <version>3.2.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-http</artifactId>
+ <version>9.3.5.v20151012</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ <version>9.3.5.v20151012</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
+ <version>9.3.5.v20151012</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>disable-animal-sniffer</id>
+ <activation>
+ <jdk>[1.6,)</jdk>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>check_java_6</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
Added:
james/project/trunk/server/container/jetty/src/main/java/org/apache/james/http/jetty/JettyHttpServer.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/server/container/jetty/src/main/java/org/apache/james/http/jetty/JettyHttpServer.java?rev=1719296&view=auto
==============================================================================
---
james/project/trunk/server/container/jetty/src/main/java/org/apache/james/http/jetty/JettyHttpServer.java
(added)
+++
james/project/trunk/server/container/jetty/src/main/java/org/apache/james/http/jetty/JettyHttpServer.java
Fri Dec 11 10:03:52 2015
@@ -0,0 +1,56 @@
+/****************************************************************
+ * 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 org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+
+public class JettyHttpServer {
+
+ public static class Configuration {
+
+ }
+
+ public static JettyHttpServer start(Configuration configuration) throws
Exception {
+ return new JettyHttpServer().start();
+ }
+
+ private Server server;
+ private ServerConnector serverConnector;
+
+ private JettyHttpServer() {
+ server = new Server();
+ serverConnector = new ServerConnector(server);
+ server.addConnector(serverConnector);
+ }
+
+ private JettyHttpServer start() throws Exception {
+ server.start();
+ return this;
+ }
+
+ public void stop() {
+ }
+
+ public int getPort() {
+ return serverConnector.getLocalPort();
+ }
+
+}
Added:
james/project/trunk/server/container/jetty/src/test/java/org/apache/james/http/jetty/JettyHttpServerTest.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/server/container/jetty/src/test/java/org/apache/james/http/jetty/JettyHttpServerTest.java?rev=1719296&view=auto
==============================================================================
---
james/project/trunk/server/container/jetty/src/test/java/org/apache/james/http/jetty/JettyHttpServerTest.java
(added)
+++
james/project/trunk/server/container/jetty/src/test/java/org/apache/james/http/jetty/JettyHttpServerTest.java
Fri Dec 11 10:03:52 2015
@@ -0,0 +1,54 @@
+/****************************************************************
+ * 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 com.jayway.restassured.RestAssured.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.jayway.restassured.RestAssured;
+
+public class JettyHttpServerTest {
+
+ private JettyHttpServer testee;
+
+ @Before
+ public void setup() {
+ }
+
+ @After
+ public void teardown() {
+ testee.stop();
+ }
+
+ @Test
+ public void shouldReturn404WhenNoServletConfigured() throws Exception {
+ testee = JettyHttpServer.start(new JettyHttpServer.Configuration());
+ RestAssured.port = testee.getPort();
+ when()
+ .get("/")
+ .then()
+ .assertThat()
+ .statusCode(404);
+ }
+
+}
Modified: james/project/trunk/server/pom.xml
URL:
http://svn.apache.org/viewvc/james/project/trunk/server/pom.xml?rev=1719296&r1=1719295&r2=1719296&view=diff
==============================================================================
--- james/project/trunk/server/pom.xml (original)
+++ james/project/trunk/server/pom.xml Fri Dec 11 10:03:52 2015
@@ -62,6 +62,7 @@
<module>container/cli</module>
<module>container/core</module>
<module>container/filesystem-api</module>
+ <module>container/jetty</module>
<module>container/lifecycle-api</module>
<module>container/mailbox-adapter</module>
<module>container/spring</module>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]