From 0499b7f596562f4822a2bac99faf541c544cb6e0 Mon Sep 17 00:00:00 2001 From: Yeray Borges Date: Tue, 13 Apr 2021 10:06:53 +0100 Subject: [PATCH] [CLOUD-3649] Add example application to run behave test that verifies adding drivers at runtime --- .../.s2i/environment | 1 + .../modules/org/postgresql/main/module.xml | 10 + .../test-app-drivers-at-runtime/pom.xml | 103 ++++++ .../src/main/java/.gitkeep | 0 .../src/main/java/Test.java | 6 + .../src/main/resources/.gitkeep | 0 .../src/main/webapp/images/jbosscorp_logo.png | Bin 0 -> 1914 bytes .../src/main/webapp/index.html | 301 ++++++++++++++++++ .../src/main/webapp/snoop.jsp | 283 ++++++++++++++++ 9 files changed, 704 insertions(+) create mode 100644 tests/examples/test-app-drivers-at-runtime/.s2i/environment create mode 100644 tests/examples/test-app-drivers-at-runtime/extensions/modules/org/postgresql/main/module.xml create mode 100644 tests/examples/test-app-drivers-at-runtime/pom.xml create mode 100644 tests/examples/test-app-drivers-at-runtime/src/main/java/.gitkeep create mode 100644 tests/examples/test-app-drivers-at-runtime/src/main/java/Test.java create mode 100644 tests/examples/test-app-drivers-at-runtime/src/main/resources/.gitkeep create mode 100644 tests/examples/test-app-drivers-at-runtime/src/main/webapp/images/jbosscorp_logo.png create mode 100644 tests/examples/test-app-drivers-at-runtime/src/main/webapp/index.html create mode 100644 tests/examples/test-app-drivers-at-runtime/src/main/webapp/snoop.jsp diff --git a/tests/examples/test-app-drivers-at-runtime/.s2i/environment b/tests/examples/test-app-drivers-at-runtime/.s2i/environment new file mode 100644 index 00000000..5869a7c2 --- /dev/null +++ b/tests/examples/test-app-drivers-at-runtime/.s2i/environment @@ -0,0 +1 @@ +S2I_IMAGE_SOURCE_MOUNTS=extensions diff --git a/tests/examples/test-app-drivers-at-runtime/extensions/modules/org/postgresql/main/module.xml b/tests/examples/test-app-drivers-at-runtime/extensions/modules/org/postgresql/main/module.xml new file mode 100644 index 00000000..fbdbf05a --- /dev/null +++ b/tests/examples/test-app-drivers-at-runtime/extensions/modules/org/postgresql/main/module.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/tests/examples/test-app-drivers-at-runtime/pom.xml b/tests/examples/test-app-drivers-at-runtime/pom.xml new file mode 100644 index 00000000..585a34fa --- /dev/null +++ b/tests/examples/test-app-drivers-at-runtime/pom.xml @@ -0,0 +1,103 @@ + + + + 4.0.0 + + openshift-demo + demo-postgres + war + 1.0 + OpenshiftDemo + + + 1.8 + 1.8 + + + This project demonstrates how to implement a JAX-RS service that uses JPA persistence to manage tasks + + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.html + repo + + + + + + javax.enterprise + cdi-api + 1.1 + provided + + + javax.transaction + jta + 1.1 + provided + + + + + org.hibernate.javax.persistence + hibernate-jpa-2.1-api + 1.0.2 + provided + + + javax.xml.bind + jaxb-api + 2.3.0 + + + + org.jboss.spec.javax.ws.rs + jboss-jaxrs-api_2.0_spec + 1.0.1.Final + provided + + + + + + + + + + + openshift + + DemoApp + + + org.apache.maven.plugins + maven-war-plugin + 2.3 + + false + target + ROOT + + + + + + + diff --git a/tests/examples/test-app-drivers-at-runtime/src/main/java/.gitkeep b/tests/examples/test-app-drivers-at-runtime/src/main/java/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/tests/examples/test-app-drivers-at-runtime/src/main/java/Test.java b/tests/examples/test-app-drivers-at-runtime/src/main/java/Test.java new file mode 100644 index 00000000..d7cd2d3f --- /dev/null +++ b/tests/examples/test-app-drivers-at-runtime/src/main/java/Test.java @@ -0,0 +1,6 @@ +// a dummy file to force an actual javac in the maven build +public class Test { + int a; + int b; +} + diff --git a/tests/examples/test-app-drivers-at-runtime/src/main/resources/.gitkeep b/tests/examples/test-app-drivers-at-runtime/src/main/resources/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/tests/examples/test-app-drivers-at-runtime/src/main/webapp/images/jbosscorp_logo.png b/tests/examples/test-app-drivers-at-runtime/src/main/webapp/images/jbosscorp_logo.png new file mode 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%sG%1u)dXs!yA@5zqX`$0W3I0LR|0_KVaM*#is zwGqQ)U7CTYsudVHV;yw1rLM9><1kToqh3U?jc81oY?$;aQ5^%7W#p(#B1I*AcLXLp zibGAUG2QOt)*4~ld5Ts{xP95#CknO(X9D&e7F0#)GnIa#Eg$N4TwI#Vs`z%7qWb2Y zJ7-Cy@Setu`|M@?g%n0DJZDRq)fX^|y{DVHbzqN@nNqdu6x zei??&ajgmZ7>v?n>ffjD#2e+CQ|K39^eRD`0r&MTuvc-X5txIXl0}56ETpzsW2;7B zb~;SN#d}?>ba8`e0?HwT1KZ^t|AGF&$}eHCymAD_tmV3E2gSJzw7?oXA{lXh#It)y zhqO>h^`V^FJ^|C+b~It+DK-W}M}9}+%lZF;F^X`2M-k=r5tx*YRBJZw==#}&Z6Y01 zlK^zc15P&Bn=o_$9p-2s+2ZFyBQS;y_zxj$6Gq+{SYF_gZuv~QAJ6My4y4)eBmY#C zBw3Us$#a;HaSFLB>AyKky0Y(3_3V9%9zX9GIErO0I;=i9!>G z9LG_}ObDi + + + + + Welcome to OpenShift + + + + + + +
+
+

