You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by ra...@apache.org on 2018/12/17 22:24:06 UTC

[1/5] tomee git commit: TOMEE-2297 - Added mp-rest-client example maven project

Repository: tomee
Updated Branches:
  refs/heads/master 0fa46129c -> e7efcb6c8


TOMEE-2297 - Added mp-rest-client example maven project


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/d4761311
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/d4761311
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/d4761311

Branch: refs/heads/master
Commit: d4761311aa93ad747c9e778daa21da0041724c40
Parents: 0fa4612
Author: CesarHernandezGt <cf...@gmail.com>
Authored: Tue Nov 20 16:29:10 2018 -0600
Committer: Roberto Cortez <ra...@yahoo.com>
Committed: Mon Dec 17 22:19:42 2018 +0000

----------------------------------------------------------------------
 examples/mp-rest-client/README.md               |  1 +
 examples/mp-rest-client/pom.xml                 | 79 ++++++++++++++++++++
 .../org/superbiz/rest/ApplicationConfig.java    |  9 +++
 .../src/main/java/org/superbiz/rest/Book.java   | 33 ++++++++
 .../main/java/org/superbiz/rest/BookBean.java   | 43 +++++++++++
 .../java/org/superbiz/rest/BookResource.java    | 54 +++++++++++++
 .../org/superbiz/rest/BookResourceClient.java   | 40 ++++++++++
 .../org/superbiz/rest/BookResourceTest.java     | 60 +++++++++++++++
 .../src/test/resources/META-INF/beans.xml       |  1 +
 .../META-INF/microprofile-config.properties     |  1 +
 .../src/test/resources/arquillian.xml           | 39 ++++++++++
 11 files changed, 360 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/d4761311/examples/mp-rest-client/README.md
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/README.md b/examples/mp-rest-client/README.md
new file mode 100755
index 0000000..cedeb35
--- /dev/null
+++ b/examples/mp-rest-client/README.md
@@ -0,0 +1 @@
+# Microprofile Rest client

