[jboss-cvs] JBossAS SVN: r77550 - in trunk: testsuite/src/resources/cluster/http/http-field and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 27 17:10:46 EDT 2008


Author: bstansberry at jboss.com
Date: 2008-08-27 17:10:45 -0400 (Wed, 27 Aug 2008)
New Revision: 77550

Added:
   trunk/testsuite/src/main/org/jboss/test/cluster/web/aop/Color.java
Modified:
   trunk/testsuite/src/main/org/jboss/test/cluster/web/aop/Person.java
   trunk/testsuite/src/resources/cluster/http/http-field/getAttribute.jsp
   trunk/testsuite/src/resources/cluster/http/http-field/modifyAttribute.jsp
   trunk/tomcat/src/resources/META-INF/jboss-aop.xml
Log:
[JBAS-5793] Array interception for pojos stored in FIELD granularity web sessions

Added: trunk/testsuite/src/main/org/jboss/test/cluster/web/aop/Color.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/web/aop/Color.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/web/aop/Color.java	2008-08-27 21:10:45 UTC (rev 77550)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.test.cluster.web.aop;
+
+import java.io.Serializable;
+
+/**
+ * @author Brian Stansberry
+ *
+ */
+public class Color implements Serializable
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 1L;
+   
+   private String name;
+   
+   public Color(String name)
+   {
+      if (name == null)
+         throw new IllegalArgumentException("name cannot be null");
+      
+      this.name = name;
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      return (obj instanceof Color && ((Color) obj).name.equals(this.name));
+   }
+
+   @Override
+   public int hashCode()
+   {
+      return name.hashCode();
+   }
+
+   @Override
+   public String toString()
+   {
+      return "Color{" + name + "}";
+   }
+   
+}

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/web/aop/Person.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/web/aop/Person.java	2008-08-27 21:03:55 UTC (rev 77549)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/web/aop/Person.java	2008-08-27 21:10:45 UTC (rev 77550)
@@ -21,7 +21,11 @@
   */
 package org.jboss.test.cluster.web.aop;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import org.jboss.cache.pojo.annotation.Replicable;
 
@@ -46,11 +50,12 @@
    // Test swapping out the Collection ref with proxy one
    // medication will be different when age limit is exceeded.
    List medication = null;
+   Color[] favoriteColors = new Color[2];
    static final int AGE1 = 50;
    static final int AGE2 = 60;
 
    public Person() {
-
+      addFavoriteColor("Blue");
    }
 
    public String getName()
@@ -162,13 +167,51 @@
    {
       this.languages = languages;
    }
+   
+   public String getFavoriteColors()
+   {
+      StringBuilder sb = new StringBuilder();
+      boolean wrote = false;
+      for (Color color : favoriteColors)
+      {
+         if (color != null)
+         {
+            if (wrote)
+               sb.append(',');
+            sb.append(color);
+            wrote = true;
+         }
+         else
+         {
+            break;
+         }
+      }
+      
+      return sb.toString();
+   }
+   
+   public void addFavoriteColor(String color)
+   {
+      Color newColor = new Color(color);
+      Color oldFavorite = favoriteColors[0];
+      if (oldFavorite == null)
+      {
+         favoriteColors[0] = newColor;
+      }
+      else if (newColor.equals(oldFavorite) == false)
+      {
+         favoriteColors[1] = oldFavorite;
+         favoriteColors[0] = newColor;
+      }
+   }
 
    public String toString()
    {
       StringBuffer sb=new StringBuffer();
       sb.append("name=").append(getName()).append(", age=").append(getAge()).append(", hobbies=")
             .append(print(getHobbies())).append(", address=").append(getAddress()).append(", skills=")
-            .append(skills).append(", languages=").append(languages).toString();
+            .append(skills).append(", languages=").append(languages)
+            .append(", favoriteColors=").append(getFavoriteColors()).toString();
       if(medication != null)
          sb.append(", medication=" + medication);
       return sb.toString();

Modified: trunk/testsuite/src/resources/cluster/http/http-field/getAttribute.jsp
===================================================================
--- trunk/testsuite/src/resources/cluster/http/http-field/getAttribute.jsp	2008-08-27 21:03:55 UTC (rev 77549)
+++ trunk/testsuite/src/resources/cluster/http/http-field/getAttribute.jsp	2008-08-27 21:10:45 UTC (rev 77550)
@@ -25,3 +25,4 @@
 <%=joe.getName() %>
 <%=addr.getZip() %>
 <%=joe.getLanguages() %>
+<%=joe.getFavoriteColors() %>

Modified: trunk/testsuite/src/resources/cluster/http/http-field/modifyAttribute.jsp
===================================================================
--- trunk/testsuite/src/resources/cluster/http/http-field/modifyAttribute.jsp	2008-08-27 21:03:55 UTC (rev 77549)
+++ trunk/testsuite/src/resources/cluster/http/http-field/modifyAttribute.jsp	2008-08-27 21:10:45 UTC (rev 77550)
@@ -16,4 +16,5 @@
    lang.add("English");
    lang.add("Holo");
    ben.setLanguages(lang);
+   ben.addFavoriteColor("Red");
 %>

Modified: trunk/tomcat/src/resources/META-INF/jboss-aop.xml
===================================================================
--- trunk/tomcat/src/resources/META-INF/jboss-aop.xml	2008-08-27 21:03:55 UTC (rev 77549)
+++ trunk/tomcat/src/resources/META-INF/jboss-aop.xml	2008-08-27 21:10:45 UTC (rev 77550)
@@ -13,7 +13,6 @@
       
    <!-- Array support -->
    <!-- Comment entire section to disable -->
-   <!--  Currently disabled pending upgrade to PojoCache 2.2.0 where this is supported
    <arrayreplacement expr="class($instanceof{@org.jboss.cache.pojo.annotation.Replicable})"/>
    <interceptor name="pojocache-array" class="org.jboss.cache.pojo.interceptors.dynamic.ArrayInterceptor"/>
    <introduction expr="class($instanceof{@org.jboss.cache.pojo.annotation.Replicable})">
@@ -22,6 +21,5 @@
    <arraybind name="pojocache-array" type="READ_WRITE">
       <interceptor-ref name="pojocache-array"/>
    </arraybind>
-   -->
    
 </aop>




More information about the jboss-cvs-commits mailing list