[jboss-cvs] JBossAS SVN: r60218 - in branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop: deprec and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Feb 2 16:28:29 EST 2007


Author: bstansberry at jboss.com
Date: 2007-02-02 16:28:29 -0500 (Fri, 02 Feb 2007)
New Revision: 60218

Added:
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/Address.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/AopBindingListener.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/Course.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/Person.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/Student.java
Log:
Test both marker-interface-based and annotation-based FIELD repl

Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/Address.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/Address.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/Address.java	2007-02-02 21:28:29 UTC (rev 60218)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.deprec;
+
+
+
+/**
+ * Test class for TreeCacheAOP.
+ * Person is a POJO that will be instrumented with CacheInterceptor
+ *
+ * @version $Revision: 59755 $
+ * annotation marker that is needed for fine-grained replication.
+ * @@org.jboss.web.tomcat.tc5.session.AopMarker
+ */
+public class Address
+{
+   String street = null;
+   String city = null;
+   int zip = 0;
+
+   public String getStreet()
+   {
+      return street;
+   }
+
+   public void setStreet(String street)
+   {
+      this.street = street;
+   }
+
+   public String getCity()
+   {
+      return city;
+   }
+
+   public void setCity(String city)
+   {
+      this.city = city;
+   }
+
+   public int getZip()
+   {
+      return zip;
+   }
+
+   public void setZip(int zip)
+   {
+      this.zip = zip;
+   }
+
+   public String toString()
+   {
+      return "street=" + getStreet() + ", city=" + getCity() + ", zip=" + getZip();
+   }
+
+//    public Object writeReplace() {
+//	return this;
+//    }
+}

Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/AopBindingListener.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/AopBindingListener.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/AopBindingListener.java	2007-02-02 21:28:29 UTC (rev 60218)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.deprec;
+
+import org.jboss.test.cluster.web.BindingListener;
+
+/**
+ * Simple BindingListener subclass that declares the AopMarker interface
+ * so it can be used in FIELD based replication tests.
+ * 
+ * @author <a href="mailto://brian.stansberry@jboss.com">Brian Stansberry</a>
+ * @version $Revision$
+ * 
+ * Annotation marker that is needed for fine-grained replication.
+ * Note that we do it in 1.4 style now so it needs annotation compiler,
+ * annotationc.
+ * @@org.jboss.web.tomcat.tc5.session.AopMarker
+ */
+public class AopBindingListener extends BindingListener
+{
+
+   /** The serialVersionUID */
+   private static final long serialVersionUID = -1163899904485318390L;
+
+   /**
+    * Create a new AopBindingListener.
+    * 
+    */
+   public AopBindingListener()
+   {
+      super();
+   }
+
+}

Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/Course.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/Course.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/Course.java	2007-02-02 21:28:29 UTC (rev 60218)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.deprec;
+
+/**
+ * @author Brian Stansberry
+ * @@org.jboss.web.tomcat.tc5.session.AopMarker
+ */
+public class Course {
+   protected String title;
+   protected String instructor;
+   protected String room;
+
+   public void setTitle(String title)
+   {
+      this.title = title;
+   }
+
+   public String getTitle()
+   {
+      return this.title;
+   }
+
+   public void setRoom(String room)
+   {
+      this.room = room;
+   }
+
+   public String getRoom()
+   {
+      return this.room;
+   }
+   
+   public void setInstructor(String instructor)
+   {
+      this.instructor = instructor;
+   }
+   
+   public String getInstructor()
+   {
+      return instructor;
+   }
+
+   public String toString()
+   {
+      StringBuffer buf = new StringBuffer();
+      buf.append("{Title = " +title).append(", Instructor = " + instructor).append(", Room = " +room + "}\n");
+
+      return buf.toString();
+   }
+   
+   public boolean equals(Object other)
+   {
+      if (this == other)
+         return true;
+         
+      if (other instanceof Course) {
+         String otherTitle = ((Course) other).getTitle();
+         return (title == otherTitle || (title != null && title.equals(otherTitle)));
+      } 
+      
+      return false;
+   }
+   
+   public int hashCode()
+   {
+      return title == null ? 0 : title.hashCode();
+   }
+}

Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/Person.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/Person.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/Person.java	2007-02-02 21:28:29 UTC (rev 60218)
@@ -0,0 +1,189 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.deprec;
+
+import java.util.*;
+
+
+/**
+ * Test class for TreeCacheAOP.
+ * Person is a POJO that will be instrumented with CacheInterceptor
+ *
+ * @version $Revision: 59755 $
+ * annotation marker that is needed for fine-grained replication.
+ * @@org.jboss.web.tomcat.tc5.session.InstanceOfAopMarker
+ */
+public class Person
+{
+   String name = null;
+   int age = 0;
+   Map hobbies = null;
+   Address address = null;
+   Set skills;
+   List languages;
+   // Test for transient field non-replication
+   transient String currentStatus = "Active";
+   // Test swapping out the Collection ref with proxy one
+   // medication will be different when age limit is exceeded.
+   List medication = null;
+   static final int AGE1 = 50;
+   static final int AGE2 = 60;
+
+   public Person() {
+
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   public void setCurrentStatus(String status) {
+      currentStatus = status;
+   }
+
+   public String getCurrentStatus() {
+      return currentStatus;
+   }
+
+   public void setName(Object obj)
+   {
+      this.name = (String)obj;
+   }
+
+   public int getAge()
+   {
+      return age;
+   }
+
+   public void setAge(int age)
+   {
+
+      this.age = age;
+
+      // This will swap out the reference dynamically
+      if(age < AGE1) {
+         if(medication != null) {
+            medication.clear();
+            medication=null;
+         }
+      }
+      else {
+         if( age >= AGE1 ) {
+            addMedication("Lipitor");
+         }
+
+         if (age >= AGE2) {
+            addMedication("Vioxx");
+         }
+      }
+
+
+   }
+
+   void addMedication(String name) {
+      if( medication == null )
+         medication = new ArrayList();
+      if(!medication.contains(name))
+         medication.add(name);
+   }
+
+   public Map getHobbies()
+   {
+      return hobbies;
+   }
+
+   public void setHobbies(Map hobbies)
+   {
+      this.hobbies = hobbies;
+   }
+
+   public Address getAddress()
+   {
+      return address;
+   }
+
+   public void setAddress(Address address)
+   {
+      this.address = address;
+   }
+
+   public Set getSkills()
+   {
+      return skills;
+   }
+
+   public void setSkills(Set skills)
+   {
+      this.skills = skills;
+   }
+
+   public List getMedication()
+   {
+      return medication;
+   }
+
+   public void setMedication(List medication)
+   {
+      this.medication = medication;
+   }
+
+   public List getLanguages()
+   {
+      return languages;
+   }
+
+   public void setLanguages(List languages)
+   {
+      this.languages = languages;
+   }
+
+   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();
+      if(medication != null)
+         sb.append(", medication=" + medication);
+      return sb.toString();
+   }
+
+   public String print(Map m)
+   {
+      StringBuffer sb = new StringBuffer();
+      Map.Entry entry;
+      if (m != null) {
+         for (Iterator it = m.entrySet().iterator(); it.hasNext();) {
+            entry = (Map.Entry) it.next();
+            sb.append(entry.getKey()).append(": ").append(entry.getValue());
+            sb.append("\n");
+         }
+      }
+      return sb.toString();
+   }
+}

Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/Student.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/Student.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/web/aop/deprec/Student.java	2007-02-02 21:28:29 UTC (rev 60218)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.deprec;
+
+import java.util.*;
+
+/**
+ * Test class for TreeCacheAOP.
+ * Student is a POJO that will be instrumented with CacheInterceptor
+ *
+ * @version $Revision: 57211 $
+ * No annotation marker needed as the superclass uses InstanceOfAopMarker.
+ */
+public class Student extends Person
+{
+   protected Set courses = new HashSet();
+   protected String school;
+
+   public void setSchool(String school)
+   {
+      this.school = school;
+   }
+
+   public String getSchool()
+   {
+      return this.school;
+   }
+
+   public void addCourse(Course course) { courses.add(course); }
+
+   public void removeCourse(Course course)
+   {
+      courses.remove(course);
+   }
+
+   public Set getCourses()
+   {
+      return Collections.unmodifiableSet(courses);
+   }
+
+   public String toString()
+   {
+      StringBuffer buf = new StringBuffer();
+      buf.append("{Name = " +name).append(", School = " +school);
+      if (address != null)
+         buf.append(", Address = " + address.toString());
+      buf.append("}\n");
+      buf.append("Courses:\n");
+      for (Iterator iter = getCourses().iterator(); iter.hasNext(); )
+         buf.append(iter.next());
+
+      return buf.toString();
+   }
+
+}




More information about the jboss-cvs-commits mailing list