struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hus...@apache.org
Subject svn commit: r599722 - in /struts/sandbox/trunk/jpa-mailreader/src: main/java/action/ main/java/action/user/ main/java/action/user/subscription/ main/java/entity/ main/java/entity/protocol/ main/java/entity/subscription/ main/java/entity/user/ main/java...
Date Fri, 30 Nov 2007 07:54:50 GMT
Author: husted
Date: Thu Nov 29 23:54:47 2007
New Revision: 599722

URL: http://svn.apache.org/viewvc?rev=599722&view=rev
Log:
WW-1399 Decommission the webservice annotations for now. Rename EntityHelpers to EntityServices
to clarify role.

Added:
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/EntityService.java
      - copied, changed from r599470, struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/EntityHelper.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolService.java
      - copied, changed from r599470, struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolHelper.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolServiceImpl.java
      - copied, changed from r599470, struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolHelperImpl.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionService.java
      - copied, changed from r599470, struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionHelper.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionServiceImpl.java
      - copied, changed from r599470, struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionHelperImpl.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserService.java
      - copied, changed from r599470, struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserHelper.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserServiceImpl.java
      - copied, changed from r599470, struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserHelperImpl.java
    struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/EntityServiceTest.java
      - copied, changed from r599470, struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/EntityHelperTest.java
    struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/ProtocolServiceTest.java
    struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/SubscriptionServiceTest.java
    struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/UserServiceTest.java
      - copied, changed from r599470, struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/UserHelperTest.java
Removed:
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/EntityHelper.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolHelper.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolHelperImpl.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionHelper.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionHelperImpl.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserHelper.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserHelperImpl.java
    struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/EntityHelperTest.java
    struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/UserHelperTest.java
Modified:
    struts/sandbox/trunk/jpa-mailreader/src/main/java/action/Index.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/action/user/Create.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/action/user/Index.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/action/user/subscription/Index.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/EntityInterceptor.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/Protocol.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolTypeConverter.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionTypeConverter.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserTypeConverter.java
    struts/sandbox/trunk/jpa-mailreader/src/main/java/hello/Message.java
    struts/sandbox/trunk/jpa-mailreader/src/test/java/action/BootstrapDataTest.java
    struts/sandbox/trunk/jpa-mailreader/src/test/java/action/user/autenticateTest.java
    struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/EntityManagerHelperTest.java
    struts/sandbox/trunk/jpa-mailreader/src/test/java/hello/MessageTest.java

Modified: struts/sandbox/trunk/jpa-mailreader/src/main/java/action/Index.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/main/java/action/Index.java?rev=599722&r1=599721&r2=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/main/java/action/Index.java (original)
+++ struts/sandbox/trunk/jpa-mailreader/src/main/java/action/Index.java Thu Nov 29 23:54:47
2007
@@ -23,12 +23,14 @@
 
 import javax.persistence.EntityManager;
 
+import org.apache.struts2.config.ParentPackage;
 import org.apache.struts2.interceptor.SessionAware;
+
 import com.opensymphony.xwork2.ActionSupport;
 import com.opensymphony.xwork2.conversion.annotations.Conversion;
 import com.opensymphony.xwork2.conversion.annotations.ConversionType;
 import com.opensymphony.xwork2.conversion.annotations.TypeConversion;
-import org.apache.struts2.config.ParentPackage;
+
 import entity.EntityAware;
 
 /**

Modified: struts/sandbox/trunk/jpa-mailreader/src/main/java/action/user/Create.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/main/java/action/user/Create.java?rev=599722&r1=599721&r2=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/main/java/action/user/Create.java (original)
+++ struts/sandbox/trunk/jpa-mailreader/src/main/java/action/user/Create.java Thu Nov 29 23:54:47
2007
@@ -21,6 +21,7 @@
 import org.apache.struts2.config.Result;
 import org.apache.struts2.config.Results;
 import org.apache.struts2.dispatcher.ServletActionRedirectResult;
+
 import com.opensymphony.xwork2.validator.annotations.EmailValidator;
 import com.opensymphony.xwork2.validator.annotations.ExpressionValidator;
 import com.opensymphony.xwork2.validator.annotations.RequiredStringValidator;

Modified: struts/sandbox/trunk/jpa-mailreader/src/main/java/action/user/Index.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/main/java/action/user/Index.java?rev=599722&r1=599721&r2=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/main/java/action/user/Index.java (original)
+++ struts/sandbox/trunk/jpa-mailreader/src/main/java/action/user/Index.java Thu Nov 29 23:54:47
2007
@@ -21,8 +21,8 @@
 import org.apache.struts2.config.ParentPackage;
 
 import entity.user.User;
-import entity.user.UserHelperImpl;
-import entity.user.UserHelper;
+import entity.user.UserService;
+import entity.user.UserServiceImpl;
 
 @ParentPackage("entity-default")
 public class Index extends action.Index {
@@ -45,7 +45,7 @@
 
     // ---- PROPERTIES ----
 
-    private UserHelper manager;
+    private UserService manager;
 
     private User user;
 
@@ -137,7 +137,7 @@
      * </p>
      */
     public Index() {
-        manager = new UserHelperImpl();
+        manager = new UserServiceImpl();
     }
 
     /**
@@ -148,7 +148,7 @@
      * @param manager
      *            IUserManager instance
      */