http://git-wip-us.apache.org/repos/asf/tomee/blob/d4761311/examples/mp-rest-client/pom.xml
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/pom.xml b/examples/mp-rest-client/pom.xml
new file mode 100755
index 0000000..0b46d37
--- /dev/null
+++ b/examples/mp-rest-client/pom.xml
@@ -0,0 +1,79 @@
+<?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">
+    <parent>
+        <artifactId>examples</artifactId>
+        <groupId>org.apache.tomee</groupId>
+        <version>8.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>mp-rest-client-example</artifactId>
+    <packaging>war</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tomee</groupId>
+            <artifactId>javaee-api</artifactId>
+            <version>8.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.microprofile</groupId>
+            <artifactId>microprofile</artifactId>
+            <version>1.3</version>
+            <type>pom</type>
+            <scope>provided</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>1.0.3.Final</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tomee</groupId>
+            <artifactId>arquillian-tomee-remote</artifactId>
+            <version>${tomee.version}</version>
+        </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>${tomee.version}</version>
+                <configuration>
+                    <tomeeClassifier>microprofile</tomeeClassifier>
+                    <context>${artifactId}</context>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <reuseForks>false</reuseForks>
+                    <!-- need it in order to see complete logs on terminal during: mvn clean test-->
+                    <forkCount>0</forkCount>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/d4761311/examples/mp-rest-client/src/main/java/org/superbiz/rest/ApplicationConfig.java
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/src/main/java/org/superbiz/rest/ApplicationConfig.java b/examples/mp-rest-client/src/main/java/org/superbiz/rest/ApplicationConfig.java
new file mode 100644
index 0000000..ec64bd1
--- /dev/null
+++ b/examples/mp-rest-client/src/main/java/org/superbiz/rest/ApplicationConfig.java
@@ -0,0 +1,9 @@
+package org.superbiz.rest;
+
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Application;
+
+@ApplicationPath("/api")
+public class ApplicationConfig extends Application {
+    // let the server discover the endpoints
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d4761311/examples/mp-rest-client/src/main/java/org/superbiz/rest/Book.java
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/src/main/java/org/superbiz/rest/Book.java b/examples/mp-rest-client/src/main/java/org/superbiz/rest/Book.java
new file mode 100644
index 0000000..f3eb767
--- /dev/null
+++ b/examples/mp-rest-client/src/main/java/org/superbiz/rest/Book.java
@@ -0,0 +1,33 @@
+package org.superbiz.rest;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class Book {
+
+    private int id;
+    private String name;
+
+    public Book() {}
+
+    public Book(int bookId, String name) {
+        this.id = bookId;
+        this.name = name;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d4761311/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookBean.java
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookBean.java b/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookBean.java
new file mode 100644
index 0000000..76f7d88
--- /dev/null
+++ b/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookBean.java
@@ -0,0 +1,43 @@
+package org.superbiz.rest;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+
+@ApplicationScoped
+public class BookBean {
+
+    private HashMap<Integer,Book> bookStore;
+
+
+    @PostConstruct
+    public void bookBean() {
+        bookStore = new HashMap();
+    }
+
+    public void addBook(Book newBook) {
+        bookStore.put(newBook.getId(), newBook);
+    }
+
+    public void deleteBook(int id) {
+        bookStore.remove(id);
+    }
+
+    public void updateBook(Book updatedBook) {
+        bookStore.put(updatedBook.getId(),updatedBook);
+    }
+
+    public Book getBook(int id) {
+        return bookStore.get(id);
+    }
+
+    public List getBooks() {
+        Collection<Book> books = bookStore.values();
+        return new ArrayList<Book>(books);
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d4761311/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookResource.java
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookResource.java b/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookResource.java
new file mode 100644
index 0000000..5885097
--- /dev/null
+++ b/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookResource.java
@@ -0,0 +1,54 @@
+package org.superbiz.rest;
+
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
+import java.util.List;
+
+@Path("/library")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+@ApplicationScoped
+public class BookResource {
+
+    @Inject
+    BookBean bookBean;
+
+    @GET
+    public String status() {
+        return "ok";
+    }
+
+    @POST
+    @Path("/books")
+    public void addBook(Book newBook) {
+        bookBean.addBook(newBook);
+    }
+
+    @DELETE
+    @Path("/books/{id}")
+    public void deleteBook(@PathParam("id") int id) {
+        bookBean.deleteBook(id);
+    }
+
+    @PUT
+    @Path("/books")
+    public void updateBook(Book updatedBook) {
+        bookBean.updateBook(updatedBook);
+    }
+
+    @GET
+    @Path("/books/{id}")
+    public Book getBook(@PathParam("id") int id) {
+        return bookBean.getBook(id);
+    }
+
+    @GET
+    @Path("/books")
+    public List<Book> getListOfBooks() {
+        return bookBean.getBooks();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d4761311/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceClient.java
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceClient.java b/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceClient.java
new file mode 100644
index 0000000..5ce735f
--- /dev/null
+++ b/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceClient.java
@@ -0,0 +1,40 @@
+package org.superbiz.rest;
+
+
+import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
+import javax.enterprise.context.Dependent;
+import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
+import java.util.List;
+
+@Dependent
+@RegisterRestClient
+@Path("/test/api/library")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+public interface BookResourceClient {
+
+    @GET
+    String status();
+
+    @POST
+    @Path("/books")
+    void addBook(Book newBook);
+
+    @DELETE
+    @Path("/books/{id}")
+    void deleteBook(@PathParam("id") int id);
+
+    @PUT
+    @Path("/books")
+    void updateBook(Book updatedBook);
+
+    @GET
+    @Path("/books/{id}")
+    Book getBook(@PathParam("id") int id);
+
+    @GET
+    @Path("/books")
+    List<Book> getListOfBooks();
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d4761311/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceTest.java
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceTest.java b/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceTest.java
new file mode 100644
index 0000000..8816c80
--- /dev/null
+++ b/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceTest.java
@@ -0,0 +1,60 @@
+package org.superbiz.rest;
+
+import org.eclipse.microprofile.rest.client.inject.RestClient;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.inject.Inject;
+
+import static org.junit.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class BookResourceTest {
+
+    @Deployment()
+    public static WebArchive createDeployment() {
+        final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "test.war")
+                .addClass(BookResource.class)
+                .addClass(Book.class)
+                .addClass(BookBean.class)
+                .addClass(BookResourceClient.class)
+                .addClass(ApplicationConfig.class)
+                .addAsWebInfResource(new StringAsset("<beans/>"), "beans.xml")
+                .addAsResource("META-INF/microprofile-config.properties");
+        return webArchive;
+    }
+
+
+    @Inject
+    @RestClient
+    private BookResourceClient bookResourceClient;
+
+    @Test()
+    public void testServerStatus(){
+        bookResourceClient.addBook(new Book(1,"TomEE Book"));
+    }
+
+    @Test
+    public void testBookResource(){
+        bookResourceClient.addBook(new Book(1, "TomEE and MicroProfile Adventures"));
+        bookResourceClient.addBook(new Book(2, "Top 10 Tomee Configuraiton Tips"));
+
+
+        assertTrue(bookResourceClient.getListOfBooks().size() == 2);
+        assertTrue(bookResourceClient.getBook(1).getName().equalsIgnoreCase("TomEE and MicroProfile Adventures"));
+
+        bookResourceClient.deleteBook(1);
+        assertTrue(bookResourceClient.getListOfBooks().size() == 1);
+        assertTrue(bookResourceClient.getBook(2).getName().equalsIgnoreCase("Top 10 Tomee Configuraiton Tips"));
+
+        bookResourceClient.updateBook(new Book(2, "Top 3 Tomee Configuraiton Tips"));
+        assertTrue(bookResourceClient.getListOfBooks().size() == 1);
+        assertTrue(bookResourceClient.getBook(2).getName().equalsIgnoreCase("Top 3 Tomee Configuraiton Tips"));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/d4761311/examples/mp-rest-client/src/test/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/src/test/resources/META-INF/beans.xml b/examples/mp-rest-client/src/test/resources/META-INF/beans.xml
new file mode 100644
index 0000000..e71e480
--- /dev/null
+++ b/examples/mp-rest-client/src/test/resources/META-INF/beans.xml
@@ -0,0 +1 @@
+<beans></beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/d4761311/examples/mp-rest-client/src/test/resources/META-INF/microprofile-config.properties
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/src/test/resources/META-INF/microprofile-config.properties b/examples/mp-rest-client/src/test/resources/META-INF/microprofile-config.properties
new file mode 100644
index 0000000..df8dfa1
--- /dev/null
+++ b/examples/mp-rest-client/src/test/resources/META-INF/microprofile-config.properties
@@ -0,0 +1 @@
+org.superbiz.rest.BookResourceClient/mp-rest/url=http://localhost:4444
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/d4761311/examples/mp-rest-client/src/test/resources/arquillian.xml
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/src/test/resources/arquillian.xml b/examples/mp-rest-client/src/test/resources/arquillian.xml
new file mode 100755
index 0000000..5fd386b
--- /dev/null
+++ b/examples/mp-rest-client/src/test/resources/arquillian.xml
@@ -0,0 +1,39 @@
+<?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="http://jboss.org/schema/arquillian"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="
+              http://jboss.org/schema/arquillian
+              http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+  <container qualifier="server" default="true">
+    <configuration>
+      <property name="httpsPort">-1</property>
+      <property name="httpPort">4444</property>
+      <property name="stopPort">-1</property>
+      <property name="ajpPort">-1</property>
+      <property name="classifier">microprofile</property>
+      <property name="simpleLog">true</property>
+      <property name="cleanOnStartUp">true</property>
+      <property name="additionalLibs">mvn:com.github.javafaker:javafaker:0.15</property>
+      <property name="dir">target/server</property>
+      <property name="appWorkingDir">target/arquillian</property>
+    </configuration>
+  </container>
+</arquillian>
\ No newline at end of file


[3/5] tomee git commit: TOMEE-2297 fixed build issues, cleaned code and added content for readme

Posted by ra...@apache.org.
TOMEE-2297 fixed build issues, cleaned code and added content for readme


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/66f94f2c
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/66f94f2c
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/66f94f2c

Branch: refs/heads/master
Commit: 66f94f2c0f47f0c0807887997cbdfd0430360890
Parents: f0e2109
Author: CesarHernandezGt <cf...@gmail.com>
Authored: Fri Dec 14 22:28:06 2018 -0600
Committer: Roberto Cortez <ra...@yahoo.com>
Committed: Mon Dec 17 22:22:19 2018 +0000

----------------------------------------------------------------------
 examples/mp-rest-client/README.md               | 137 +++++++++++++++++++
 examples/mp-rest-client/pom.xml                 |  70 +++++++---
 .../src/test/resources/arquillian.xml           |   1 -
 3 files changed, 190 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/66f94f2c/examples/mp-rest-client/README.md
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/README.md b/examples/mp-rest-client/README.md
index cedeb35..0f0fcc5 100755
--- a/examples/mp-rest-client/README.md
+++ b/examples/mp-rest-client/README.md
@@ -1 +1,138 @@
 # Microprofile Rest client
+This is a basic example on how to configure and use MicroProfile Rest Client in TomEE.
+
+## Run the tests for different scenarios related with JWT validation
+
+    mvn clean test 
+
+## Requirementes and configuration
+
+To use MicroProfile Rest Client you need 3 changes in your project:
+
+1) Add the to the `pom.xml` the dependency:
+
+        <dependency>
+            <groupId>org.eclipse.microprofile.rest.client</groupId>
+            <artifactId>microprofile-rest-client-api</artifactId>
+            <version>${microprofile.rest-client.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+2) Provide configuration files: `microprofile-config.properties`
+
+        org.superbiz.rest.BookResourceClient/mp-rest/url=http://localhost:4444
+
+3) Provide an interface that you can build from the JAX-RS resource you want to consume: `BookResourceClient.java`
+    
+        package org.superbiz.rest;
+        
+        import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
+        import javax.enterprise.context.Dependent;
+        import javax.ws.rs.*;
+        import javax.ws.rs.core.MediaType;
+        import java.util.List;
+        
+        @Dependent
+        @RegisterRestClient
+        @Path("/test/api/library")
+        @Produces(MediaType.APPLICATION_JSON)
+        @Consumes(MediaType.APPLICATION_JSON)
+        public interface BookResourceClient {
+        
+            @GET
+            String status();
+        
+            @POST
+            @Path("/books")
+            void addBook(Book newBook);
+        
+            @DELETE
+            @Path("/books/{id}")
+            void deleteBook(@PathParam("id") int id);
+        
+            @PUT
+            @Path("/books")
+            void updateBook(Book updatedBook);
+        
+            @GET
+            @Path("/books/{id}")
+            Book getBook(@PathParam("id") int id);
+        
+            @GET
+            @Path("/books")
+            List<Book> getListOfBooks();
+        
+        }
+
+
+## Use of MicroProfile Rest Client in TomEE
+
+The class `BookResourceTest.java` shows how easy is to use the type-safe approach provided by MicroProfile Rest Client to consume an existing JAX-RS resource. 
+
+    package org.superbiz.rest;
+    
+    import org.eclipse.microprofile.rest.client.inject.RestClient;
+    import org.jboss.arquillian.container.test.api.Deployment;
+    import org.jboss.arquillian.junit.Arquillian;
+    import org.jboss.shrinkwrap.api.ShrinkWrap;
+    import org.jboss.shrinkwrap.api.asset.StringAsset;
+    import org.jboss.shrinkwrap.api.spec.WebArchive;
+    import org.junit.Test;
+    import org.junit.runner.RunWith;
+    
+    import javax.inject.Inject;
+    
+    import static org.junit.Assert.assertTrue;
+    
+    @RunWith(Arquillian.class)
+    public class BookResourceTest {
+    
+        @Deployment()
+        public static WebArchive createDeployment() {
+            final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "test.war")
+                    .addClass(BookResource.class)
+                    .addClass(Book.class)
+                    .addClass(BookBean.class)
+                    .addClass(BookResourceClient.class)
+                    .addClass(ApplicationConfig.class)
+                    .addAsWebInfResource(new StringAsset("<beans/>"), "beans.xml")
+                    .addAsResource("META-INF/microprofile-config.properties");
+            return webArchive;
+        }
+    
+    
+        @Inject
+        @RestClient
+        private BookResourceClient bookResourceClient;
+    
+        @Test()
+        public void testServerStatus(){
+            bookResourceClient.addBook(new Book(1,"TomEE Book"));
+        }
+    
+        @Test
+        public void testBookResource(){
+            bookResourceClient.addBook(new Book(1, "TomEE and MicroProfile Adventures"));
+            bookResourceClient.addBook(new Book(2, "Top 10 Tomee Configuraiton Tips"));
+    
+    
+            assertTrue(bookResourceClient.getListOfBooks().size() == 2);
+            assertTrue(bookResourceClient.getBook(1).getName().equalsIgnoreCase("TomEE and MicroProfile Adventures"));
+    
+            bookResourceClient.deleteBook(1);
+            assertTrue(bookResourceClient.getListOfBooks().size() == 1);
+            assertTrue(bookResourceClient.getBook(2).getName().equalsIgnoreCase("Top 10 Tomee Configuraiton Tips"));
+    
+            bookResourceClient.updateBook(new Book(2, "Top 3 Tomee Configuraiton Tips"));
+            assertTrue(bookResourceClient.getListOfBooks().size() == 1);
+            assertTrue(bookResourceClient.getBook(2).getName().equalsIgnoreCase("Top 3 Tomee Configuraiton Tips"));
+        }
+    
+    }
+
+## About the Test architecture
+
+The test cases from this project are built using Arquillian and TomEE Remote. 
+The arquillian configuration can be found in
+`src/test/resources/arquillian.xml`
+

http://git-wip-us.apache.org/repos/asf/tomee/blob/66f94f2c/examples/mp-rest-client/pom.xml
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/pom.xml b/examples/mp-rest-client/pom.xml
index 887f1f3..bd4b2bc 100755
--- a/examples/mp-rest-client/pom.xml
+++ b/examples/mp-rest-client/pom.xml
@@ -1,31 +1,66 @@
 <?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">
-    <parent>
-        <artifactId>examples</artifactId>
-        <groupId>org.apache.tomee</groupId>
-        <version>8.0.0-SNAPSHOT</version>
-    </parent>
+
     <modelVersion>4.0.0</modelVersion>
 
+    <groupId>org.superbiz</groupId>
     <artifactId>mp-rest-client</artifactId>
+    <version>8.0.0-SNAPSHOT</version>
     <packaging>war</packaging>
+    <name>OpenEJB :: Examples :: mp-rest-client</name>
+
+
+    <properties>
+        <microprofile.rest-client.version>1.1</microprofile.rest-client.version>
+        <version.javaee-api>8.0</version.javaee-api>
+        <version.arquillian.bom>1.1.13.Final</version.arquillian.bom>
+        <tomee.version>${project.version}</tomee.version>
+        <junit.version>4.12</junit.version>
+    </properties>
+
 
     <dependencies>
         <dependency>
             <groupId>org.apache.tomee</groupId>
             <artifactId>javaee-api</artifactId>
-            <version>8.0</version>
+            <version>${version.javaee-api}</version>
             <scope>provided</scope>
         </dependency>
+
         <dependency>
-            <groupId>org.eclipse.microprofile</groupId>
-            <artifactId>microprofile</artifactId>
-            <version>1.3</version>
-            <type>pom</type>
+            <groupId>org.eclipse.microprofile.rest.client</groupId>
+            <artifactId>microprofile-rest-client-api</artifactId>
+            <version>${microprofile.rest-client.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>
@@ -35,13 +70,14 @@
         <dependency>
             <groupId>org.jboss.arquillian.junit</groupId>
             <artifactId>arquillian-junit-container</artifactId>
-            <version>1.0.3.Final</version>
+            <version>${version.arquillian.bom}</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>
@@ -58,19 +94,19 @@
             <plugin>
                 <groupId>org.apache.tomee.maven</groupId>
                 <artifactId>tomee-maven-plugin</artifactId>
-                <version>${tomee.version}</version>
+                <version>${project.version}</version>
                 <configuration>
                     <tomeeClassifier>microprofile</tomeeClassifier>
-                    <context>${artifactId}</context>
+                    <context>${project.artifactId}</context>
                 </configuration>
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.7.0</version>
                 <configuration>
-                    <reuseForks>false</reuseForks>
-                    <!-- need it in order to see complete logs on terminal during: mvn clean test-->
-                    <forkCount>0</forkCount>
+                    <source>1.8</source>
+                    <target>1.8</target>
                 </configuration>
             </plugin>
         </plugins>

http://git-wip-us.apache.org/repos/asf/tomee/blob/66f94f2c/examples/mp-rest-client/src/test/resources/arquillian.xml
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/src/test/resources/arquillian.xml b/examples/mp-rest-client/src/test/resources/arquillian.xml
index 5fd386b..534eb1c 100755
--- a/examples/mp-rest-client/src/test/resources/arquillian.xml
+++ b/examples/mp-rest-client/src/test/resources/arquillian.xml
@@ -31,7 +31,6 @@
       <property name="classifier">microprofile</property>
       <property name="simpleLog">true</property>
       <property name="cleanOnStartUp">true</property>
-      <property name="additionalLibs">mvn:com.github.javafaker:javafaker:0.15</property>
       <property name="dir">target/server</property>
       <property name="appWorkingDir">target/arquillian</property>
     </configuration>


[5/5] tomee git commit: TOMEE-2297 closes apache/tomee#210 *Merged*

Posted by ra...@apache.org.
TOMEE-2297 closes apache/tomee#210 *Merged*


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/e7efcb6c
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/e7efcb6c
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/e7efcb6c

Branch: refs/heads/master
Commit: e7efcb6c810bf4e60db36195c20f2276b8c99459
Parents: f43b8bb
Author: Roberto Cortez <ra...@yahoo.com>
Authored: Mon Dec 17 22:23:54 2018 +0000
Committer: Roberto Cortez <ra...@yahoo.com>
Committed: Mon Dec 17 22:23:54 2018 +0000

----------------------------------------------------------------------

----------------------------------------------------------------------



[2/5] tomee git commit: TOMEE-2297 Fixed pom name and added the module on examples/pom.xml

Posted by ra...@apache.org.
TOMEE-2297 Fixed pom name and added the module on examples/pom.xml


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/f0e21099
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/f0e21099
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/f0e21099

Branch: refs/heads/master
Commit: f0e210999e8371d3d75b461dfcc4215a06a9b399
Parents: d476131
Author: CesarHernandezGt <cf...@gmail.com>
Authored: Fri Nov 30 15:13:46 2018 -0600
Committer: Roberto Cortez <ra...@yahoo.com>
Committed: Mon Dec 17 22:21:21 2018 +0000

----------------------------------------------------------------------
 examples/mp-rest-client/pom.xml | 2 +-
 examples/pom.xml                | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/f0e21099/examples/mp-rest-client/pom.xml
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/pom.xml b/examples/mp-rest-client/pom.xml
index 0b46d37..887f1f3 100755
--- a/examples/mp-rest-client/pom.xml
+++ b/examples/mp-rest-client/pom.xml
@@ -9,7 +9,7 @@
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>mp-rest-client-example</artifactId>
+    <artifactId>mp-rest-client</artifactId>
     <packaging>war</packaging>
 
     <dependencies>

http://git-wip-us.apache.org/repos/asf/tomee/blob/f0e21099/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 0007646..c1f9c58 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -179,6 +179,7 @@ BROKEN, see TOMEE-2140
     <module>websocket-tls-basic-auth</module>
     <module>concurrency-utils</module>
     <module>mvc-cxf</module>
+    <module>mp-rest-client</module>
   </modules>
 
   <dependencies>


[4/5] tomee git commit: TOMEE-2297 Added war plugin to pom.xml and added license header to missing files

Posted by ra...@apache.org.
TOMEE-2297 Added war plugin to pom.xml and added license header to missing files


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/f43b8bbc
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/f43b8bbc
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/f43b8bbc

Branch: refs/heads/master
Commit: f43b8bbc30dcaa75012c7dc2a0290fd4ff660477
Parents: 66f94f2
Author: CesarHernandezGt <cf...@gmail.com>
Authored: Mon Dec 17 12:47:12 2018 -0600
Committer: Roberto Cortez <ra...@yahoo.com>
Committed: Mon Dec 17 22:22:19 2018 +0000

----------------------------------------------------------------------
 examples/mp-rest-client/pom.xml                    |  6 ++++++
 .../java/org/superbiz/rest/ApplicationConfig.java  | 17 +++++++++++++++++
 .../src/main/java/org/superbiz/rest/Book.java      | 17 +++++++++++++++++
 .../src/main/java/org/superbiz/rest/BookBean.java  | 17 +++++++++++++++++
 .../main/java/org/superbiz/rest/BookResource.java  | 17 +++++++++++++++++
 .../java/org/superbiz/rest/BookResourceClient.java | 17 +++++++++++++++++
 .../java/org/superbiz/rest/BookResourceTest.java   | 17 +++++++++++++++++
 7 files changed, 108 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/f43b8bbc/examples/mp-rest-client/pom.xml
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/pom.xml b/examples/mp-rest-client/pom.xml
index bd4b2bc..3dca928 100755
--- a/examples/mp-rest-client/pom.xml
+++ b/examples/mp-rest-client/pom.xml
@@ -109,6 +109,12 @@
                     <target>1.8</target>
                 </configuration>
             </plugin>
+            <plugin>
+                <artifactId>maven-war-plugin</artifactId>
+                <configuration>
+                    <failOnMissingWebXml>false</failOnMissingWebXml>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/f43b8bbc/examples/mp-rest-client/src/main/java/org/superbiz/rest/ApplicationConfig.java
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/src/main/java/org/superbiz/rest/ApplicationConfig.java b/examples/mp-rest-client/src/main/java/org/superbiz/rest/ApplicationConfig.java
index ec64bd1..6fa17ac 100644
--- a/examples/mp-rest-client/src/main/java/org/superbiz/rest/ApplicationConfig.java
+++ b/examples/mp-rest-client/src/main/java/org/superbiz/rest/ApplicationConfig.java
@@ -1,3 +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;
 
 import javax.ws.rs.ApplicationPath;

http://git-wip-us.apache.org/repos/asf/tomee/blob/f43b8bbc/examples/mp-rest-client/src/main/java/org/superbiz/rest/Book.java
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/src/main/java/org/superbiz/rest/Book.java b/examples/mp-rest-client/src/main/java/org/superbiz/rest/Book.java
index f3eb767..274282c 100644
--- a/examples/mp-rest-client/src/main/java/org/superbiz/rest/Book.java
+++ b/examples/mp-rest-client/src/main/java/org/superbiz/rest/Book.java
@@ -1,3 +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;
 
 import javax.xml.bind.annotation.XmlRootElement;

http://git-wip-us.apache.org/repos/asf/tomee/blob/f43b8bbc/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookBean.java
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookBean.java b/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookBean.java
index 76f7d88..b477603 100644
--- a/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookBean.java
+++ b/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookBean.java
@@ -1,3 +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;
 
 import javax.annotation.PostConstruct;

http://git-wip-us.apache.org/repos/asf/tomee/blob/f43b8bbc/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookResource.java
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookResource.java b/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookResource.java
index 5885097..ea3ef14 100644
--- a/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookResource.java
+++ b/examples/mp-rest-client/src/main/java/org/superbiz/rest/BookResource.java
@@ -1,3 +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;
 
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/f43b8bbc/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceClient.java
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceClient.java b/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceClient.java
index 5ce735f..6d4eb86 100644
--- a/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceClient.java
+++ b/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceClient.java
@@ -1,3 +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;
 
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/f43b8bbc/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceTest.java
----------------------------------------------------------------------
diff --git a/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceTest.java b/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceTest.java
index 8816c80..62533cf 100644
--- a/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceTest.java
+++ b/examples/mp-rest-client/src/test/java/org/superbiz/rest/BookResourceTest.java
@@ -1,3 +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;
 
 import org.eclipse.microprofile.rest.client.inject.RestClient;