You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@tomee.apache.org by bu...@apache.org on 2015/04/10 11:23:29 UTC
svn commit: r947008 - in /websites/staging/tomee/trunk: cgi-bin/ content/
content/application-composer/advanced.html
content/application-composer/getting-started.html
Author: buildbot
Date: Fri Apr 10 09:23:29 2015
New Revision: 947008
Log:
Staging update by buildbot for tomee
Modified:
websites/staging/tomee/trunk/cgi-bin/ (props changed)
websites/staging/tomee/trunk/content/ (props changed)
websites/staging/tomee/trunk/content/application-composer/advanced.html
websites/staging/tomee/trunk/content/application-composer/getting-started.html
Propchange: websites/staging/tomee/trunk/cgi-bin/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Fri Apr 10 09:23:29 2015
@@ -1 +1 @@
-1672588
+1672594
Propchange: websites/staging/tomee/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Fri Apr 10 09:23:29 2015
@@ -1 +1 @@
-1672588
+1672594
Modified: websites/staging/tomee/trunk/content/application-composer/advanced.html
==============================================================================
--- websites/staging/tomee/trunk/content/application-composer/advanced.html (original)
+++ websites/staging/tomee/trunk/content/application-composer/advanced.html Fri Apr 10 09:23:29 2015
@@ -152,12 +152,12 @@
<p>You can reuse existing file descriptors using <code>@Descriptors</code>. The name is the file name
and the path either a classpath path or a file path:</p>
-<p><code>`java
-// runner if needed etc...
+<pre><code>// runner if needed etc...
@Descriptors(@Descriptor(name = "persistence.xml", path = "META-INF/persistence.xml"))
public class MyTest {
- //...</div>
-</code>ÌÌ</p>
+ //...
+}
+</code></pre>
<p>Note: this can be put in a <code>@Module</code> method as well.</p>
@@ -167,12 +167,12 @@ public class MyTest {
<p>To do so just add the needed dependency and use <code>@EnableServices</code>:</p>
-<p><code>`java
-// runner if needed etc...
+<pre><code>// runner if needed etc...
@EnableService("jaxrs") // jaxws supported as well
public class MyTest {
- //...</div>
-</code>ÌÌ</p>
+ //...
+}
+</code></pre>
<h2>Random port</h2>
@@ -182,12 +182,12 @@ to be able to deploy multiple tests/proj
<p>To shortcut all the needed logic you can use <code>@RandomPort</code>. It is simply an injection giving
you either the port (<code>int</code>) or the root context (<code>URL</code>):</p>
-<p><code>`java
-// runner, services if needed etc...
+<pre><code>// runner, services if needed etc...
public class MyTest {
@RandomPort("http")
- private int port;</div>
-</code>ÌÌ</p>
+ private int port;
+}
+</code></pre>
<p>Note: you can generate this way multiple ports. The value is the name of the service it will apply on (being said http
is an alias for httpejbd which is our embedded http layer).</p>
@@ -204,13 +204,13 @@ is an alias for httpejbd which is our em
<p><code>@Jars</code> allows you to add dependencies (scanned) to your application automatically (like CDI libraries):</p>
-<p><code>``java
-@Module
+<pre><code>@Module
@Classes(cdi = true, value = { C1.class, C2.class, E1.class })
@Jars("deltaspike-")
public WebApp app() {
- return new WebApp();</div>
-</code>Ì`</p>
+ return new WebApp();
+}
+</code></pre>
<h2>@Default</h2>
Modified: websites/staging/tomee/trunk/content/application-composer/getting-started.html
==============================================================================
--- websites/staging/tomee/trunk/content/application-composer/getting-started.html (original)
+++ websites/staging/tomee/trunk/content/application-composer/getting-started.html Fri Apr 10 09:23:29 2015
@@ -154,32 +154,30 @@
<p>The minimum required one is <code>openejb-core</code>:</p>
-<p><code>xml
-<dependency>
+<pre><code><dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-core</artifactId>
<version>${openejb.version></version>
</dependency>
-</code></p>
+</code></pre>
<p>If you need JAXRS services you'll add (or replace thanks to transitivity of maven) <code>openejb-cxf-rs</code>:</p>
-<p><code>xml
-<dependency>
+<pre><code><dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-cxf-rs</artifactId>
<version>${openejb.version></version>
</dependency>
-</code>
-If you need JAXWS services you'll add (or replace thanks to transitivity of maven) <code>openejb-cxf</code>:</p>
+</code></pre>
+
+<p>If you need JAXWS services you'll add (or replace thanks to transitivity of maven) <code>openejb-cxf</code>:</p>
-<p><code>xml
-<dependency>
+<pre><code><dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-cxf</artifactId>
<version>${openejb.version></version>
</dependency>
-</code></p>
+</code></pre>
<p>etc...</p>
@@ -193,14 +191,13 @@ If you need JAXWS services you'll add (o
<ul>
<li>before TomEE 2.x: you can only write method(s) decorated with <code>@Module</code></li>
-<li>since TomEE 2.x: you can skip it and use <code>@Classes</code> directly on the ApplicationComposer class as a shortcut for:</li>
-</ul>
+<li>since TomEE 2.x: you can skip it and use <code>@Classes</code> directly on the ApplicationComposer class as a shortcut for:</p>
-<p><code>java
-@Module
+<p>@Module
public WebApp app() {
- return new WebApp();</div>
-</code></p>
+ return new WebApp();
+}</li>
+</ul>
<p>The expected returned type of these methods are in <code>org.apache.openejb.jee</code> package:</p>
@@ -219,12 +216,12 @@ public WebApp app() {
<p>Note that for easiness <code>@Classes</code> was added to be able to describe a module and some scanned classes. For instance the
following snippet will create a web application with classes C1, C2 as CDI beans and E1 as an EJB automatically:</p>
-<p><code>``java
-@Module
+<pre><code>@Module
@Classes(cdi = true, value = { C1.class, C2.class, E1.class })
public WebApp app() {
- return new WebApp();</div>
-</code>Ì`</p>
+ return new WebApp();
+}
+</code></pre>
<h3>@Configuration</h3>
@@ -238,24 +235,25 @@ to write properties.</p>
<p>Here is a sample:</p>
-<p><code>``java
-@Configuration
+<pre><code>@Configuration
public Properties configuration() {
return new PropertiesBuilder()
.p("db", "new://Resource?type=DataSource")
.p("db.JdbcUrld", "jdbc:hsqldb:mem:test")
- .build();</div>
-</code>Ì`</p>
+ .build();
+}
+</code></pre>
<p>Since TomEE 2.x you can also put properties on ApplicationComposer class using <code>@ContainerProperties</code> API:</p>
-<p><code>``java
-@ContainerProperties({
+<pre><code>@ContainerProperties({
@ContainerProperties.Property(name = "db", value = "new://Resource?type=DataSource"),
- @ContainerProperties.Property(name = "db.JdbcUrl", value = "jdbc:hsqldb:mem:test")</div>)
+ @ContainerProperties.Property(name = "db.JdbcUrl", value = "jdbc:hsqldb:mem:test")
+})
public class MyAppComposer() {
- // ...</div>
-</code>Ì`</p>
+ // ...
+}
+</code></pre>
<h3>@Component</h3>
@@ -267,11 +265,11 @@ to mock a little bit authorization if yo
<p>Components in TomEE are stored in a container Map and the key needs to be a <code>Class</code>. This one is deduced from the returned
type of the <code>@Component</code> method:</p>
-<p><code>``java
-@Component
+<pre><code>@Component
public SecurityService mockSecurity() {
- return new MySecurityService();</div>
-</code>Ì`</p>
+ return new MySecurityService();
+}
+</code></pre>
<h2>How to run it?</h2>
@@ -280,24 +278,19 @@ public SecurityService mockSecurity() {
<p>If you use JUnit you have mainly 2 solutions to run you "model" using the ApplicationComposer:</p>
<ul>
-<li>using <code>ApplicationComposer</code> runner:</li>
-</ul>
+<li>using <code>ApplicationComposer</code> runner:</p>
-<p><code>``java
-@RunWith(ApplicationComposer.class)
+<p>@RunWith(ApplicationComposer.class)
public class MyTest {
- // ...</div>
-</code>Ì`</p>
-
-<ul>
-<li>using <code>ApplicationComposerRule</code> rule:</li>
-</ul>
+ // ...
+}</li>
+<li>using <code>ApplicationComposerRule</code> rule:</p>
-<p><code>``java
-public class MyTest {
+<p>public class MyTest {
@Rule // or @ClassRule if you want the container/application lifecycle be bound to the class and not test methods
- public final ApplicationComposerRule rule = new ApplicationComposerRule(this);</div>
-</code>Ì`</p>
+ public final ApplicationComposerRule rule = new ApplicationComposerRule(this);
+}</li>
+</ul>
<p>Tip: since TomEE 2.x ApplicationComposerRule is decomposed in 2 rules if you need: <code>ContainerRule</code> and <code>DeployApplication</code>.
Using JUnit <code>RuleChain</code> you can chain them to get the samebehavior as <code>ApplicationComposerRule</code> or better deploy
@@ -317,42 +310,38 @@ as a listener to get ApplicationComposer
<p>Since TomEE 2.x you can also use <code>ApplicationComposers</code> to directly run you ApplicationComposer model
as a standalone application:</p>
-<p>```java
-public class MyApp {
+<pre><code>public class MyApp {
public static void main(String[] args) {
ApplicationComposers.run(MyApp.class, args);
- }</p>
+ }
-<pre><code>// @Module, @Configuration etc...</div>
+ // @Module, @Configuration etc...
+}
</code></pre>
-<p>`ÌÌ</p>
-
<p>Tip: if <code>MyApp</code> has <code>@PostConstruct</code> methods they will be respected and if <code>MyApp</code> has a constructor taking an array
of String it will be instantiated getting the second parameter as argument (ie you can propagate your main parameter
to your model to modify your application depending it!)</p>
<h2>JUnit Sample</h2>
-<p>```java
-@Classes(cdi = true, value = { MyService.class, MyOtherService.class })
+<pre><code>@Classes(cdi = true, value = { MyService.class, MyOtherService.class })
@ContainerProperties(@ContainerProperties.Property(name = "myDb", value = "new://Resource?type=DataSource"))
@RunWith(ApplicationComposer.class)
public class MyTest {
@Resource(name = "myDb")
- private DataSource ds;</p>
+ private DataSource ds;
-<pre><code>@Inject
-private MyService service;
+ @Inject
+ private MyService service;
-@Test
-public void myTest() {
- // do test using injections
-</div>}
+ @Test
+ public void myTest() {
+ // do test using injections
+ }
+}
</code></pre>
-<p>`ÌÌ</p>
-