diff options
Diffstat (limited to 'tests/test-cdi')
10 files changed, 364 insertions, 0 deletions
diff --git a/tests/test-cdi/cdi-client/pom.xml b/tests/test-cdi/cdi-client/pom.xml new file mode 100644 index 0000000000..3419c3b6f7 --- /dev/null +++ b/tests/test-cdi/cdi-client/pom.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +// ======================================================================== +// Copyright (c) Webtide LLC +// +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.apache.org/licenses/LICENSE-2.0.txt +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== + --> +<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"> + <parent> + <groupId>org.eclipse.jetty.tests</groupId> + <artifactId>test-cdi-parent</artifactId> + <version>9.2.4-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>cdi-client</artifactId> + <packaging>jar</packaging> + <name>Jetty Tests :: CDI :: Clients</name> + <url>http://www.eclipse.org/jetty</url> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <bundle-symbolic-name>${project.groupId}.cdi.clients</bundle-symbolic-name> + </properties> + <dependencies> + </dependencies> +</project> diff --git a/tests/test-cdi/cdi-tests/pom.xml b/tests/test-cdi/cdi-tests/pom.xml new file mode 100644 index 0000000000..89af2d9d68 --- /dev/null +++ b/tests/test-cdi/cdi-tests/pom.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +// ======================================================================== +// Copyright (c) Webtide LLC +// +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.apache.org/licenses/LICENSE-2.0.txt +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== + --> +<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"> + <parent> + <groupId>org.eclipse.jetty.tests</groupId> + <artifactId>test-cdi-parent</artifactId> + <version>9.2.4-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>cdi-tests</artifactId> + <packaging>jar</packaging> + <name>Jetty Tests :: CDI :: Tests</name> + <url>http://www.eclipse.org/jetty</url> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <bundle-symbolic-name>${project.groupId}.cdi.tests</bundle-symbolic-name> + </properties> + <dependencies> + <dependency> + <groupId>org.eclipse.jetty.tests</groupId> + <artifactId>cdi-webapp</artifactId> + <version>${project.version}</version> + <type>war</type> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.eclipse.jetty.tests</groupId> + <artifactId>cdi-client</artifactId> + <version>${project.version}</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.eclipse.jetty.toolchain</groupId> + <artifactId>jetty-test-helper</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/tests/test-cdi/cdi-tests/src/test/java/org/eclipse/jetty/tests/DistroSetup.java b/tests/test-cdi/cdi-tests/src/test/java/org/eclipse/jetty/tests/DistroSetup.java new file mode 100644 index 0000000000..e60756cc25 --- /dev/null +++ b/tests/test-cdi/cdi-tests/src/test/java/org/eclipse/jetty/tests/DistroSetup.java @@ -0,0 +1,24 @@ +// +// ======================================================================== +// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.tests; + +public class DistroSetup +{ + +} diff --git a/tests/test-cdi/cdi-tests/src/test/java/org/eclipse/jetty/tests/JettyDistroRunner.java b/tests/test-cdi/cdi-tests/src/test/java/org/eclipse/jetty/tests/JettyDistroRunner.java new file mode 100644 index 0000000000..cd671a6d3d --- /dev/null +++ b/tests/test-cdi/cdi-tests/src/test/java/org/eclipse/jetty/tests/JettyDistroRunner.java @@ -0,0 +1,24 @@ +// +// ======================================================================== +// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.tests; + +public class JettyDistroRunner +{ + +} diff --git a/tests/test-cdi/cdi-tests/src/test/java/org/eclipse/jetty/tests/ServletTest.java b/tests/test-cdi/cdi-tests/src/test/java/org/eclipse/jetty/tests/ServletTest.java new file mode 100644 index 0000000000..6607b1ae5a --- /dev/null +++ b/tests/test-cdi/cdi-tests/src/test/java/org/eclipse/jetty/tests/ServletTest.java @@ -0,0 +1,30 @@ +// +// ======================================================================== +// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.tests; + +import org.junit.Test; + +public class ServletTest +{ + @Test + public void testHello() + { + + } +} diff --git a/tests/test-cdi/cdi-webapp/pom.xml b/tests/test-cdi/cdi-webapp/pom.xml new file mode 100644 index 0000000000..117fe105e2 --- /dev/null +++ b/tests/test-cdi/cdi-webapp/pom.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + // ======================================================================== + // Copyright (c) Webtide LLC + // + // All rights reserved. This program and the accompanying materials + // are made available under the terms of the Eclipse Public License v1.0 + // and Apache License v2.0 which accompanies this distribution. + // + // The Eclipse Public License is available at + // http://www.eclipse.org/legal/epl-v10.html + // + // The Apache License v2.0 is available at + // http://www.apache.org/licenses/LICENSE-2.0.txt + // + // You may elect to redistribute this code under either of these licenses. + // ======================================================================== +--> +<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"> + <parent> + <groupId>org.eclipse.jetty.tests</groupId> + <artifactId>test-cdi-parent</artifactId> + <version>9.2.4-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>cdi-webapp</artifactId> + <packaging>war</packaging> + <name>Jetty Tests :: CDI :: WebApp</name> + <url>http://www.eclipse.org/jetty</url> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <bundle-symbolic-name>${project.groupId}.cdi.webapp</bundle-symbolic-name> + </properties> + <dependencies> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.enterprise</groupId> + <artifactId>cdi-api</artifactId> + <version>1.1</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.websocket</groupId> + <artifactId>javax.websocket-api</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> + <build> + <finalName>cdi-webapp</finalName> + </build> +</project> diff --git a/tests/test-cdi/cdi-webapp/src/main/java/org/eclipse/jetty/tests/HelloServlet.java b/tests/test-cdi/cdi-webapp/src/main/java/org/eclipse/jetty/tests/HelloServlet.java new file mode 100644 index 0000000000..c401d857bb --- /dev/null +++ b/tests/test-cdi/cdi-webapp/src/main/java/org/eclipse/jetty/tests/HelloServlet.java @@ -0,0 +1,42 @@ +// +// ======================================================================== +// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.tests; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * The most basic servlet here, no CDI use. + */ +@SuppressWarnings("serial") +@WebServlet("/hello") +public class HelloServlet extends HttpServlet +{ + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException + { + resp.setContentType("text/plain"); + resp.getWriter().println("Hello World"); + } +} diff --git a/tests/test-cdi/cdi-webapp/src/main/java/org/eclipse/jetty/tests/ServerInfoServlet.java b/tests/test-cdi/cdi-webapp/src/main/java/org/eclipse/jetty/tests/ServerInfoServlet.java new file mode 100644 index 0000000000..6c2d495522 --- /dev/null +++ b/tests/test-cdi/cdi-webapp/src/main/java/org/eclipse/jetty/tests/ServerInfoServlet.java @@ -0,0 +1,54 @@ +// +// ======================================================================== +// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.tests; + +import java.io.IOException; +import java.io.PrintWriter; + +import javax.inject.Inject; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@SuppressWarnings("serial") +@WebServlet("/serverinfo") +public class ServerInfoServlet extends HttpServlet +{ + @Inject + private ServletContext context; + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException + { + resp.setContentType("text/plain"); + + PrintWriter out = resp.getWriter(); + if (context == null) + { + out.println("context = null"); + return; + } + out.printf("context = %s%n",context); + out.printf("context.contextPath = %s%n",context.getContextPath()); + out.printf("context.effective-version = %d.%d%n",context.getEffectiveMajorVersion(),context.getEffectiveMinorVersion()); + } +} diff --git a/tests/test-cdi/cdi-webapp/src/main/webapp/WEB-INF/web.xml b/tests/test-cdi/cdi-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..292a1677ca --- /dev/null +++ b/tests/test-cdi/cdi-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,7 @@ +<?xml version="1.0"?> +<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" + version="3.1"> + <display-name>CDI Integration Test WebApp</display-name> +</web-app> diff --git a/tests/test-cdi/pom.xml b/tests/test-cdi/pom.xml new file mode 100644 index 0000000000..f4e85eb3d5 --- /dev/null +++ b/tests/test-cdi/pom.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +// ======================================================================== +// Copyright (c) Webtide LLC +// +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.apache.org/licenses/LICENSE-2.0.txt +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== + --> +<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"> + <parent> + <groupId>org.eclipse.jetty.tests</groupId> + <artifactId>tests-parent</artifactId> + <version>9.2.4-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>test-cdi-parent</artifactId> + <packaging>pom</packaging> + <name>Jetty Tests :: CDI Parent</name> + <url>http://www.eclipse.org/jetty</url> + <modules> + <module>cdi-webapp</module> + <module>cdi-client</module> + <module>cdi-tests</module> + </modules> +</project> |