Skip to content

Commit

Permalink
Reorg of /demos/ with focus on demo-spec downstream dependencies. (#5367
Browse files Browse the repository at this point in the history
)

* Reorg of /demos/ with focus on spec modules
* Reworking demo-mock-resources into /demos/ proper
* Removing old /tests/ modules that no longer have a reason for existing.
* Making demo-mock-resources a formal module
* demo-jndi and demo-spec now depend on it
* Restoring jetty-maven-plugin config lost in demo-jetty-webapp
* Fixing jetty-maven-plugin realm usage to be local

Signed-off-by: Joakim Erdfelt <[email protected]>
  • Loading branch information
joakime authored Sep 29, 2020
1 parent ad2446d commit b22ce9c
Show file tree
Hide file tree
Showing 64 changed files with 184 additions and 372 deletions.
2 changes: 1 addition & 1 deletion demos/demo-async-rest/demo-async-rest-jar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>demo-async-rest-jar</artifactId>
<packaging>jar</packaging>
<name>Demo Async Rest :: Jar</name>
<name>Demo :: Async Rest :: Jar</name>

<properties>
<bundle-symbolic-name>${project.parent.groupId}.async.rest</bundle-symbolic-name>
Expand Down
2 changes: 1 addition & 1 deletion demos/demo-async-rest/demo-async-rest-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>demo-async-rest-server</artifactId>
<packaging>jar</packaging>
<name>Demo Async Rest :: Server</name>
<name>Demo :: Async Rest :: Server</name>

<properties>
<bundle-symbolic-name>${project.parent.groupId}.async.rest.server</bundle-symbolic-name>
Expand Down
2 changes: 1 addition & 1 deletion demos/demo-async-rest/demo-async-rest-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>demo-async-rest-webapp</artifactId>
<packaging>war</packaging>
<name>Demo Async Rest :: Webapp</name>
<name>Demo :: Async Rest :: WebApp</name>

<dependencies>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion demos/demo-async-rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>demo-async-rest-parent</artifactId>
<packaging>pom</packaging>
<name>Demo Async Rest</name>
<name>Demo :: Async Rest</name>

<modules>
<module>demo-async-rest-jar</module>
Expand Down
2 changes: 1 addition & 1 deletion demos/demo-jaas-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<version>10.0.0-SNAPSHOT</version>
</parent>
<artifactId>demo-jaas-webapp</artifactId>
<name>Jetty Tests :: WebApp :: JAAS</name>
<name>Demo :: JAAS :: WebApp</name>
<packaging>war</packaging>
<properties>
<bundle-symbolic-name>${project.groupId}.jaas</bundle-symbolic-name>
Expand Down
41 changes: 40 additions & 1 deletion demos/demo-jetty-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>demo-jetty-webapp</artifactId>
<name>Demo :: Jetty Test Webapp</name>
<name>Demo :: Jetty :: WebApp</name>
<packaging>war</packaging>
<properties>
<bundle-symbolic-name>${project.groupId}.webapp</bundle-symbolic-name>
Expand Down Expand Up @@ -85,6 +85,45 @@
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${project.version}</version>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<configuration>
<stopPort>8087</stopPort>
<stopKey>foo</stopKey>
<scan>1</scan>
<systemProperties>
<fooprop>222</fooprop>
</systemProperties>
<webApp>
<contextPath>/test</contextPath>
<tempDirectory>${project.build.directory}/work</tempDirectory>
</webApp>
<loginServices>
<loginService implementation="org.eclipse.jetty.security.HashLoginService">
<name>Test Realm</name>
<config>src/test/resources/test-realm.properties</config>
</loginService>
</loginServices>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
Expand Down
20 changes: 20 additions & 0 deletions demos/demo-jetty-webapp/src/test/resources/test-realm.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# This file defines users passwords and roles for a HashUserRealm
#
# The format is
# <username>: <password>[,<rolename> ...]
#
# Passwords may be clear text, obfuscated or checksummed. The class
# org.eclipse.util.Password should be used to generate obfuscated
# passwords or password checksums
#
# If DIGEST Authentication is used, the password must be in a recoverable
# format, either plain text or OBF:.
#
jetty:MD5:164c88b302622e17050af52c89945d44,user
admin:CRYPT:adpexzg3FUZAk,server-administrator,content-administrator,admin,user
other:OBF:1xmk1w261u9r1w1c1xmq,user
plain:plain,user
user:password,user
# This entry is for digest auth. The credential is a MD5 hash of username:realmname:password
digest:MD5:6e120743ad67abfbc385bc2bb754e297,user
2 changes: 1 addition & 1 deletion demos/demo-jndi-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<version>10.0.0-SNAPSHOT</version>
</parent>
<artifactId>demo-jndi-webapp</artifactId>
<name>Demo :: WebApp :: JNDI</name>
<name>Demo :: JNDI :: WebApp</name>
<packaging>war</packaging>
<properties>
<bundle-symbolic-name>${project.groupId}.jndi</bundle-symbolic-name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ deploy
ext
jdbc
plus
demo-mock-resources

