You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2018/12/21 16:18:42 UTC
[1/5] tomee git commit: Adding Microprofile Fault Tollerance fallback
example
Repository: tomee
Updated Branches:
refs/heads/master 32463a387 -> 2b2cca1f1
Adding Microprofile Fault Tollerance fallback example
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/64c4743f
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/64c4743f
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/64c4743f
Branch: refs/heads/master
Commit: 64c4743f4734743ba15d508b34b1edd8075f98ff
Parents: 9f8a299
Author: Weverthon Medeiros <we...@gmail.com>
Authored: Fri Dec 21 13:49:54 2018 +0000
Committer: Weverthon Medeiros <we...@gmail.com>
Committed: Fri Dec 21 13:49:54 2018 +0000
----------------------------------------------------------------------
examples/mp-faulttolerance-fallback/README.adoc | 125 +++++++++++++++++++
examples/mp-faulttolerance-fallback/pom.xml | 93 ++++++++++++++
.../rest/WeatherDayStatusFallbackHandler.java | 34 +++++
.../org/superbiz/rest/WeatherException.java | 20 +++
.../java/org/superbiz/rest/WeatherService.java | 62 +++++++++
.../org/superbiz/rest/WeatherServiceTest.java | 74 +++++++++++
.../src/test/resources/arquillian.xml | 30 +++++
.../src/test/resources/beans.xml | 7 ++
examples/pom.xml | 1 +
9 files changed, 446 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/64c4743f/examples/mp-faulttolerance-fallback/README.adoc
----------------------------------------------------------------------
diff --git a/examples/mp-faulttolerance-fallback/README.adoc b/examples/mp-faulttolerance-fallback/README.adoc
new file mode 100644
index 0000000..deba96b
--- /dev/null
+++ b/examples/mp-faulttolerance-fallback/README.adoc
@@ -0,0 +1,125 @@
+index-group=Unrevised
+type=page
+status=published
+~~~~~~
+# Microprofile Fault Tolerance - Fallback
+This is an example of how to use Microprofile @Fallback in TomEE.
+
+#### Fallback Feature
+Fault Tolerance Fallback provides an alternative execution in case of failure. This alternative will be called when
+`Retry` or `CircuitBreaker` has failed.
+
+To use this feature you need to annotate the method with @Fallback.
+
+The Fallback policy allows to configure :
+
+* **value**: A class which implements `FallbackHandler`
+* **fallbackMethod**: a method which will be executed.
+
+The parameters **value** and **fallbackMethod** cannot be specified at the same time.
+
+Check the [specification](http://download.eclipse.org/microprofile/microprofile-fault-tolerance-1.1/microprofile-fault-tolerance-spec.html) for more details.
+
+### Examples
+
+##### Run the application
+
+ mvn clean install tomee:run
+
+##### Example 1
+
+The method `statusOfDay` will always fail throwing a `WeatherException` and as the
+`@CircuitBreaker` annotation is configured to `failOn` in case of that exception, the fallback,
+`WeatherDayStatusFallbackHandler#handle` will be invoked.
+
+```java
+@RequestScoped
+public class WeatherService {
+ ...
+ @GET
+ @Path("/day/status")
+ @CircuitBreaker(failOn = WeatherException.class)
+ @Fallback(WeatherDayStatusFallbackHandler.class)
+ public String dayStatus() {
+ throw new WeatherException();
+ }
+ ...
+ }
+
+public class WeatherDayStatusFallbackHandler implements FallbackHandler<String> {
+
+ @Override
+ public String handle(ExecutionContext executionContext) {
+ return "Hi, today is a sunny day!";
+ }
+}
+```
+
+Day status call
+
+ GET http://localhost:8080/mp-faulttolerance-fallback/weather/day/status
+
+Server log
+```
+SEVERE [http-nio-8080-exec-2] org.superbiz.rest.WeatherDayStatusFallbackHandler.handle WeatherDayStatusFallbackHandler was triggered due a fail
+```
+
+Response
+```
+Hi, today is a sunny day!
+```
+
+##### Example 2
+
+The method `statusOfDay` will always fail throwing a `WeatherException` and as the
+`@Retry` annotation is configured to `maxRetries = 1` in case of fail, the fallback method,
+`fallbackForWeekStatus` will be invoked after retrying once.
+
+```java
+@RequestScoped
+public class WeatherService {
+ ...
+ @GET
+ @Path("/week/status")
+ @Retry(maxRetries = 1)
+ @Fallback(fallbackMethod = "fallbackForWeekStatus")
+ public String weekStatus() {
+ throw new WeatherException();
+ }
+
+ public String fallbackForWeekStatus() {
+ return "Hi, week will be mostly sunny!";
+ }
+ ...
+}
+```
+
+Week status call
+
+ GET http://localhost:8080/mp-faulttolerance-fallback/weather/week/status
+
+Server log
+
+```
+SEVERE [http-nio-8080-exec-2] org.superbiz.rest.WeatherService.fallbackForWeekStatus Fallback was triggered due a fail
+
+```
+
+Response
+```
+Hi, week will be mostly sunny!
+```
+
+
+##### Run the tests
+
+You can also try it out using the [WeatherServiceTest.java](src/test/java/org/superbiz/rest/WeatherServiceTest.java) available in the project.
+
+ mvn clean test
+
+```
+[INFO] Results:
+[INFO]
+[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+```
+
http://git-wip-us.apache.org/repos/asf/tomee/blob/64c4743f/examples/mp-faulttolerance-fallback/pom.xml
----------------------------------------------------------------------
diff --git a/examples/mp-faulttolerance-fallback/pom.xml b/examples/mp-faulttolerance-fallback/pom.xml
new file mode 100644
index 0000000..40e771c
--- /dev/null
+++ b/examples/mp-faulttolerance-fallback/pom.xml
@@ -0,0 +1,93 @@
+<?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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.superbiz</groupId>
+ <artifactId>mp-faulttolerance-fallback</artifactId>
+ <version>8.0.0-SNAPSHOT</version>
+ <packaging>war</packaging>
+ <name>OpenEJB :: Examples :: Microprofile Fault Tolerance :: Fallback</name>
+
+ <properties>
+ <microprofile-fault-tolerance-api.version>1.0</microprofile-fault-tolerance-api.version>
+ <arquillian-junit-container.version>1.4.0.Final</arquillian-junit-container.version>
+ <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
+ <maven-war-plugin.version>3.1.0</maven-war-plugin.version>
+ <tomee.version>${project.version}</tomee.version>
+ <javaee-api.version>8.0</javaee-api.version>
+ <junit.version>4.12</junit.version>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>${javaee-api.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.microprofile.fault-tolerance</groupId>
+ <artifactId>microprofile-fault-tolerance-api</artifactId>
+ <version>${microprofile-fault-tolerance-api.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>openejb-cxf-rs</artifactId>
+ <version>${tomee.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <version>${arquillian-junit-container.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>arquillian-tomee-remote</artifactId>
+ <version>${tomee.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomee</groupId>
+ <artifactId>apache-tomee</artifactId>
+ <version>${tomee.version}</version>
+ <type>zip</type>
+ <classifier>microprofile</classifier>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tomee.maven</groupId>
+ <artifactId>tomee-maven-plugin</artifactId>
+ <version>${project.version}</version>
+ <configuration>
+ <tomeeClassifier>microprofile</tomeeClassifier>
+ <context>${artifactId}</context>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>${maven-war-plugin.version}</version>
+ <configuration>
+ <failOnMissingWebXml>false</failOnMissingWebXml>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/tomee/blob/64c4743f/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherDayStatusFallbackHandler.java
----------------------------------------------------------------------
diff --git a/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherDayStatusFallbackHandler.java b/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherDayStatusFallbackHandler.java
new file mode 100644
index 0000000..8d9101b
--- /dev/null
+++ b/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherDayStatusFallbackHandler.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.superbiz.rest;
+
+import org.eclipse.microprofile.faulttolerance.ExecutionContext;
+import org.eclipse.microprofile.faulttolerance.FallbackHandler;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class WeatherDayStatusFallbackHandler implements FallbackHandler<String> {
+
+ private static Logger logger = Logger.getLogger(WeatherDayStatusFallbackHandler.class.getName());
+
+ @Override
+ public String handle(ExecutionContext executionContext) {
+ logger.log(Level.SEVERE, "Fallback was triggered due a fail");
+ return "Hi, today is a sunny day!";
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/64c4743f/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherException.java
----------------------------------------------------------------------
diff --git a/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherException.java b/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherException.java
new file mode 100644
index 0000000..1133d74
--- /dev/null
+++ b/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherException.java
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.superbiz.rest;
+
+public class WeatherException extends RuntimeException {
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/64c4743f/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherService.java
----------------------------------------------------------------------
diff --git a/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherService.java b/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherService.java
new file mode 100644
index 0000000..145b02e
--- /dev/null
+++ b/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherService.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.superbiz.rest;
+
+import org.eclipse.microprofile.faulttolerance.CircuitBreaker;
+import org.eclipse.microprofile.faulttolerance.Fallback;
+import org.eclipse.microprofile.faulttolerance.Retry;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+
+@Path("/weather")
+@Produces(MediaType.TEXT_PLAIN)
+@RequestScoped
+public class WeatherService {
+
+ private static Logger logger = Logger.getLogger(WeatherService.class.getName());
+
+ @GET
+ @Path("/day/status")
+ @CircuitBreaker(failOn = WeatherException.class)
+ @Fallback(WeatherDayStatusFallbackHandler.class)
+ public String dayStatus() {
+ throw new WeatherException();
+ }
+
+ @GET
+ @Path("/week/status")
+ @Retry(maxRetries = 1)
+ @Fallback(fallbackMethod = "fallbackForWeekStatus")
+ public String weekStatus() {
+ throw new WeatherException();
+ }
+
+ public String fallbackForWeekStatus() {
+ logger.log(Level.SEVERE, "Fallback was triggered due a fail");
+ return "Hi, week will be mostly sunny!";
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/64c4743f/examples/mp-faulttolerance-fallback/src/test/java/org/superbiz/rest/WeatherServiceTest.java
----------------------------------------------------------------------
diff --git a/examples/mp-faulttolerance-fallback/src/test/java/org/superbiz/rest/WeatherServiceTest.java b/examples/mp-faulttolerance-fallback/src/test/java/org/superbiz/rest/WeatherServiceTest.java
new file mode 100644
index 0000000..0f511af
--- /dev/null
+++ b/examples/mp-faulttolerance-fallback/src/test/java/org/superbiz/rest/WeatherServiceTest.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.superbiz.rest;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.Response;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.junit.InSequence;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+
+@RunWith(Arquillian.class)
+public class WeatherServiceTest {
+
+ @ArquillianResource
+ private URL base;
+
+ private Client client;
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ return ShrinkWrap.create(WebArchive.class, "test.war").addPackage(WeatherService.class.getPackage());
+ }
+
+ @Before
+ public void before() {
+ this.client = ClientBuilder.newClient();
+ }
+
+ @Test
+ public void testStatusOfDay() {
+ WebTarget webTarget = this.client.target(this.base.toExternalForm());
+ Response response = webTarget.path("/weather/day/status").request().get();
+ assertEquals("Hi, today is a sunny day!", response.readEntity(String.class));
+ }
+
+ @Test
+ public void testStatusOfWeek() {
+ WebTarget webTarget = this.client.target(this.base.toExternalForm());
+ Response response = webTarget.path("/weather/week/status").request().get();
+ assertEquals("Hi, week will be mostly sunny!", response.readEntity(String.class));
+ }
+
+ @After
+ public void after() {
+ this.client.close();
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/64c4743f/examples/mp-faulttolerance-fallback/src/test/resources/arquillian.xml
----------------------------------------------------------------------
diff --git a/examples/mp-faulttolerance-fallback/src/test/resources/arquillian.xml b/examples/mp-faulttolerance-fallback/src/test/resources/arquillian.xml
new file mode 100644
index 0000000..3029d48
--- /dev/null
+++ b/examples/mp-faulttolerance-fallback/src/test/resources/arquillian.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <container qualifier="tomee" default="true">
+ <configuration>
+ <property name="httpPort">-1</property>
+ <property name="stopPort">-1</property>
+ <property name="classifier">microprofile</property>
+ <property name="dir">target/apache-tomee-remote</property>
+ <property name="appWorkingDir">target/arquillian-test-working-dir</property>
+ </configuration>
+ </container>
+</arquillian>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/64c4743f/examples/mp-faulttolerance-fallback/src/test/resources/beans.xml
----------------------------------------------------------------------
diff --git a/examples/mp-faulttolerance-fallback/src/test/resources/beans.xml b/examples/mp-faulttolerance-fallback/src/test/resources/beans.xml
new file mode 100644
index 0000000..d942d7a
--- /dev/null
+++ b/examples/mp-faulttolerance-fallback/src/test/resources/beans.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/64c4743f/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 8cdcf19..74a6a25 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -100,6 +100,7 @@
<module>movies-complete-meta</module>
<module>movies-complete</module>
<module>mp-config-example</module>
+ <module>mp-faulttolerance-fallback</module>
<module>mp-faulttolerance-retry</module>
<module>mp-metrics-counted</module>
<module>mp-metrics-histogram</module>
[2/5] tomee git commit: Merge remote-tracking branch
'upstream/master' into tomee-2323
Posted by jg...@apache.org.
Merge remote-tracking branch 'upstream/master' into tomee-2323
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/2057761c
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/2057761c
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/2057761c
Branch: refs/heads/master
Commit: 2057761c17e27b5eb7c15c3bcfc642e243609e56
Parents: 64c4743 c64d352
Author: Weverthon Medeiros <we...@gmail.com>
Authored: Fri Dec 21 13:51:03 2018 +0000
Committer: Weverthon Medeiros <we...@gmail.com>
Committed: Fri Dec 21 13:51:03 2018 +0000
----------------------------------------------------------------------
.../arquillian/tests/filter/AllFilterTest.java | 1 -
.../tests/realm/CdiLazyRealmTOMEE1490Test.java | 4 +-
arquillian/arquillian-tomee-tests/pom.xml | 39 ++
.../resource/AutoConnectionTrackerTest.java | 43 +-
docs/app-clients-and-jndi.adoc | 4 +-
docs/application-composer/getting-started.adoc | 2 +-
...application-discovery-via-the-classpath.adoc | 2 +-
docs/application-resources.adoc | 4 +-
docs/basics---getting-things.adoc | 2 +-
docs/basics---transactions.adoc | 2 +-
docs/configuration.adoc | 2 +-
docs/configuring-datasources.adoc | 4 +-
docs/constructor-injection.adoc | 2 +-
docs/datasource-config.adoc | 2 +-
docs/developer/json/index.adoc | 4 +-
.../testing/applicationcomposer/index.adoc | 26 +-
docs/developer/testing/arquillian/index.adoc | 2 +-
docs/documentation.adoc | 2 +-
docs/documentation.old.adoc | 2 +-
docs/ejb-local-ref.adoc | 2 +-
docs/ejb-ref.adoc | 2 +-
docs/ejb-refs.adoc | 4 +-
docs/embedded-and-remotable.adoc | 12 +-
docs/embedding.adoc | 2 +-
docs/faq.adoc | 2 +-
docs/generating-ejb-3-annotations.adoc | 4 +-
docs/getting-started.adoc | 2 +-
docs/hello-world.adoc | 2 +-
docs/installation.adoc | 2 +-
docs/jndi-names.adoc | 4 +-
docs/jpa-concepts.adoc | 4 +-
docs/local-client-injection.adoc | 20 +-
docs/local-server.adoc | 2 +-
docs/lookup-of-other-ejbs-example.adoc | 8 +-
docs/manual-installation.adoc | 2 +-
docs/new-in-openejb-3.0.adoc | 6 +-
docs/persistence-context.adoc | 2 +-
docs/persistence-unit-ref.adoc | 6 +-
docs/property-overriding.adoc | 2 +-
docs/remote-server.adoc | 2 +-
docs/resource-injection.adoc | 6 +-
docs/resource-ref-for-datasource.adoc | 2 +-
docs/securing-a-web-service.adoc | 2 +-
docs/security-annotations.adoc | 8 +-
docs/singleton-beans.adoc | 44 +-
docs/spring-and-openejb-3.0.adoc | 4 +-
docs/spring-ejb-and-jpa.adoc | 10 +-
docs/system-properties-files.adoc | 2 +-
docs/telnet-console.adoc | 2 +-
docs/tomcat-object-factory.adoc | 2 +-
docs/tomee-and-security.adoc | 2 +-
docs/transaction-annotations.adoc | 6 +-
docs/validation-tool.adoc | 2 +-
examples/moviefun-rest/README.md | 404 +++++++++++++++++++
examples/mvc-cxf/README.adoc | 24 ++
examples/mvc-cxf/README.md | 23 --
examples/mvc-resteasy/README.adoc | 23 ++
examples/mvc-resteasy/pom.xml | 143 +++++++
.../java/org/superbiz/mvc/MVCApplication.java | 22 +
.../java/org/superbiz/mvc/TomeeController.java | 38 ++
.../src/main/resources/META-INF/beans.xml | 23 ++
.../src/main/webapp/WEB-INF/views/hello.jsp | 28 ++
.../src/main/webapp/WEB-INF/web.xml | 28 ++
examples/mvc-resteasy/src/main/webapp/index.jsp | 28 ++
.../src/test/java/org/superbiz/mvc/MVCTest.java | 74 ++++
.../src/test/resources/arquillian.xml | 31 ++
examples/pom.xml | 1 +
owasp-dc-suppression.xml | 80 ++++
pom.xml | 61 ++-
.../apache/openejb/server/rest/RESTService.java | 7 +-
.../apache-tomee/src/main/resources/service.bat | 2 +-
tomee/tomee-plume-webapp/pom.xml | 3 +-
tomee/tomee-plus-webapp/pom.xml | 3 +-
73 files changed, 1214 insertions(+), 165 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/2057761c/examples/pom.xml
----------------------------------------------------------------------
[4/5] tomee git commit: Merge branch 'master' into tomee-2323
Posted by jg...@apache.org.
Merge branch 'master' into tomee-2323
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/a5f2192c
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/a5f2192c
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/a5f2192c
Branch: refs/heads/master
Commit: a5f2192cfe3c4abe9621670784589e5957fd91f1
Parents: f97f74e 32463a3
Author: Weverthon Medeiros <we...@gmail.com>
Authored: Fri Dec 21 15:11:30 2018 +0000
Committer: Weverthon Medeiros <we...@gmail.com>
Committed: Fri Dec 21 15:11:30 2018 +0000
----------------------------------------------------------------------
examples/mp-custom-healthcheck/README.adoc | 146 +++++++++++++++++++
examples/mp-custom-healthcheck/pom.xml | 94 ++++++++++++
.../java/org/superbiz/WeatherApiStatus.java | 52 +++++++
.../main/java/org/superbiz/WeatherEndpoint.java | 45 ++++++
.../java/org/superbiz/WeatherException.java | 27 ++++
.../main/java/org/superbiz/WeatherGateway.java | 63 ++++++++
.../org/superbiz/WeatherServiceHealthCheck.java | 48 ++++++
.../src/main/resources/beans.xml | 7 +
.../org/superbiz/test/WeatherServiceTest.java | 124 ++++++++++++++++
.../src/test/resources/arquillian.xml | 29 ++++
examples/mp-opentracing-traced/README.adoc | 64 ++++++++
examples/pom.xml | 4 +
12 files changed, 703 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/a5f2192c/examples/pom.xml
----------------------------------------------------------------------
[3/5] tomee git commit: Fixing README formatting,
removing unused imports and changing logger attribute to final
Posted by jg...@apache.org.
Fixing README formatting, removing unused imports and changing logger attribute to final
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/f97f74ea
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/f97f74ea
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/f97f74ea
Branch: refs/heads/master
Commit: f97f74eaeadc44b0e0d4859c4797df77c6c5c5e5
Parents: 2057761
Author: Weverthon Medeiros <we...@gmail.com>
Authored: Fri Dec 21 14:54:48 2018 +0000
Committer: Weverthon Medeiros <we...@gmail.com>
Committed: Fri Dec 21 14:54:48 2018 +0000
----------------------------------------------------------------------
examples/mp-faulttolerance-fallback/README.adoc | 26 +++++++++-----------
.../rest/WeatherDayStatusFallbackHandler.java | 4 +--
.../java/org/superbiz/rest/WeatherService.java | 6 ++---
3 files changed, 15 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/f97f74ea/examples/mp-faulttolerance-fallback/README.adoc
----------------------------------------------------------------------
diff --git a/examples/mp-faulttolerance-fallback/README.adoc b/examples/mp-faulttolerance-fallback/README.adoc
index deba96b..ea5e599 100644
--- a/examples/mp-faulttolerance-fallback/README.adoc
+++ b/examples/mp-faulttolerance-fallback/README.adoc
@@ -1,32 +1,28 @@
-index-group=Unrevised
-type=page
-status=published
-~~~~~~
-# Microprofile Fault Tolerance - Fallback
+= Microprofile Fault Tolerance - Fallback
This is an example of how to use Microprofile @Fallback in TomEE.
-#### Fallback Feature
+== Fallback Feature
Fault Tolerance Fallback provides an alternative execution in case of failure. This alternative will be called when
`Retry` or `CircuitBreaker` has failed.
-To use this feature you need to annotate the method with @Fallback.
+To use this feature you need to annotate the method with `@Fallback`.
The Fallback policy allows to configure :
* **value**: A class which implements `FallbackHandler`
* **fallbackMethod**: a method which will be executed.
-The parameters **value** and **fallbackMethod** cannot be specified at the same time.
+The parameters `value` and `fallbackMethod` cannot be specified at the same time.
-Check the [specification](http://download.eclipse.org/microprofile/microprofile-fault-tolerance-1.1/microprofile-fault-tolerance-spec.html) for more details.
+Check the http://download.eclipse.org/microprofile/microprofile-fault-tolerance-1.1/microprofile-fault-tolerance-spec.html[specification] for more details.
-### Examples
+== Examples
-##### Run the application
+=== Run the application
mvn clean install tomee:run
-##### Example 1
+=== Example 1
The method `statusOfDay` will always fail throwing a `WeatherException` and as the
`@CircuitBreaker` annotation is configured to `failOn` in case of that exception, the fallback,
@@ -69,7 +65,7 @@ Response
Hi, today is a sunny day!
```
-##### Example 2
+=== Example 2
The method `statusOfDay` will always fail throwing a `WeatherException` and as the
`@Retry` annotation is configured to `maxRetries = 1` in case of fail, the fallback method,
@@ -111,9 +107,9 @@ Hi, week will be mostly sunny!
```
-##### Run the tests
+=== Run the tests
-You can also try it out using the [WeatherServiceTest.java](src/test/java/org/superbiz/rest/WeatherServiceTest.java) available in the project.
+You can also try it out using the link:src/test/java/org/superbiz/rest/WeatherServiceTest.java[WeatherServiceTest.java] available in the project.
mvn clean test
http://git-wip-us.apache.org/repos/asf/tomee/blob/f97f74ea/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherDayStatusFallbackHandler.java
----------------------------------------------------------------------
diff --git a/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherDayStatusFallbackHandler.java b/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherDayStatusFallbackHandler.java
index 8d9101b..a887b47 100644
--- a/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherDayStatusFallbackHandler.java
+++ b/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherDayStatusFallbackHandler.java
@@ -24,11 +24,11 @@ import java.util.logging.Logger;
public class WeatherDayStatusFallbackHandler implements FallbackHandler<String> {
- private static Logger logger = Logger.getLogger(WeatherDayStatusFallbackHandler.class.getName());
+ private static final Logger LOGGER = Logger.getLogger(WeatherDayStatusFallbackHandler.class.getName());
@Override
public String handle(ExecutionContext executionContext) {
- logger.log(Level.SEVERE, "Fallback was triggered due a fail");
+ LOGGER.log(Level.SEVERE, "Fallback was triggered due a fail");
return "Hi, today is a sunny day!";
}
}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f97f74ea/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherService.java
----------------------------------------------------------------------
diff --git a/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherService.java b/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherService.java
index 145b02e..1d1bf44 100644
--- a/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherService.java
+++ b/examples/mp-faulttolerance-fallback/src/main/java/org/superbiz/rest/WeatherService.java
@@ -24,12 +24,10 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
@Path("/weather")
@@ -37,7 +35,7 @@ import javax.ws.rs.core.Response;
@RequestScoped
public class WeatherService {
- private static Logger logger = Logger.getLogger(WeatherService.class.getName());
+ private static final Logger LOGGER = Logger.getLogger(WeatherService.class.getName());
@GET
@Path("/day/status")
@@ -56,7 +54,7 @@ public class WeatherService {
}
public String fallbackForWeekStatus() {
- logger.log(Level.SEVERE, "Fallback was triggered due a fail");
+ LOGGER.log(Level.SEVERE, "Fallback was triggered due a fail");
return "Hi, week will be mostly sunny!";
}
}
[5/5] tomee git commit: Header
Posted by jg...@apache.org.
Header
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/2b2cca1f
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/2b2cca1f
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/2b2cca1f
Branch: refs/heads/master
Commit: 2b2cca1f174c3714c35e528e8d36f08efde2f677
Parents: a5f2192
Author: Jonathan Gallimore <jo...@jrg.me.uk>
Authored: Fri Dec 21 16:18:23 2018 +0000
Committer: Jonathan Gallimore <jo...@jrg.me.uk>
Committed: Fri Dec 21 16:18:23 2018 +0000
----------------------------------------------------------------------
examples/mp-faulttolerance-fallback/pom.xml | 14 ++++++++++++++
1 file changed, 14 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/2b2cca1f/examples/mp-faulttolerance-fallback/pom.xml
----------------------------------------------------------------------
diff --git a/examples/mp-faulttolerance-fallback/pom.xml b/examples/mp-faulttolerance-fallback/pom.xml
index 40e771c..b55a86c 100644
--- a/examples/mp-faulttolerance-fallback/pom.xml
+++ b/examples/mp-faulttolerance-fallback/pom.xml
@@ -1,4 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
<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/xsd/maven-4.0.0.xsd">