-    public Index(UserHelper manager) {
+    public Index(UserService manager) {
         this.manager = manager;
     }
 

Modified: struts/sandbox/trunk/jpa-mailreader/src/main/java/action/user/subscription/Index.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/main/java/action/user/subscription/Index.java?rev=599722&r1=599721&r2=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/main/java/action/user/subscription/Index.java
(original)
+++ struts/sandbox/trunk/jpa-mailreader/src/main/java/action/user/subscription/Index.java
Thu Nov 29 23:54:47 2007
@@ -26,16 +26,16 @@
 import org.apache.struts2.dispatcher.ServletActionRedirectResult;
 
 import com.opensymphony.xwork2.Preparable;
-import com.opensymphony.xwork2.validator.annotations.RequiredStringValidator;
 import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator;
+import com.opensymphony.xwork2.validator.annotations.RequiredStringValidator;
 import com.opensymphony.xwork2.validator.annotations.Validation;
 import com.opensymphony.xwork2.validator.annotations.Validations;
 
-import entity.protocol.ProtocolHelperImpl;
-import entity.protocol.ProtocolHelper;
+import entity.protocol.ProtocolService;
+import entity.protocol.ProtocolServiceImpl;
 import entity.subscription.Subscription;
-import entity.subscription.SubscriptionHelperImpl;
-import entity.subscription.SubscriptionHelper;
+import entity.subscription.SubscriptionService;
+import entity.subscription.SubscriptionServiceImpl;
 import entity.user.User;
 
 @Results( {
@@ -56,9 +56,9 @@
 
     protected static final String ERROR_HOST_UNIQUE = "error.host.unique";
 
-    protected SubscriptionHelper manager;
-    
-    private ProtocolHelper protocolManager;
+    protected SubscriptionService manager;
+
+    private ProtocolService protocolManager;
 
     private Map<String, String> protocols;
 
@@ -162,8 +162,8 @@
      * </p>
      */
     public Index() {
-        manager = new SubscriptionHelperImpl();
-        protocolManager = new ProtocolHelperImpl();
+        manager = new SubscriptionServiceImpl();
+        protocolManager = new ProtocolServiceImpl();
     }
 
     /**
@@ -175,7 +175,7 @@
      * @param manager
      *            IUserManager instance
      */
-    public Index(SubscriptionHelper manager, ProtocolHelper protocolManager) {
+    public Index(SubscriptionService manager, ProtocolService protocolManager) {
         this.manager = manager;
         this.protocolManager = protocolManager;
     }

Modified: struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/EntityInterceptor.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/EntityInterceptor.java?rev=599722&r1=599721&r2=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/EntityInterceptor.java (original)
+++ struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/EntityInterceptor.java Thu Nov
29 23:54:47 2007
@@ -20,6 +20,7 @@
 
 import javax.persistence.EntityManager;
 import javax.persistence.PersistenceException;
+
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
 

Copied: struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/EntityService.java (from
r599470, struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/EntityHelper.java)
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/EntityService.java?p2=struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/EntityService.java&p1=struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/EntityHelper.java&r1=599470&r2=599722&rev=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/EntityHelper.java (original)
+++ struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/EntityService.java Thu Nov 29
23:54:47 2007
@@ -19,6 +19,7 @@
 package entity;
 
 import java.util.List;
+
 import javax.persistence.EntityManager;
 import javax.persistence.NoResultException;
 import javax.persistence.PersistenceException;
@@ -40,9 +41,15 @@
  * tearDown methods of a TestCase. See <code>EntityInterceptor</code> for an
  * example.
  * </p>
+ * <p>
+ * In extending this service class, or other service classes, we should avoid 
+ * the <a href="http://www.martinfowler.com/bliki/AnemicDomainModel.html">
+ * Anemic Domain Model anti-pattern</a>, and keep both business logic and 
+ * business state in the Entity objects. 
+ * </p>
  * 
  */
-public class EntityHelper {
+public class EntityService {
 
     public Object createEntity(Object value) throws PersistenceException {
         EntityManager manager = EntityManagerHelper.getEntityManager();

Modified: struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/Protocol.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/Protocol.java?rev=599722&r1=599721&r2=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/Protocol.java (original)
+++ struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/Protocol.java Thu Nov
29 23:54:47 2007
@@ -19,10 +19,12 @@
 package entity.protocol;
 
 import java.io.Serializable;
+
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
+
 import entity.UuidEntity;
 
 /**

Copied: struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolService.java
(from r599470, struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolHelper.java)
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolService.java?p2=struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolService.java&p1=struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolHelper.java&r1=599470&r2=599722&rev=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolHelper.java
(original)
+++ struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolService.java
Thu Nov 29 23:54:47 2007
@@ -21,7 +21,6 @@
 import java.util.List;
 import java.util.Map;
 
-import javax.jws.WebService;
 import javax.persistence.PersistenceException;
 
 /**
@@ -30,8 +29,8 @@
  * object.
  * <p>
  */
-@WebService
-public interface ProtocolHelper {
+// @WebService
+public interface ProtocolService {
 
     /**
      * <p>

Copied: struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolServiceImpl.java
(from r599470, struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolHelperImpl.java)
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolServiceImpl.java?p2=struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolServiceImpl.java&p1=struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolHelperImpl.java&r1=599470&r2=599722&rev=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolHelperImpl.java
(original)
+++ struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolServiceImpl.java
Thu Nov 29 23:54:47 2007
@@ -23,20 +23,19 @@
 import java.util.List;
 import java.util.Map;
 
-import javax.jws.WebService;
 import javax.persistence.EntityManager;
 import javax.persistence.PersistenceException;
 
+import entity.EntityService;
 import entity.EntityManagerHelper;
-import entity.EntityHelper;
 
 /**
  * <p>
  * Default JPA implementation of <code>ProtocolHelper</code>.
  * </p>
  */
-@WebService(serviceName = "protocol", endpointInterface = "entity.protocol.ProtocolHelper")
-public class ProtocolHelperImpl extends EntityHelper implements ProtocolHelper {
+// @WebService(serviceName = "protocol", endpointInterface = "entity.protocol.ProtocolService")
+public class ProtocolServiceImpl extends EntityService implements ProtocolService {
 
     public int count() throws PersistenceException {
         Long count = (Long) singleResult(Protocol.COUNT, null, null);

Modified: struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolTypeConverter.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolTypeConverter.java?rev=599722&r1=599721&r2=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolTypeConverter.java
(original)
+++ struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/protocol/ProtocolTypeConverter.java
Thu Nov 29 23:54:47 2007
@@ -31,11 +31,11 @@
 public class ProtocolTypeConverter extends StrutsTypeConverter {
 
     /**
-     * Retrieve the corresponding <code>Protocol</code>
-     * entity from the persistence database, given a String ID.
+     * Retrieve the corresponding <code>Protocol</code> entity from the
+     * persistence database, given a String ID.
      */
     public Object convertFromString(Map context, String[] values, Class toClass) {
-        ProtocolHelper manager = new ProtocolHelperImpl();
+        ProtocolService manager = new ProtocolServiceImpl();
         String id = values[0];
         Protocol target = manager.find(id);
         return target;

Copied: struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionService.java
(from r599470, struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionHelper.java)
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionService.java?p2=struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionService.java&p1=struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionHelper.java&r1=599470&r2=599722&rev=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionHelper.java
(original)
+++ struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionService.java
Thu Nov 29 23:54:47 2007
@@ -18,7 +18,6 @@
  */
 package entity.subscription;
 
-import javax.jws.WebService;
 import javax.persistence.PersistenceException;
 
 /**
@@ -27,8 +26,8 @@
  * object.
  * </p>
  */
-@WebService
-public interface SubscriptionHelper {
+// @WebService
+public interface SubscriptionService {
 
     /**
      * <p>

Copied: struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionServiceImpl.java
(from r599470, struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionHelperImpl.java)
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionServiceImpl.java?p2=struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionServiceImpl.java&p1=struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionHelperImpl.java&r1=599470&r2=599722&rev=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionHelperImpl.java
(original)
+++ struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionServiceImpl.java
Thu Nov 29 23:54:47 2007
@@ -18,11 +18,10 @@
  */
 package entity.subscription;
 
-import javax.jws.WebService;
 import javax.persistence.EntityManager;
 import javax.persistence.PersistenceException;
 
-import entity.EntityHelper;
+import entity.EntityService;
 import entity.EntityManagerHelper;
 
 /**
@@ -30,9 +29,9 @@
  * Default JPA implementation of <code>UserHelper</code>.
  * </p>
  */
-@WebService(serviceName = "subscription", endpointInterface = "entity.subscription.SubscriptionHelper")
-public class SubscriptionHelperImpl extends EntityHelper implements
-        SubscriptionHelper {
+// @WebService(serviceName = "subscription", endpointInterface = "entity.subscription.SubscriptionService")
+public class SubscriptionServiceImpl extends EntityService implements
+        SubscriptionService {
 
     public int count() throws PersistenceException {
         Long count = (Long) singleResult(Subscription.COUNT, null, null);

Modified: struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionTypeConverter.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionTypeConverter.java?rev=599722&r1=599721&r2=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionTypeConverter.java
(original)
+++ struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/subscription/SubscriptionTypeConverter.java
Thu Nov 29 23:54:47 2007
@@ -19,6 +19,7 @@
 package entity.subscription;
 
 import java.util.Map;
+
 import org.apache.struts2.util.StrutsTypeConverter;
 
 /**
@@ -31,11 +32,11 @@
 public class SubscriptionTypeConverter extends StrutsTypeConverter {
 
     /**
-     * Retrieve the corresponding <code>Subscription</code>
-     * entity from the persistence database, fiven a host name.
+     * Retrieve the corresponding <code>Subscription</code> entity from the
+     * persistence database, fiven a host name.
      */
     public Object convertFromString(Map context, String[] values, Class toClass) {
-        SubscriptionHelper manager = new SubscriptionHelperImpl();
+        SubscriptionService manager = new SubscriptionServiceImpl();
         String name = String.valueOf(values[0]);
         Subscription result = manager.findByName(name);
         return result;

Copied: struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserService.java (from
r599470, struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserHelper.java)
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserService.java?p2=struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserService.java&p1=struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserHelper.java&r1=599470&r2=599722&rev=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserHelper.java (original)
+++ struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserService.java Thu Nov
29 23:54:47 2007
@@ -19,7 +19,6 @@
 package entity.user;
 
 import javax.persistence.PersistenceException;
-import javax.jws.WebService;
 
 /**
  * <p>
@@ -27,8 +26,8 @@
  * </p>
  * 
  */
-@WebService
-public interface UserHelper {
+// @WebService
+public interface UserService {
 
     /**
      * <p>

Copied: struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserServiceImpl.java
(from r599470, struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserHelperImpl.java)
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserServiceImpl.java?p2=struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserServiceImpl.java&p1=struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserHelperImpl.java&r1=599470&r2=599722&rev=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserHelperImpl.java (original)
+++ struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserServiceImpl.java Thu
Nov 29 23:54:47 2007
@@ -19,16 +19,16 @@
 package entity.user;
 
 import javax.persistence.PersistenceException;
-import entity.EntityHelper;
-import javax.jws.WebService;
+
+import entity.EntityService;
 
 /**
  * <p>
  * Default JPA implementation of <code>UserHelper</code>.
  * </p>
  */
-@WebService(serviceName = "user", endpointInterface = "entity.user.UserHelper")
-public class UserHelperImpl extends EntityHelper implements UserHelper {
+// @WebService(serviceName = "user", endpointInterface = "entity.user.UserSession")
+public class UserServiceImpl extends EntityService implements UserService {
 
     public int count() throws PersistenceException {
         Long count = (Long) singleResult(User.COUNT, null, null);

Modified: struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserTypeConverter.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserTypeConverter.java?rev=599722&r1=599721&r2=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserTypeConverter.java (original)
+++ struts/sandbox/trunk/jpa-mailreader/src/main/java/entity/user/UserTypeConverter.java Thu
Nov 29 23:54:47 2007
@@ -19,6 +19,7 @@
 package entity.user;
 
 import java.util.Map;
+
 import org.apache.struts2.util.StrutsTypeConverter;
 
 /**
@@ -36,7 +37,7 @@
      * </p>
      */
     public Object convertFromString(Map context, String[] values, Class toClass) {
-        UserHelper manager = new UserHelperImpl();
+        UserService manager = new UserServiceImpl();
         String name = values[0];
         User result = manager.findByName(name);
         return result;

Modified: struts/sandbox/trunk/jpa-mailreader/src/main/java/hello/Message.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/main/java/hello/Message.java?rev=599722&r1=599721&r2=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/main/java/hello/Message.java (original)
+++ struts/sandbox/trunk/jpa-mailreader/src/main/java/hello/Message.java Thu Nov 29 23:54:47
2007
@@ -8,11 +8,8 @@
 import javax.persistence.NamedQuery;
 import javax.persistence.OneToOne;
 
-import entity.user.User;
-
 @Entity(name = "APP_MESSAGE")
-@NamedQueries({
-        @NamedQuery(name = Message.COUNT, query = Message.COUNT_QUERY) })
+@NamedQueries( { @NamedQuery(name = Message.COUNT, query = Message.COUNT_QUERY) })
 public class Message {
 
     public static final String COUNT = "Message.COUNT";
@@ -21,33 +18,41 @@
     @Id
     @GeneratedValue
     private Long id;
+
     public Long getId() {
         return id;
     }
+
     void setId(Long value) {
         id = value;
-    }    
-    
+    }
+
     private String text;
+
     public String getText() {
         return text;
     }
+
     public void setText(String value) {
         text = value;
     }
 
-    @OneToOne(cascade=CascadeType.ALL)
-    private Message message;    
+    @OneToOne(cascade = CascadeType.ALL)
+    private Message message;
+
     public Message getNextMessage() {
         return message;
     }
+
     public void setNextMessage(Message value) {
         message = value;
     }
-    
-    Message() {}
+
+    Message() {
+    }
+
     public Message(String value) {
         text = value;
     }
-    
+
 }

Modified: struts/sandbox/trunk/jpa-mailreader/src/test/java/action/BootstrapDataTest.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/test/java/action/BootstrapDataTest.java?rev=599722&r1=599721&r2=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/test/java/action/BootstrapDataTest.java (original)
+++ struts/sandbox/trunk/jpa-mailreader/src/test/java/action/BootstrapDataTest.java Thu Nov
29 23:54:47 2007
@@ -25,12 +25,11 @@
 import javax.persistence.EntityManager;
 import javax.persistence.EntityTransaction;
 
+import junit.framework.TestCase;
 import entity.EntityManagerHelper;
 import entity.protocol.Protocol;
 import entity.subscription.Subscription;
 import entity.user.User;
-
-import junit.framework.TestCase;
 
 public class BootstrapDataTest extends TestCase {
 

Modified: struts/sandbox/trunk/jpa-mailreader/src/test/java/action/user/autenticateTest.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/test/java/action/user/autenticateTest.java?rev=599722&r1=599721&r2=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/test/java/action/user/autenticateTest.java (original)
+++ struts/sandbox/trunk/jpa-mailreader/src/test/java/action/user/autenticateTest.java Thu
Nov 29 23:54:47 2007
@@ -2,16 +2,16 @@
 
 import junit.framework.TestCase;
 import entity.user.User;
-import entity.user.UserHelper;
-import entity.user.UserHelperImpl;
+import entity.user.UserService;
+import entity.user.UserServiceImpl;
 
 public class autenticateTest extends TestCase {
 
-    UserHelper helper;
+    UserService helper;
 
     public void setUp() throws Exception {
         super.setUp();
-        helper = new UserHelperImpl();
+        helper = new UserServiceImpl();
     }
 
     private boolean authenticate(String username, String password) {

Modified: struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/EntityManagerHelperTest.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/EntityManagerHelperTest.java?rev=599722&r1=599721&r2=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/EntityManagerHelperTest.java
(original)
+++ struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/EntityManagerHelperTest.java
Thu Nov 29 23:54:47 2007
@@ -1,6 +1,7 @@
 package entity;
 
 import javax.persistence.EntityManager;
+
 import junit.framework.TestCase;
 
 public class EntityManagerHelperTest extends TestCase {

Copied: struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/EntityServiceTest.java (from
r599470, struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/EntityHelperTest.java)
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/EntityServiceTest.java?p2=struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/EntityServiceTest.java&p1=struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/EntityHelperTest.java&r1=599470&r2=599722&rev=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/EntityHelperTest.java (original)
+++ struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/EntityServiceTest.java Thu Nov
29 23:54:47 2007
@@ -8,7 +8,7 @@
  * </p>
  *
  */
-public class EntityHelperTest extends TestCase {
+public class EntityServiceTest extends TestCase {
 
     UuidEntity entity;
     UuidEntity entity2;

Added: struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/ProtocolServiceTest.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/ProtocolServiceTest.java?rev=599722&view=auto
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/ProtocolServiceTest.java (added)
+++ struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/ProtocolServiceTest.java Thu
Nov 29 23:54:47 2007
@@ -0,0 +1,18 @@
+package entity;
+
+import junit.framework.TestCase;
+import entity.protocol.ProtocolService;
+import entity.protocol.ProtocolServiceImpl;
+
+public class ProtocolServiceTest extends TestCase {
+
+    protected ProtocolService helper;
+    int beforeCount = 0;
+
+    public void setUp() throws Exception {
+        super.setUp();
+        helper = new ProtocolServiceImpl();
+        beforeCount = helper.count();
+    }
+
+}

Added: struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/SubscriptionServiceTest.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/SubscriptionServiceTest.java?rev=599722&view=auto
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/SubscriptionServiceTest.java
(added)
+++ struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/SubscriptionServiceTest.java
Thu Nov 29 23:54:47 2007
@@ -0,0 +1,18 @@
+package entity;
+
+import junit.framework.TestCase;
+import entity.subscription.SubscriptionService;
+import entity.subscription.SubscriptionServiceImpl;
+
+public class SubscriptionServiceTest extends TestCase {
+
+    protected SubscriptionService helper;
+    int beforeCount = 0;
+
+    public void setUp() throws Exception {
+        super.setUp();
+        helper = new SubscriptionServiceImpl();
+        beforeCount = helper.count();
+    }
+
+}

Copied: struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/UserServiceTest.java (from
r599470, struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/UserHelperTest.java)
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/UserServiceTest.java?p2=struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/UserServiceTest.java&p1=struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/UserHelperTest.java&r1=599470&r2=599722&rev=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/UserHelperTest.java (original)
+++ struts/sandbox/trunk/jpa-mailreader/src/test/java/entity/UserServiceTest.java Thu Nov
29 23:54:47 2007
@@ -8,21 +8,21 @@
 import javax.persistence.Query;
 
 import entity.protocol.Protocol;
-import entity.protocol.ProtocolHelper;
-import entity.protocol.ProtocolHelperImpl;
+import entity.protocol.ProtocolService;
+import entity.protocol.ProtocolServiceImpl;
 import entity.subscription.Subscription;
 import entity.user.User;
-import entity.user.UserHelper;
-import entity.user.UserHelperImpl;
+import entity.user.UserService;
+import entity.user.UserServiceImpl;
 
-public class UserHelperTest extends EntityTestCase {
+public class UserServiceTest extends EntityTestCase {
 
-    protected UserHelper helper;
+    protected UserService helper;
     int beforeCount = 0;
 
     public void setUp() throws Exception {
         super.setUp();
-        helper = new UserHelperImpl();
+        helper = new UserServiceImpl();
         beforeCount = helper.count();
     }
 
@@ -56,7 +56,7 @@
     }
 
     private List<Subscription> getSubscriptions(User user) {
-        ProtocolHelper protocolManager = new ProtocolHelperImpl();
+        ProtocolService protocolManager = new ProtocolServiceImpl();
         boolean autoConnect = false;
         List<Protocol> protocols = protocolManager.findAll();
         int protocolMax = protocols.size();
@@ -82,6 +82,8 @@
         helper.update(user);
         assertTrue("Expected ID", user.getId() != null);
         assertTrue(user.getSubscriptions() != null);
+        String qname =user.getQualifiedName(); 
+        assertTrue(qname !=null);
     }
 
     public void testCreateDelete() throws Exception {

Modified: struts/sandbox/trunk/jpa-mailreader/src/test/java/hello/MessageTest.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/jpa-mailreader/src/test/java/hello/MessageTest.java?rev=599722&r1=599721&r2=599722&view=diff
==============================================================================
--- struts/sandbox/trunk/jpa-mailreader/src/test/java/hello/MessageTest.java (original)
+++ struts/sandbox/trunk/jpa-mailreader/src/test/java/hello/MessageTest.java Thu Nov 29 23:54:47
2007
@@ -1,12 +1,10 @@
 package hello;
 
 import javax.persistence.EntityManager;
-import javax.persistence.PersistenceException;
 import javax.persistence.Query;
 
-import entity.EntityManagerHelper;
-import entity.user.User;
 import junit.framework.TestCase;
+import entity.EntityManagerHelper;
 
 public class MessageTest extends TestCase {
 
@@ -15,60 +13,80 @@
     protected void setUp() throws Exception {
         super.setUp();
         manager = EntityManagerHelper.getEntityManager();
-        EntityManagerHelper.beginTransaction();        
+        EntityManagerHelper.beginTransaction();
     }
 
     protected void tearDown() throws Exception {
         super.tearDown();
         EntityManagerHelper.commit();
-        EntityManagerHelper.closeEntityManager();        
-    }    
-    
+        EntityManagerHelper.closeEntityManager();
+    }
+
     public int count() throws Exception {
-        final String COUNT_QUERY = "SELECT COUNT(*) FROM APP_MESSAGE";        
-        Query query = manager.createQuery(COUNT_QUERY);        
+        final String COUNT_QUERY = "SELECT COUNT(*) FROM APP_MESSAGE";
+        Query query = manager.createQuery(COUNT_QUERY);
         Long count = (Long) query.getSingleResult();
         int result = count.intValue();
         return result;
-    }    
-    
-    public void testMessage() throws Exception {
+    }
+
+    public void testCreateMessage() throws Exception {
         final String MESSAGE = "Hello World!";
-        
+
         Message message = new Message(MESSAGE);
-        
+
         String text = message.getText();
-        assertEquals(MESSAGE,text);
-        
+        assertEquals(MESSAGE, text);
+
         manager.persist(message);
     }
-    
-    public void testNextMessage() throws Exception {
+
+    public void testCreateWithNextMessage() throws Exception {
         final String MESSAGE = "Greeting Earthling!";
-        final String NEXT_MESSAGE = "Take me to your leader.";        
+        final String NEXT_MESSAGE = "Take me to your leader.";
 
         Message message = new Message(MESSAGE);
-        Message next_message = new Message(NEXT_MESSAGE);       
+        Message next_message = new Message(NEXT_MESSAGE);
         message.setNextMessage(next_message);
-        
+
         String text = message.getText();
         assertEquals(MESSAGE, text);
         String next_text = message.getNextMessage().getText();
         assertEquals(NEXT_MESSAGE, next_text);
 
         int beginCount = count();
-            manager.persist(message);
+        manager.persist(message);
         int endCount = count();
-        assertTrue("Expected count to increase!",endCount>beginCount);
+        assertTrue("Expected count to increase!", endCount > beginCount);
+    }
+
+    public void testUpdate() throws Exception {
+        final String MESSAGE = "Update me!";
+        final String UPDATE = "Hey! I've been updated!";
+        
+        Message message = new Message(MESSAGE);
+        manager.persist(message);
+        manager.flush();        
+
+        Long id = message.getId(); 
+        Message update = manager.find(Message.class, id);        
+        assertSame("Expected same instance",message,update);
+        
+        update.setText(UPDATE);
+        manager.flush();
+        
+        Message result = manager.find(Message.class, id);
+        assertEquals(UPDATE,result.getText());        
     }
     
-    public void testInsertDelete() throws Exception {       
-        Message message = new Message("Delete me");
+    public void testCreateDelete() throws Exception {
+        final String MESSAGE = "Delete me!";
+        Message message = new Message(MESSAGE);
         int beginCount = count();
         manager.persist(message);
         manager.flush();
         int endCount = count();
-        assertTrue(endCount>beginCount);
+        assertTrue(endCount > beginCount);
         manager.remove(message);
         manager.flush();
         int finalCount = count();



Mime
View raw message