[jboss-cvs] JBossAS SVN: r60100 - in branches/Branch_4_2/testsuite: src/main/org/jboss/test/cmp2 and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jan 29 05:28:08 EST 2007


Author: alex.loubyansky at jboss.com
Date: 2007-01-29 05:28:08 -0500 (Mon, 29 Jan 2007)
New Revision: 60100

Added:
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/cmp2/partitionindex/
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/cmp2/partitionindex/ABean.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/cmp2/partitionindex/ALocal.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/cmp2/partitionindex/ALocalHome.java
   branches/Branch_4_2/testsuite/src/main/org/jboss/test/cmp2/partitionindex/PartitionIndexUnitTestCase.java
   branches/Branch_4_2/testsuite/src/resources/cmp2/partitionindex/
   branches/Branch_4_2/testsuite/src/resources/cmp2/partitionindex/META-INF/
   branches/Branch_4_2/testsuite/src/resources/cmp2/partitionindex/META-INF/ejb-jar.xml
   branches/Branch_4_2/testsuite/src/resources/cmp2/partitionindex/META-INF/jboss.xml
   branches/Branch_4_2/testsuite/src/resources/cmp2/partitionindex/META-INF/jbosscmp-jdbc.xml
Modified:
   branches/Branch_4_2/testsuite/imports/sections/cmp.xml
Log:
testcase for JBAS-4033

Modified: branches/Branch_4_2/testsuite/imports/sections/cmp.xml
===================================================================
--- branches/Branch_4_2/testsuite/imports/sections/cmp.xml	2007-01-29 10:20:34 UTC (rev 60099)
+++ branches/Branch_4_2/testsuite/imports/sections/cmp.xml	2007-01-29 10:28:08 UTC (rev 60100)
@@ -454,5 +454,17 @@
          </fileset>
       </jar>
 
+      <!-- build cmp2-paritionindex.jar -->
+      <jar destfile="${build.lib}/cmp2-partitionindex.jar">
+         <fileset dir="${build.classes}">
+            <patternset refid="common.test.client.classes"/>
+            <include name="org/jboss/test/cmp2/partitionindex/**"/>
+         </fileset>
+         <fileset dir="${build.resources}/cmp2/partitionindex">
+            <include name="**/*.*"/>
+         </fileset>
+         <zipfileset src="${jboss.test.lib}/jboss-test.jar" includes="org/jboss/**/*.*"/>
+         <zipfileset src="${junit.junit.lib}/junit.jar" includes="junit/**/*.*"/>
+      </jar>
    </target>
 </project>

Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cmp2/partitionindex/ABean.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cmp2/partitionindex/ABean.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cmp2/partitionindex/ABean.java	2007-01-29 10:28:08 UTC (rev 60100)
@@ -0,0 +1,109 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.cmp2.partitionindex;
+
+
+import javax.ejb.EntityBean;
+import javax.ejb.EntityContext;
+import javax.ejb.RemoveException;
+import javax.ejb.CreateException;
+
+
+/**
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision: 44013 $</tt>
+ */
+public abstract class ABean implements EntityBean
+{
+   private Object longTx;
+
+   // CMP accessors --------------------------------------------
+   /**
+    * @ejb.pk-field
+    * @ejb.persistent-field
+    * @ejb.interface-method
+    */
+   public abstract Integer getId();
+
+   public abstract void setId(Integer id);
+
+   /**
+    * @ejb.persistent-field
+    * @ejb.interface-method
+    */
+   public abstract String getName();
+
+  /**
+   * @ejb.interface-method
+   */
+   public abstract void setName(String name);
+
+   /**
+    * @throws javax.ejb.CreateException
+    * @ejb.create-method
+    */
+   public Integer ejbCreate(Integer id, String name)
+      throws CreateException
+   {
+      setId(id);
+      setName(name);
+      return null;
+   }
+
+   public void ejbPostCreate(Integer id, String name)
+   {
+   }
+
+   /**
+    * @param ctx The new entityContext value
+    */
+   public void setEntityContext(EntityContext ctx)
+   {
+   }
+
+   /**
+    * Unset the associated entity context.
+    */
+   public void unsetEntityContext()
+   {
+   }
+
+   public void ejbActivate()
+   {
+   }
+
+   public void ejbLoad()
+   {
+   }
+
+   public void ejbPassivate()
+   {
+   }
+
+   public void ejbRemove() throws RemoveException
+   {
+   }
+
+   public void ejbStore()
+   {
+   }
+}

Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cmp2/partitionindex/ALocal.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cmp2/partitionindex/ALocal.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cmp2/partitionindex/ALocal.java	2007-01-29 10:28:08 UTC (rev 60100)
@@ -0,0 +1,36 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.cmp2.partitionindex;
+
+/**
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision: 44013 $</tt>
+ */
+public interface ALocal
+   extends javax.ejb.EJBLocalObject
+{
+   public Integer getId(  ) ;
+
+   public String getName(  ) ;
+
+   public void setName( String name ) ;
+}

Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cmp2/partitionindex/ALocalHome.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cmp2/partitionindex/ALocalHome.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cmp2/partitionindex/ALocalHome.java	2007-01-29 10:28:08 UTC (rev 60100)
@@ -0,0 +1,37 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.cmp2.partitionindex;
+
+
+/**
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision: 44013 $</tt>
+ */
+public interface ALocalHome
+   extends javax.ejb.EJBLocalHome
+{
+   public ALocal create(Integer id , String name)
+      throws javax.ejb.CreateException;
+
+   public ALocal findByPrimaryKey(Integer pk)
+      throws javax.ejb.FinderException;
+}

Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cmp2/partitionindex/PartitionIndexUnitTestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cmp2/partitionindex/PartitionIndexUnitTestCase.java	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cmp2/partitionindex/PartitionIndexUnitTestCase.java	2007-01-29 10:28:08 UTC (rev 60100)
@@ -0,0 +1,81 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.cmp2.partitionindex;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.ejb.FinderException;
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.util.ejb.EJBTestCase;
+import junit.framework.Test;
+
+/**
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision: 44013 $</tt>
+ */
+public class PartitionIndexUnitTestCase
+   extends EJBTestCase
+{
+   public static Test suite() throws Exception
+   {
+      return JBossTestCase.getDeploySetup(PartitionIndexUnitTestCase.class, "cmp2-partitionindex.jar");
+   }
+
+   public PartitionIndexUnitTestCase(String methodName)
+   {
+      super(methodName);
+   }
+
+   // tests
+
+   public void testJBAS4033() throws Exception
+   {
+      ALocalHome ah = (ALocalHome)lookup("ALocalHome");
+      try
+      {
+         ah.findByPrimaryKey(new Integer(Integer.MIN_VALUE));
+      }
+      catch(FinderException fe)
+      {
+         // that's ok
+      }
+   }
+
+   // Private
+
+   private Object lookup(String name) throws NamingException
+   {
+      InitialContext ic = null;
+      try
+      {
+         ic = new InitialContext();
+         return ic.lookup(name);
+      }
+      finally
+      {
+         if(ic != null)
+         {
+            ic.close();
+         }
+      }
+   }
+}