Welcome to your WildFly 8 application on OpenShift

+
+ + +
+
+
+

Deploying code changes

+

OpenShift uses the Git version control system for your source code, and grants you access to it via the Secure Shell (SSH) protocol. In order to upload and download code to your application you need to give us your public SSH key. You can upload it within the web console or install the RHC command line tool and run rhc setup to generate and upload your key automatically.

+ +

Working in your local Git repository

+

If you created your application from the command line and uploaded your SSH key, rhc will automatically download a copy of that source code repository (Git calls this 'cloning') to your local system.

+ +

If you created the application from the web console, you'll need to manually clone the repository to your local system. Copy the application's source code Git URL and then run:

+ +
$ git clone <git_url> <directory_to_create>
+
+# Within your project directory
+# Commit your changes and push to OpenShift
+
+$ git commit -a -m 'Some commit message'
+$ git push
+ + +

Sample Applications

+ To get started you can either modify the default war or try one of these samples: + + +

Example usage

+
+cd kitchensink
+git remote add upstream -m master git://github.com/openshift/kitchensink-example.git
+git pull -s recursive -X theirs upstream master
+ +
+ + +
+
+ +

Managing your application

+ +

Web Console

+

You can use the OpenShift web console to enable additional capabilities via cartridges, add collaborator access authorizations, designate custom domain aliases, and manage domain memberships.

+ +

Command Line Tools

+

Installing the OpenShift RHC client tools allows you complete control of your cloud environment. Read more on how to manage your application from the command line in our User Guide. +

+ +

Development Resources

+

JBoss Developer Studio

+

+ The JBoss Developer Studio is a full featured IDE with OpenShift integration built in. + It gives you the ability to create, edit and deploy applications without having to + leave the IDE. Links to download, install and use the JBoss Developer Studio for Linux, + Mac OS X, or Windows can be found on the + JBoss Developer Studio tools page. +

+

Debugging

+

View debugging information about the server environment including memory pools.