[files]
basehome:modules/demo.d/demo-jndi.xml|webapps/demo-jndi.xml
maven://org.eclipse.jetty.demos/demo-jndi-webapp/${jetty.version}/war|webapps/demo-jndi.war
maven://org.eclipse.jetty.demos/demo-mock-resources/${jetty.version}/jar|lib/ext/demo-mock-resources-${jetty.version}.jar
maven://org.eclipse.jetty.orbit/javax.mail.glassfish/1.4.1.v201005082020/jar|lib/ext/javax.mail.glassfish-1.4.1.v201005082020.jar
maven://jakarta.transaction/jakarta.transaction-api/1.3.2/jar|lib/ext/jakarta.transaction-api-1.3.2.jar
2 changes: 1 addition & 1 deletion demos/demo-mock-resources/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>demos-parent</artifactId>
<version>10.0.0-SNAPSHOT</version>
</parent>
<name>Demos :: WebApp :: Mock Resources</name>
<name>Demo :: Mock Resources</name>
<artifactId>demo-mock-resources</artifactId>
<packaging>jar</packaging>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html

[description]
Download and install some Demo Mock Resources

[tags]
demo

[depends]
jdbc
annotations

[files]
maven://org.eclipse.jetty.demos/demo-mock-resources/${jetty.version}/jar|lib/ext/demo-mock-resources-${jetty.version}.jar
2 changes: 1 addition & 1 deletion demos/demo-proxy-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>demo-proxy-webapp</artifactId>
<name>Demo :: Jetty Proxy Webapp</name>
<name>Demo :: Proxy :: Webapp</name>
<packaging>war</packaging>
<properties>
<bundle-symbolic-name>${project.groupId}.proxy</bundle-symbolic-name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<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.eclipse.jetty.tests</groupId>
<artifactId>test-servlet-spec-parent</artifactId>
<groupId>org.eclipse.jetty.demos</groupId>
<artifactId>demos-parent</artifactId>
<version>10.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>test-container-initializer</artifactId>
<artifactId>demo-container-initializer</artifactId>
<packaging>jar</packaging>
<name>Jetty Tests :: WebApp :: Servlet Spec :: ServletContainerInitializer Test Jar</name>
<name>Demo :: Servlet Spec :: ServletContainerInitializer Jar</name>
<properties>
<bundle-symbolic-name>${project.groupId}.sci</bundle-symbolic-name>
</properties>
Expand All @@ -19,7 +20,7 @@
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>org.eclipse.jetty.tests.test-servlet-container-initializer;singleton:=true</Bundle-SymbolicName>
<Bundle-SymbolicName>org.eclipse.jetty.demos.demo-servlet-container-initializer;singleton:=true</Bundle-SymbolicName>
<Bundle-Description>A bundle containing a ServletContainerInitializer for testing</Bundle-Description>
<Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)"</Require-Capability>
<Provide-Capability>osgi.serviceloader; osgi.serviceloader=javax.servlet.ServletContainerInitializer</Provide-Capability>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void onStartup(Set<Class<?>> classes, ServletContext context)
ServletRegistration.Dynamic reg = context.addServlet("AnnotationTest", "com.acme.AnnotationTest");
context.setAttribute("com.acme.AnnotationTest.complete", (reg == null));
context.addListener(new FooListener());

