From commits-return-44147-archive-asf-public=cust-asf.ponee.io@tomee.apache.org Sun Dec 2 01:13:03 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id C76DE18077A for ; Sun, 2 Dec 2018 01:13:00 +0100 (CET) Received: (qmail 2702 invoked by uid 500); 2 Dec 2018 00:12:54 -0000 Mailing-List: contact commits-help@tomee.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tomee.apache.org Delivered-To: mailing list commits@tomee.apache.org Received: (qmail 1924 invoked by uid 99); 2 Dec 2018 00:12:54 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Dec 2018 00:12:54 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id B26E63A2F08 for ; Sun, 2 Dec 2018 00:12:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1847931 [21/22] - in /tomee/site/trunk/content: latest/docs/admin/cluster/ latest/docs/admin/configuration/ latest/docs/advanced/applicationcomposer/ latest/docs/advanced/client/ latest/docs/advanced/jms/ latest/docs/advanced/setup/ latest... Date: Sun, 02 Dec 2018 00:12:51 -0000 To: commits@tomee.apache.org From: dblevins@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20181202001252.B26E63A2F08@svn01-us-west.apache.org> Added: tomee/site/trunk/content/tomee-8.0/docs/developer/testing/other/index.html URL: http://svn.apache.org/viewvc/tomee/site/trunk/content/tomee-8.0/docs/developer/testing/other/index.html?rev=1847931&view=auto ============================================================================== --- tomee/site/trunk/content/tomee-8.0/docs/developer/testing/other/index.html (added) +++ tomee/site/trunk/content/tomee-8.0/docs/developer/testing/other/index.html Sun Dec 2 00:12:50 2018 @@ -0,0 +1,347 @@ + + + + + + + + Apache TomEE + + + + + + + + + + + + + + + + + + + + + +
+ Preloader image +
+ + + +
+
+
+ +
+
+
+ +
+
+

EJBContainer

+
+

The EJBContainer API is a JavaEE API enriched by some OpenEJB features to make the testing easier.

+
+
+

It starts a container (embedded for case we are interested in) scanning the classpath. This operation can be +slow and if you go with this solution maybe think to start it only once for all tests.

+
+
+

Sample

+
+
+
import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.inject.Inject;
+import javax.naming.NamingException;
+
+import static org.junit.Assert.assertTrue;
+
+public class ATest {
+    @Inject
+    private MyCDIBean aBean;
+
+    @PersistenceContext
+    private EntityManager em;
+
+    @Resource
+    private DataSource ds;
+
+    @BeforeClass
+    public static void start() throws NamingException {
+        container = EJBContainer.createEJBContainer();
+    }
+
+    @AfterClass
+    public static void shutdown() {
+        if (container != null) {
+            container.close();
+        }
+    }
+
+    @Before
+    public void inject() throws NamingException {
+        container.getContext().bind("inject", this);
+    }
+
+    @After
+    public void reset() throws NamingException {
+        container.getContext().unbind("inject");
+    }
+
+    @Test
+    public void aTest() {
+        // ...
+    }
+}
+
+
+
+

It will use createEJBContainer() method to start the container and application, and close() to shutdown it.

+
+
+

OpenEJB provides the bind("inject") hack to be able to get injection in the test class.

+
+
+
+
+

OpenEJB JUnit

+
+

openejb-junit is another artifact providing some facilities for testing.

+
+
+

EJBContainer Rule

+
+
+
@Properties({
+    @Property(key = DeploymentFilterable.CLASSPATH_EXCLUDE, value = "jar:.*"),
+    @Property(key = DeploymentFilterable.CLASSPATH_INCLUDE, value = ".*openejb-junit.*")
+})
+public class TestEJBContainerDefaultConfig {
+    @Rule
+    public final EJBContainerRule containerRule = new EJBContainerRule(this);
+
+    @org.apache.openejb.junit.jee.resources.TestResource
+    private Context ctx;
+
+    @org.apache.openejb.junit.jee.resources.TestResource
+    private java.util.Properties props;
+
+    @org.apache.openejb.junit.jee.resources.TestResource
+    private EJBContainer container;
+
+
+    @Test
+    public void configIsHere() {
+        // ...
+    }
+}
+
+
+
+ + + + + +
+ + +there is the equivalent runner: @RunWith(EJBContainerRunner.class) +
+
+
+
+

InjectRule: injections for EJBContainerRule