+ + + + + + +
+
+ +
+ +
+
+ + + + diff --git a/tests/examples/test-app-drivers-at-runtime/src/main/webapp/snoop.jsp b/tests/examples/test-app-drivers-at-runtime/src/main/webapp/snoop.jsp new file mode 100644 index 00000000..bb37d8f4 --- /dev/null +++ b/tests/examples/test-app-drivers-at-runtime/src/main/webapp/snoop.jsp @@ -0,0 +1,283 @@ + + + JBossAS7 JSP snoop page + <%@ page import="javax.servlet.http.HttpUtils,java.util.Enumeration" %> + <%@ page import="java.lang.management.*" %> + <%@ page import="java.util.*" %> + + + +

WebApp JSP Snoop page

+ + +

JVM Memory Monitor

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Memory MXBean

+
Heap Memory Usage +<%=ManagementFactory.getMemoryMXBean().getHeapMemoryUsage()%> +
Non-Heap Memory Usage +<%=ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage()%> +
+

Memory Pool MXBeans

+
+<% +Iterator iter = ManagementFactory.getMemoryPoolMXBeans().iterator(); +while (iter.hasNext()) { +MemoryPoolMXBean item = (MemoryPoolMXBean) iter.next(); +%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
<%= item.getName() %>
Type<%= item.getType() %>
Usage<%= item.getUsage() %>
Peak Usage<%= item.getPeakUsage() %>
Collection Usage<%= item.getCollectionUsage() %>
+ + +<% +} +%> + +

Request information

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Requested URL:<%= HttpUtils.getRequestURL(request) %>
Request method:<%= request.getMethod() %>
Request URI:<%= request.getRequestURI() %>
Request protocol:<%= request.getProtocol() %>
Servlet path:<%= request.getServletPath() %>
Path info:<%= request.getPathInfo() %>
Path translated:<%= request.getPathTranslated() %>
Query string:<% if(request.getQueryString()!=null) out.write(request.getQueryString().replaceAll("<", "<").replaceAll(">",">")); %>
Content length:<%= request.getContentLength() %>
Content type:<%= request.getContentType() %>
Server name:<%= request.getServerName() %>
Server port:<%= request.getServerPort() %>
Remote user:<%= request.getRemoteUser() %>
Remote address:<%= request.getRemoteAddr() %>
Remote host:<%= request.getRemoteHost() %>
Authorization scheme:<%= request.getAuthType() %>
+ +<% + Enumeration e = request.getHeaderNames(); + if(e != null && e.hasMoreElements()) { +%> +

Request headers

+ + + + + + +<% + while(e.hasMoreElements()) { + String k = (String) e.nextElement(); +%> + + + + +<% + } +%> +
Header:Value:
<%= k %><%= request.getHeader(k) %>
+<% + } +%> + + +<% + e = request.getParameterNames(); + if(e != null && e.hasMoreElements()) { +%> +

Request parameters

+ + + + + + +<% + while(e.hasMoreElements()) { + String k = (String) e.nextElement(); + String val = request.getParameter(k); + String vals[] = request.getParameterValues(k); +%> + + + + + +<% + } +%> +
Parameter:Value:Multiple values:
<%= k.replaceAll("<", "<").replaceAll(">",">") %><%= val.replaceAll("<", "<").replaceAll(">",">") %><% + for(int i = 0; i < vals.length; i++) { + if(i > 0) + out.print("
"); + out.print(vals[i].replaceAll("<", "<").replaceAll(">",">")); + } + %>
+<% + } +%> + + +<% + e = request.getAttributeNames(); + if(e != null && e.hasMoreElements()) { +%> +

Request Attributes

+ + + + + +<% + while(e.hasMoreElements()) { + String k = (String) e.nextElement(); + Object val = request.getAttribute(k); +%> + + + + +<% + } +%> +
Attribute:Value:
<%= k.replaceAll("<", "<").replaceAll(">",">") %><%= val.toString().replaceAll("<", "<").replaceAll(">",">") %>
+<% + } +%> + + +<% + e = getServletConfig().getInitParameterNames(); + if(e != null && e.hasMoreElements()) { +%> +

Init parameters

+ + + + + +<% + while(e.hasMoreElements()) { + String k = (String) e.nextElement(); + String val = getServletConfig().getInitParameter(k); +%> + + + + +<% + } +%> +
Parameter:Value:
<%= k %><%= val %>
+<% + } +%> + + + +