//test adding jsp file dynamically
ServletRegistration.Dynamic jspFile = context.addJspFile("dynamic.jsp", "/dynamic.jsp");
context.setAttribute("com.acme.jsp.file", (jspFile != null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
<groupId>org.eclipse.jetty.demos</groupId>
<artifactId>demos-parent</artifactId>
<version>10.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<name>Demo :: Spec Webapp</name>
<name>Demo :: Servlet Spec :: Webapp</name>
<artifactId>demo-spec-webapp</artifactId>
<packaging>war</packaging>
<properties>
Expand Down Expand Up @@ -199,13 +200,13 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>test-web-fragment</artifactId>
<groupId>org.eclipse.jetty.demos</groupId>
<artifactId>demo-web-fragment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>test-container-initializer</artifactId>
<groupId>org.eclipse.jetty.demos</groupId>
<artifactId>demo-container-initializer</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jsp
annotations
ext
demo-realm
demo-mock-resources

[files]
basehome:modules/demo.d/demo-spec.xml|webapps/demo-spec.xml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<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.eclipse.jetty.tests</groupId>
<artifactId>test-servlet-spec-parent</artifactId>
<groupId>org.eclipse.jetty.demos</groupId>
<artifactId>demos-parent</artifactId>
<version>10.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<name>Jetty Tests :: WebApp :: Servlet Spec :: Fragment Jar</name>
<artifactId>test-web-fragment</artifactId>
<name>Demo :: Servlet Spec :: Fragment Jar</name>
<artifactId>demo-web-fragment</artifactId>
<packaging>jar</packaging>

<properties>
<bundle-symbolic-name>${project.groupId}.fragment</bundle-symbolic-name>
<bundle-symbolic-name>${project.groupId}.spec.fragment</bundle-symbolic-name>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1>Welcome to a Fragment</h1>

<p>
This index.html file was included in a fragment's META-INF/resources directory.
This index.html file was included in a fragment's META-INF/resources directory.
</p>

<a href="../fragment/">Now hit a servlet added by a fragment</a>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>

<web-fragment
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-fragment_3_1.xsd"
version="3.1">

<name>FragmentA</name>

<ordering>
<after>
<others />
</after>
</ordering>

<servlet>
<servlet-name>AnnotationTest</servlet-name>
<servlet-class>com.acme.test.AnnotationTest</servlet-class>
<init-param>
<param-name>extra1</param-name>
<param-value>123</param-value>
</init-param>
<init-param>
<param-name>extra2</param-name>
<param-value>345</param-value>
</init-param>
</servlet>

<servlet>
<servlet-name>Fragment</servlet-name>
<servlet-class>com.acme.fragment.FragmentServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Fragment</servlet-name>
<url-pattern>/fragment/*</url-pattern>
</servlet-mapping>

</web-fragment>


18 changes: 18 additions & 0 deletions demos/demo-spec/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.eclipse.jetty.demos</groupId>
<artifactId>demos-parent</artifactId>
<version>10.0.0-SNAPSHOT</version>
</parent>
<name>Demo :: Servlet Spec</name>
<artifactId>demo-spec</artifactId>
<packaging>pom</packaging>

<modules>
<module>demo-spec-webapp</module>
<module>demo-container-initializer</module>
<module>demo-web-fragment</module>
</modules>
</project>
4 changes: 2 additions & 2 deletions demos/embedded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>demos-jetty-embedded</artifactId>
<name>Demos :: Jetty Embedded</name>
<description>Jetty Embedded Demos</description>
<name>Demo :: Embedded Jetty</name>
<description>Embedded Jetty Demos</description>
<properties>
<bundle-symbolic-name>${project.groupId}.embedded</bundle-symbolic-name>
</properties>
Expand Down
4 changes: 2 additions & 2 deletions demos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.jetty.demos</groupId>
<artifactId>demos-parent</artifactId>
<name>Jetty Demos :: Parent</name>
<name>Demos :: Parent</name>
<packaging>pom</packaging>

<properties>
Expand All @@ -22,8 +22,8 @@
<module>demo-jndi-webapp</module>
<module>demo-jetty-webapp</module>
<module>demo-proxy-webapp</module>
<module>demo-spec-webapp</module>
<module>demo-mock-resources</module>
<module>demo-spec</module>
<module>embedded</module>
</modules>
</project>
8 changes: 8 additions & 0 deletions jetty-home/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,14 @@
<optional>true</optional>
</dependency>
<!-- Demo Apps -->
<dependency>
<groupId>org.eclipse.jetty.demos</groupId>
<artifactId>demo-mock-resources</artifactId>
<version>${project.version}</version>
<classifier>config</classifier>
<type>jar</type>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.demos</groupId>
<artifactId>demo-jetty-webapp</artifactId>
Expand Down
Loading

0 comments on commit b22ce9c

Please sign in to comment.