You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2011/10/30 00:00:59 UTC
svn commit: r1195054 [3/3] - in /openejb/trunk/openejb/examples: ./
application-composer/
application-composer/src/main/java/org/superbiz/composed/
async-methods/src/main/java/org/superbiz/async/
bean-validation-design-by-contract/src/main/java/org/sup...
Modified: openejb/trunk/openejb/examples/webapps/rest-example/src/main/java/org/superbiz/rest/service/PostService.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webapps/rest-example/src/main/java/org/superbiz/rest/service/PostService.java?rev=1195054&r1=1195053&r2=1195054&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/webapps/rest-example/src/main/java/org/superbiz/rest/service/PostService.java (original)
+++ openejb/trunk/openejb/examples/webapps/rest-example/src/main/java/org/superbiz/rest/service/PostService.java Sat Oct 29 22:00:55 2011
@@ -35,33 +35,44 @@ import java.util.List;
* @author Romain Manni-Bucau
*/
@Path("/api/post")
-@Produces({ "text/xml", "application/json" })
+@Produces({"text/xml", "application/json"})
public class PostService {
- @EJB private PostDAO dao;
+ @EJB
+ private PostDAO dao;
- @Path("/create") @PUT public Post create(@QueryParam("title") String title,
- @QueryParam("content") String content,
- @QueryParam("userId") long userId) {
+ @Path("/create")
+ @PUT
+ public Post create(@QueryParam("title") String title,
+ @QueryParam("content") String content,
+ @QueryParam("userId") long userId) {
return dao.create(title, content, userId);
}
- @Path("/list") @GET public List<Post> list(@QueryParam("first") @DefaultValue("0") int first,
- @QueryParam("max") @DefaultValue("20") int max) {
+ @Path("/list")
+ @GET
+ public List<Post> list(@QueryParam("first") @DefaultValue("0") int first,
+ @QueryParam("max") @DefaultValue("20") int max) {
return dao.list(first, max);
}
- @Path("/show/{id}") @GET public Post show(@PathParam("id") long id) {
+ @Path("/show/{id}")
+ @GET
+ public Post show(@PathParam("id") long id) {
return dao.find(id);
}
- @Path("/delete/{id}") @DELETE public void delete(@PathParam("id") long id) {
+ @Path("/delete/{id}")
+ @DELETE
+ public void delete(@PathParam("id") long id) {
dao.delete(id);
}
- @Path("/update/{id}") @POST public Post update(@PathParam("id") long id,
- @QueryParam("userId") long userId,
- @QueryParam("title") String title,
- @QueryParam("content") String content) {
+ @Path("/update/{id}")
+ @POST
+ public Post update(@PathParam("id") long id,
+ @QueryParam("userId") long userId,
+ @QueryParam("title") String title,
+ @QueryParam("content") String content) {
return dao.update(id, userId, title, content);
}
}
Modified: openejb/trunk/openejb/examples/webapps/rest-example/src/main/java/org/superbiz/rest/service/UserService.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webapps/rest-example/src/main/java/org/superbiz/rest/service/UserService.java?rev=1195054&r1=1195053&r2=1195054&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/webapps/rest-example/src/main/java/org/superbiz/rest/service/UserService.java (original)
+++ openejb/trunk/openejb/examples/webapps/rest-example/src/main/java/org/superbiz/rest/service/UserService.java Sat Oct 29 22:00:55 2011
@@ -17,7 +17,6 @@
package org.superbiz.rest.service;
import org.superbiz.rest.dao.UserDAO;
-import org.superbiz.rest.model.Post;
import org.superbiz.rest.model.User;
import javax.ejb.EJB;
@@ -36,33 +35,44 @@ import java.util.List;
* @author Romain Manni-Bucau
*/
@Path("/api/user")
-@Produces({ "text/xml", "application/json" })
+@Produces({"text/xml", "application/json"})
public class UserService {
- @EJB private UserDAO dao;
+ @EJB
+ private UserDAO dao;
- @Path("/create") @PUT public User create(@QueryParam("name") String name,
- @QueryParam("pwd") String pwd,
- @QueryParam("mail") String mail) {
+ @Path("/create")
+ @PUT
+ public User create(@QueryParam("name") String name,
+ @QueryParam("pwd") String pwd,
+ @QueryParam("mail") String mail) {
return dao.create(name, pwd, mail);
}
- @Path("/list") @GET public List<User> list(@QueryParam("first") @DefaultValue("0") int first,
- @QueryParam("max") @DefaultValue("20") int max) {
+ @Path("/list")
+ @GET
+ public List<User> list(@QueryParam("first") @DefaultValue("0") int first,
+ @QueryParam("max") @DefaultValue("20") int max) {
return dao.list(first, max);
}
- @Path("/show/{id}") @GET public User show(@PathParam("id") long id) {
+ @Path("/show/{id}")
+ @GET
+ public User show(@PathParam("id") long id) {
return dao.find(id);
}
- @Path("/delete/{id}") @DELETE public void delete(@PathParam("id") long id) {
+ @Path("/delete/{id}")
+ @DELETE
+ public void delete(@PathParam("id") long id) {
dao.delete(id);
}
- @Path("/update/{id}") @POST public User update(@PathParam("id") long id,
- @QueryParam("name") String name,
- @QueryParam("pwd") String pwd,
- @QueryParam("mail") String mail) {
+ @Path("/update/{id}")
+ @POST
+ public User update(@PathParam("id") long id,
+ @QueryParam("name") String name,
+ @QueryParam("pwd") String pwd,
+ @QueryParam("mail") String mail) {
return dao.update(id, name, pwd, mail);
}
}
Modified: openejb/trunk/openejb/examples/webapps/rest-example/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webapps/rest-example/src/main/resources/META-INF/persistence.xml?rev=1195054&r1=1195053&r2=1195054&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/webapps/rest-example/src/main/resources/META-INF/persistence.xml (original)
+++ openejb/trunk/openejb/examples/webapps/rest-example/src/main/resources/META-INF/persistence.xml Sat Oct 29 22:00:55 2011
@@ -17,9 +17,9 @@
limitations under the License.
-->
<persistence version="2.0"
- xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
+ xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="blog">
<jta-data-source>My DataSource</jta-data-source>
@@ -27,8 +27,8 @@
<class>org.superbiz.rest.model.User</class>
<class>org.superbiz.rest.model.Post</class>
<class>org.superbiz.rest.model.Comment</class>
- <class>org.superbiz.rest.model.Model</class>
- <class>org.superbiz.rest.model.DatedModel</class>
+ <class>org.superbiz.rest.model.Model</class>
+ <class>org.superbiz.rest.model.DatedModel</class>
<properties>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
</properties>
Modified: openejb/trunk/openejb/examples/webapps/rest-example/src/test/java/org/superbiz/rest/dao/UserDaoTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webapps/rest-example/src/test/java/org/superbiz/rest/dao/UserDaoTest.java?rev=1195054&r1=1195053&r2=1195054&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/webapps/rest-example/src/test/java/org/superbiz/rest/dao/UserDaoTest.java (original)
+++ openejb/trunk/openejb/examples/webapps/rest-example/src/test/java/org/superbiz/rest/dao/UserDaoTest.java Sat Oct 29 22:00:55 2011
@@ -16,17 +16,20 @@ import static junit.framework.Assert.ass
public class UserDaoTest {
private static EJBContainer container;
- @BeforeClass public static void start() {
+ @BeforeClass
+ public static void start() {
container = EJBContainer.createEJBContainer();
}
- @AfterClass public static void stop() {
+ @AfterClass
+ public static void stop() {
if (container != null) {
container.close();
}
}
- @Test public void create() throws NamingException {
+ @Test
+ public void create() throws NamingException {
UserDAO dao = (UserDAO) container.getContext().lookup("java:global/rest-example/UserDAO");
User user = dao.create("foo", "dummy", "foo@bar.org");
assertNotNull(dao.find(user.getId()));
Modified: openejb/trunk/openejb/examples/webapps/rest-example/src/test/java/org/superbiz/rest/dao/UserServiceTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webapps/rest-example/src/test/java/org/superbiz/rest/dao/UserServiceTest.java?rev=1195054&r1=1195053&r2=1195054&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/webapps/rest-example/src/test/java/org/superbiz/rest/dao/UserServiceTest.java (original)
+++ openejb/trunk/openejb/examples/webapps/rest-example/src/test/java/org/superbiz/rest/dao/UserServiceTest.java Sat Oct 29 22:00:55 2011
@@ -25,10 +25,12 @@ import static junit.framework.Assert.ass
* @author rmannibucau
*/
public class UserServiceTest {
+
private static EJBContainer container;
private static File webApp;
- @BeforeClass public static void start() throws IOException {
+ @BeforeClass
+ public static void start() throws IOException {
webApp = createWebApp();
Properties p = new Properties();
p.setProperty(EJBContainer.APP_NAME, "rest-example");
@@ -38,7 +40,8 @@ public class UserServiceTest {
container = EJBContainer.createEJBContainer(p);
}
- @AfterClass public static void stop() {
+ @AfterClass
+ public static void stop() {
if (container != null) {
container.close();
}
@@ -51,7 +54,8 @@ public class UserServiceTest {
}
}
- @Test public void create() throws NamingException {
+ @Test
+ public void create() throws NamingException {
UserDAO dao = (UserDAO) container.getContext().lookup("java:global/rest-example/UserDAO");
User user = dao.create("foo", "dummy", "foo@dummy.org");
assertNotNull(dao.find(user.getId()));
@@ -77,13 +81,16 @@ public class UserServiceTest {
}
/**
- * a simple copy of the unique method i want to use from my service.
- * It allows to use cxf proxy to call remotely our rest service.
- * Any other way to do it is good.
- */
+ * a simple copy of the unique method i want to use from my service.
+ * It allows to use cxf proxy to call remotely our rest service.
+ * Any other way to do it is good.
+ */
@Path("/api/user")
- @Produces({ "text/xml", "application/json" })
+ @Produces({"text/xml", "application/json"})
public static interface UserServiceClientAPI {
- @Path("/show/{id}") @GET User show(@PathParam("id") long id);
+
+ @Path("/show/{id}")
+ @GET
+ User show(@PathParam("id") long id);
}
}
Modified: openejb/trunk/openejb/examples/webservice-ws-security/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webservice-ws-security/pom.xml?rev=1195054&r1=1195053&r2=1195054&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/webservice-ws-security/pom.xml (original)
+++ openejb/trunk/openejb/examples/webservice-ws-security/pom.xml Sat Oct 29 22:00:55 2011
@@ -117,7 +117,7 @@
</goals>
<configuration>
<target name="generate keys">
- <ant antfile="create-keystores.xml" target="run" />
+ <ant antfile="create-keystores.xml" target="run"/>
</target>
</configuration>
</execution>
Modified: openejb/trunk/openejb/examples/webservice-ws-security/src/test/java/org/superbiz/calculator/CustomPasswordHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webservice-ws-security/src/test/java/org/superbiz/calculator/CustomPasswordHandler.java?rev=1195054&r1=1195053&r2=1195054&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/webservice-ws-security/src/test/java/org/superbiz/calculator/CustomPasswordHandler.java (original)
+++ openejb/trunk/openejb/examples/webservice-ws-security/src/test/java/org/superbiz/calculator/CustomPasswordHandler.java Sat Oct 29 22:00:55 2011
@@ -24,7 +24,8 @@ import javax.security.auth.callback.Unsu
import java.io.IOException;
public class CustomPasswordHandler implements CallbackHandler {
- @Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
+ @Override
+ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
if (pc.getUsage() == WSPasswordCallback.USERNAME_TOKEN) {