Added: branches/Branch_4_2/testsuite/src/resources/cmp2/partitionindex/META-INF/ejb-jar.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/cmp2/partitionindex/META-INF/ejb-jar.xml	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/cmp2/partitionindex/META-INF/ejb-jar.xml	2007-01-29 10:28:08 UTC (rev 60100)
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!DOCTYPE ejb-jar PUBLIC
+   "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
+   "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
+
+<ejb-jar>
+   <enterprise-beans>
+      <session>
+         <description>JUnit Session Bean Test Runner</description>
+         <ejb-name>EJBTestRunnerEJB</ejb-name>
+         <home>org.jboss.test.util.ejb.EJBTestRunnerHome</home>
+         <remote>org.jboss.test.util.ejb.EJBTestRunner</remote>
+         <ejb-class>org.jboss.test.util.ejb.EJBTestRunnerBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Bean</transaction-type>
+      </session>
+      <entity>
+         <ejb-name>A</ejb-name>
+         <local-home>org.jboss.test.cmp2.partitionindex.ALocalHome</local-home>
+         <local>org.jboss.test.cmp2.partitionindex.ALocal</local>
+         <ejb-class>org.jboss.test.cmp2.partitionindex.ABean</ejb-class>
+         <persistence-type>Container</persistence-type>
+         <prim-key-class>java.lang.Integer</prim-key-class>
+         <reentrant>False</reentrant>
+         <cmp-version>2.x</cmp-version>
+         <abstract-schema-name>A</abstract-schema-name>
+         <cmp-field><field-name>id</field-name></cmp-field>
+         <cmp-field><field-name>name</field-name></cmp-field>
+         <primkey-field>id</primkey-field>
+      </entity>
+   </enterprise-beans>
+</ejb-jar>

Added: branches/Branch_4_2/testsuite/src/resources/cmp2/partitionindex/META-INF/jboss.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/cmp2/partitionindex/META-INF/jboss.xml	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/cmp2/partitionindex/META-INF/jboss.xml	2007-01-29 10:28:08 UTC (rev 60100)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
+
+<jboss>
+   <enterprise-beans>
+      <entity>
+         <ejb-name>A</ejb-name>
+         <local-jndi-name>ALocalHome</local-jndi-name>
+         <configuration-name>custom container</configuration-name>
+      </entity>
+      <session>
+         <ejb-name>EJBTestRunnerEJB</ejb-name>
+         <jndi-name>ejb/EJBTestRunner</jndi-name>
+      </session>
+   </enterprise-beans>
+
+   <container-configurations>
+    <container-configuration extends="cmp2.x jdbc2 pm">
+      <container-name>custom container</container-name>
+      <container-cache-conf>
+         <cache-policy-conf>
+            <min-capacity>500</min-capacity>
+            <max-capacity>10000</max-capacity>
+         </cache-policy-conf>
+         <cache-policy-conf-other>
+            <partitions>10</partitions>
+         </cache-policy-conf-other>
+      </container-cache-conf>
+    </container-configuration>
+   </container-configurations>
+</jboss>

Added: branches/Branch_4_2/testsuite/src/resources/cmp2/partitionindex/META-INF/jbosscmp-jdbc.xml
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/cmp2/partitionindex/META-INF/jbosscmp-jdbc.xml	                        (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/cmp2/partitionindex/META-INF/jbosscmp-jdbc.xml	2007-01-29 10:28:08 UTC (rev 60100)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jbosscmp-jdbc PUBLIC
+   "-//JBoss//DTD JBOSSCMP-JDBC 3.2//EN"
+   "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd">
+<jbosscmp-jdbc>
+   <defaults>
+      <remove-table>true</remove-table>
+   </defaults>
+
+   <enterprise-beans>
+      <entity>
+         <ejb-name>A</ejb-name>
+         <table-name>PARTITIONINDEX_AEJB</table-name>
+      </entity>
+   </enterprise-beans>
+</jbosscmp-jdbc>




More information about the jboss-cvs-commits mailing list