+
+
+
@Properties({
+    @Property(key = DeploymentFilterable.CLASSPATH_EXCLUDE, value = "jar:.*"),
+    @Property(key = DeploymentFilterable.CLASSPATH_INCLUDE, value = ".*myjar.*")
+})
+public class TestEJBContainerRule {
+    @ClassRule
+    public static final EJBContainerRule CONTAINER_RULE = new EJBContainerRule();
+
+    @Rule
+    public final InjectRule injectRule = new InjectRule(this, CONTAINER_RULE);
+
+    @EJB
+    private BasicEjbLocal ejb;
+
+    @Test
+    public void aTest() {
+        // ...
+    }
+}
+
+
+
+ + + + + +
+ + +an alternative in openejb-core is to use org.apache.openejb.Injector.inject(instance) +
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + Propchange: tomee/site/trunk/content/tomee-8.0/docs/developer/testing/other/index.html ------------------------------------------------------------------------------ svn:eol-style = native Added: tomee/site/trunk/content/tomee-8.0/docs/developer/tools/gradle-plugins.html URL: http://svn.apache.org/viewvc/tomee/site/trunk/content/tomee-8.0/docs/developer/tools/gradle-plugins.html?rev=1847931&view=auto ============================================================================== --- tomee/site/trunk/content/tomee-8.0/docs/developer/tools/gradle-plugins.html (added) +++ tomee/site/trunk/content/tomee-8.0/docs/developer/tools/gradle-plugins.html Sun Dec 2 00:12:50 2018 @@ -0,0 +1,245 @@ + + + + + + + + Apache TomEE + + + + + + + + + + + + + + + + + + + + + +
+ Preloader image +
+ + + +
+
+
+ +
+
+
+ +
+
+
+
+

TomEE provides a gradle plugin for tomee-embedded "à la Jetty".

+
+
+
+
buildscript {
+   repositories {
+       mavenCentral()
+   }
+
+   dependencies {
+       classpath 'org.apache.tomee.gradle:tomee-embedded:7.0.0'
+   }
+}
+
+apply plugin: 'org.apache.tomee.tomee-embedded'
+
+// ...
+
+
+
+

Then just start tomee with:

+
+
+
+
gradle tomee-embedded -i
+
+
+
+
+
+

Configuration

+
+
+

All the configuration is optional.

+
+
+
+
// plugin setup
+def tomeeEmbedded = extensions.getByName('tomee-embedded')
+tomeeEmbedded.tomeeVersion = 'other version'
+tomeeEmbedded.skipDefaultRepository  = true // don't use central to retrieve tomee
+
+// container dependencies
+def tomeeEmbeddedDeps = configurations.getByName('tomee-embedded')
+// add dependencies you need to this configuration
+
+
+
+

tomee-embedded task has several more advanced configuration like tomee properties, modules to deploy etc…​ +Its configuration is pretty close to Embedded Maven Plugin.

+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + Propchange: tomee/site/trunk/content/tomee-8.0/docs/developer/tools/gradle-plugins.html ------------------------------------------------------------------------------ svn:eol-style = native Added: tomee/site/trunk/content/tomee-8.0/docs/developer/tools/index.html URL: http://svn.apache.org/viewvc/tomee/site/trunk/content/tomee-8.0/docs/developer/tools/index.html?rev=1847931&view=auto ============================================================================== --- tomee/site/trunk/content/tomee-8.0/docs/developer/tools/index.html (added) +++ tomee/site/trunk/content/tomee-8.0/docs/developer/tools/index.html Sun Dec 2 00:12:50 2018 @@ -0,0 +1,199 @@ + + + + + + + + Apache TomEE + + + + + + + + + + + + + + + + + + + + + +
+ Preloader image +
+ + + +
+
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + Propchange: tomee/site/trunk/content/tomee-8.0/docs/developer/tools/index.html ------------------------------------------------------------------------------ svn:eol-style = native Added: tomee/site/trunk/content/tomee-8.0/docs/developer/tools/maven-plugins.html URL: http://svn.apache.org/viewvc/tomee/site/trunk/content/tomee-8.0/docs/developer/tools/maven-plugins.html?rev=1847931&view=auto ============================================================================== --- tomee/site/trunk/content/tomee-8.0/docs/developer/tools/maven-plugins.html (added) +++ tomee/site/trunk/content/tomee-8.0/docs/developer/tools/maven-plugins.html Sun Dec 2 00:12:50 2018 @@ -0,0 +1,208 @@ + + + + + + + + Apache TomEE + + + + + + + + + + + + + + + + + + + + + +
+ Preloader image +
+ + + +
+
+
+ +
+
+
+ +
+
+

TomEE provides several maven plugins:

+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + Propchange: tomee/site/trunk/content/tomee-8.0/docs/developer/tools/maven-plugins.html ------------------------------------------------------------------------------ svn:eol-style = native Added: tomee/site/trunk/content/tomee-8.0/docs/developer/tools/maven/applicationcomposer.html URL: http://svn.apache.org/viewvc/tomee/site/trunk/content/tomee-8.0/docs/developer/tools/maven/applicationcomposer.html?rev=1847931&view=auto ============================================================================== --- tomee/site/trunk/content/tomee-8.0/docs/developer/tools/maven/applicationcomposer.html (added) +++ tomee/site/trunk/content/tomee-8.0/docs/developer/tools/maven/applicationcomposer.html Sun Dec 2 00:12:50 2018 @@ -0,0 +1,317 @@ + + + + + + + + Apache TomEE + + + + + + + + + + + + + + + + + + + + + +
+ Preloader image +
+ + + +
+
+
+ +
+
+
+ +
+
+
+
+

This plugin has two goal:

+
+
+
    +
  • +

    applicationcomposer:run: to start the application from mvn command line

    +
  • +
  • +

    applicationcomposer:zip: to package a zip with dependencies and start scripts

    +
  • +
+
+
+ + + + + +
+ + +the dependencies are retrieved with MavenProject.getArtifacts() which means you artifacts should be a war +- maven doesn’t populate it with a jar - and the compile phase - at least - should be passed to ensure it is populated. +
+
+
+
+
+

Run goal configuration

+
+
+
mvn process-classes applicationcomposer:run -DskipTests
+
+
+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDefaultDescription

args

-

a list of application arguments

application

-

application qualified name

binaries

${project.build.outputDirectory}

where is your module code (target/classes)

mavenLog

true

force to use maven logging in openejb

+
+
+

Zip goal configuration

+
+
+
mvn process-classes applicationcomposer:zip -DskipTests
+
+
+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDefaultDescription

workDir

${project.build.directory}/${project.build.finalName}-applicationcomposer

where the container can "work" and create temp files

zip

${project.build.directory}/${project.build.finalName}-applicationcomposer.zip

where to create the zip

attach

true

attach the created artifact

classifier

-

artifact classifier if needed

application

-

application qualified name

binaries

${project.build.outputDirectory}

where is your module code (target/classes)

+
+
+ +
+
+ + + + + + + + + + + + + + + + + Propchange: tomee/site/trunk/content/tomee-8.0/docs/developer/tools/maven/applicationcomposer.html ------------------------------------------------------------------------------ svn:eol-style = native Added: tomee/site/trunk/content/tomee-8.0/docs/developer/tools/maven/embedded.html URL: http://svn.apache.org/viewvc/tomee/site/trunk/content/tomee-8.0/docs/developer/tools/maven/embedded.html?rev=1847931&view=auto ============================================================================== --- tomee/site/trunk/content/tomee-8.0/docs/developer/tools/maven/embedded.html (added) +++ tomee/site/trunk/content/tomee-8.0/docs/developer/tools/maven/embedded.html Sun Dec 2 00:12:50 2018 @@ -0,0 +1,410 @@ + + + + + + + + Apache TomEE + + + + + + + + + + + + + + + + + + + + + +
+ Preloader image +
+ + + +
+
+
+ +
+
+
+ +
+
+
+
+

TomEE Embedded Maven plugin has a single goal: tomee-embedded:run.

+
+
+
+
+

Configuration

+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDefaultDescription

warFile

${project.build.directory}/${project.build.finalName}

where is the binary

httpPort

8080

HTTP port

httpsPort

8443

HTTPS port

ajpPort

8009

AJP port

stopPort

8005

shutdown port

host

localhost

the server host

dir

${project.build.directory}/apache-tomee-embedded

the work directory

keystoreFile

-

the keystore file for the HTTPS connector

keystorePass

-

the keystore password for the HTTPS connector

keystoreType

JKS

the keystore type for the HTTPS connector

clientAuth

-

should HTTPS use client authentication

keyAlias

-

the key to use for HTTPS

sslProtocol

-

the protocol to use for SSL/HTTPS

serverXml

-

a custom server.xml

ssl

false

is HTTPS active

withEjbRemote

false

is EJBd active

quickSession

true

is sessions using Random instead of SecureRandom to generate id (faster but less secure, good for dev purposes)

skipHttp

false

don’t activate HTTP connector (allow to have only HTTPS for instance)

classpathAsWar

false

deploy the classpath instead of the binary/war

useProjectClasspath

true

in previous case use the project classpath and not plugin one

webResourceCached

true

should web resources be cached

modules

${project.build.outputDirectory}

list of module to add to the classpath of the application

docBase

${project.basedir}/src/main/webapp

where is the docBase in classpath deployment mode (where are web resources)

context

-

which context to use for the main artifact/deployment

containerProperties

-

map of container properties

mavenLog

true

should the plugin use maven logger instead of JUL

keepServerXmlAsThis

false

don’t apply port/host configuration to the server.xml if provided

users

-

map of user/password

roles

-

map of role/users

forceJspDevelopment

true

ensure JSP are in development mode (updated)

applications

-

list of applications to deploy

applicationScopes

-

scope of the artifact to take into account for the classpath (ignore PROVIDED for instance)

skipCurrentProject

-

don’t deploy current project but only configured applications

applicationCopyFolder

-

a folder containing applications

workDir

-

tomee embedded work dir

inlinedServerXml

-

server.xml content directly in the pom

inlinedTomEEXml

-

tomee.xml content directly in the pom

liveReload

-

livereload configuration if activated. This is an object containing these options: {watchedFolder: 'src/main/webapp', path: '/', port: 35729}

withLiveReload

false

activate livereload for web resources

+
+
+ +
+
+ + + + + + + + + + + + + + + + + Propchange: tomee/site/trunk/content/tomee-8.0/docs/developer/tools/maven/embedded.html ------------------------------------------------------------------------------ svn:eol-style = native