[jboss-cvs] JBossAS SVN: r94417 - in branches/JBPAPP_4_2_0_GA_CP: server/src/main/org/jboss/ejb/plugins/cmp/jdbc2/schema and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Oct 6 11:27:30 EDT 2009


Author: alex.loubyansky at jboss.com
Date: 2009-10-06 11:27:30 -0400 (Tue, 06 Oct 2009)
New Revision: 94417

Added:
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jdbc2pm/ejbstore/ejb/BBean.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jdbc2pm/ejbstore/ejb/BLocal.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jdbc2pm/ejbstore/ejb/BLocalHome.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/cmp2/jdbc2pm/ejbstore/b/
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/cmp2/jdbc2pm/ejbstore/b/META-INF/
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/cmp2/jdbc2pm/ejbstore/b/META-INF/ejb-jar.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/cmp2/jdbc2pm/ejbstore/b/META-INF/jboss.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/cmp2/jdbc2pm/ejbstore/b/META-INF/jbosscmp-jdbc.xml
Modified:
   branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc2/JDBCStoreManager2.java
   branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc2/schema/Schema.java
   branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/cmp.xml
   branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jdbc2pm/ejbstore/test/JDBC2PmEjbStoreUnitTestCase.java
Log:
JBPAPP-2889

Modified: branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc2/JDBCStoreManager2.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc2/JDBCStoreManager2.java	2009-10-06 15:23:48 UTC (rev 94416)
+++ branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc2/JDBCStoreManager2.java	2009-10-06 15:27:30 UTC (rev 94417)
@@ -100,7 +100,7 @@
       schema = (Schema)getApplicationData(SCHEMA);
       if(schema == null)
       {
-         schema = new Schema();
+         schema = new Schema(container.getEjbModule().getServiceName().getCanonicalName());
          putApplicationData(SCHEMA, schema);
       }
       return schema;

Modified: branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc2/schema/Schema.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc2/schema/Schema.java	2009-10-06 15:23:48 UTC (rev 94416)
+++ branches/JBPAPP_4_2_0_GA_CP/server/src/main/org/jboss/ejb/plugins/cmp/jdbc2/schema/Schema.java	2009-10-06 15:27:30 UTC (rev 94417)
@@ -44,13 +44,18 @@
  */
 public class Schema
 {
-   private static final String VIEWS_TX_LOCAL_KEY = "jdbc2pm.Schema.Views";
+   private final String viewsTxLocalKey;
 
    private EntityTable[] entityTables;
    private RelationTable[] relationTables;
 
    private GlobalTxEntityMap txLocal = EntityContainer.getGlobalTxEntityMap();
 
+   public Schema(String ejbModuleName)
+   {
+      this.viewsTxLocalKey = ejbModuleName + ".schema.views";
+   }
+
    public EntityTable createEntityTable(JDBCEntityMetaData metadata, JDBCEntityBridge2 entity)
       throws DeploymentException
    {
@@ -226,11 +231,11 @@
       if(globalSync == null)
          throw new IllegalStateException("Global transaction synchronization is not available for transaction " + tx);
       
-      Views views = (Views) globalSync.getTxLocal(VIEWS_TX_LOCAL_KEY);
+      Views views = (Views) globalSync.getTxLocal(viewsTxLocalKey);
       if(views == null)
       {
          views = new Views(tx);
-         globalSync.putTxLocal(VIEWS_TX_LOCAL_KEY, views);
+         globalSync.putTxLocal(viewsTxLocalKey, views);
          globalSync.addSynchronization(new SchemaSynchronization(views));
       }
       return views;

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/cmp.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/cmp.xml	2009-10-06 15:23:48 UTC (rev 94416)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/sections/cmp.xml	2009-10-06 15:27:30 UTC (rev 94417)
@@ -364,14 +364,24 @@
       <jar destfile="${build.lib}/cmp2-jdbc2pm-ejbstore.jar">
          <fileset dir="${build.classes}">
             <patternset refid="jboss.test.util.ejb.set"/>
-            <include name="org/jboss/test/cmp2/jdbc2pm/ejbstore/**"/>
+            <include name="org/jboss/test/cmp2/jdbc2pm/ejbstore/**/A*"/>
+            <include name="org/jboss/test/cmp2/jdbc2pm/ejbstore/test/**"/>
          </fileset>
          <fileset dir="${build.resources}/cmp2/jdbc2pm/ejbstore">
-            <include name="**/*.*"/>
+            <include name="META-INF**/*.*"/>
          </fileset>
          <zipfileset src="${junit.junit.lib}/junit.jar"
             includes="junit/**/*.*"/>
       </jar>
+      <!-- build cmp2-jdbc2pm-ejbstoreb.jar -->
+      <jar destfile="${build.lib}/cmp2-jdbc2pm-ejbstoreb.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/test/cmp2/jdbc2pm/ejbstore/**/B*"/>
+         </fileset>
+         <fileset dir="${build.resources}/cmp2/jdbc2pm/ejbstore/b">
+            <include name="**/*.*"/>
+         </fileset>
+      </jar>
 
       <!-- build cmp2-jbas979.jar -->
       <jar destfile="${build.lib}/cmp2-jbas979.jar">

Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jdbc2pm/ejbstore/ejb/BBean.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jdbc2pm/ejbstore/ejb/BBean.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jdbc2pm/ejbstore/ejb/BBean.java	2009-10-06 15:27:30 UTC (rev 94417)
@@ -0,0 +1,114 @@
+/*
+ * 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.cmp2.jdbc2pm.ejbstore.ejb;
+
+
+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: $</tt>
+ */
+public abstract class BBean implements EntityBean
+{
+   // CMP accessors --------------------------------------------
+   /**
+    * @ejb.pk-field
+    * @ejb.persistent-field
+    * @ejb.interface-method
+    */
+   public abstract Long getId();
+
+   public abstract void setId(Long id);
+
+   /**
+    * @ejb.persistent-field
+    * @ejb.interface-method
+    */
+   public abstract String getStringField();
+
+  /**
+   * @ejb.interface-method
+   */
+   public abstract void setStringField(String i);
+
+   /**
+    * @ejb.persistent-field
+    * @ejb.interface-method
+    */
+   public abstract Integer getStoreCount();
+
+  /**
+   * @ejb.interface-method
+   */
+   public abstract void setStoreCount(Integer i);
+
+   /**
+    * @throws javax.ejb.CreateException
+    * @ejb.create-method
+    */
+   public Long ejbCreate(Long id, String i)
+      throws CreateException
+   {
+      setId(id);
+      setStringField(i);
+      setStoreCount(new Integer(0));
+      return null;
+   }
+
+   public void ejbPostCreate(Long id, String i)
+   {
+   }
+
+   public void setEntityContext(EntityContext ctx)
+   {
+   }
+
+   public void unsetEntityContext()
+   {
+   }
+
+   public void ejbActivate()
+   {
+   }
+
+   public void ejbLoad()
+   {
+   }
+
+   public void ejbPassivate()
+   {
+   }
+
+   public void ejbRemove() throws RemoveException
+   {
+   }
+
+   public void ejbStore()
+   {
+      setStoreCount(new Integer(getStoreCount().intValue() + 1));
+   }
+}

Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jdbc2pm/ejbstore/ejb/BLocal.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jdbc2pm/ejbstore/ejb/BLocal.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jdbc2pm/ejbstore/ejb/BLocal.java	2009-10-06 15:27:30 UTC (rev 94417)
@@ -0,0 +1,38 @@
+/*
+ * 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.cmp2.jdbc2pm.ejbstore.ejb;
+
+/**
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision: $</tt>
+ */
+public interface BLocal
+   extends javax.ejb.EJBLocalObject
+{
+   public Long getId(  ) ;
+
+   public String getStringField(  ) ;
+
+   public void setStringField( String i ) ;
+   
+   public Integer getStoreCount();
+}

Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jdbc2pm/ejbstore/ejb/BLocalHome.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jdbc2pm/ejbstore/ejb/BLocalHome.java	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jdbc2pm/ejbstore/ejb/BLocalHome.java	2009-10-06 15:27:30 UTC (rev 94417)
@@ -0,0 +1,37 @@
+/*
+ * 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.cmp2.jdbc2pm.ejbstore.ejb;
+
+
+/**
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision: $</tt>
+ */
+public interface BLocalHome
+   extends javax.ejb.EJBLocalHome
+{
+   public BLocal create(Long id , String i)
+      throws javax.ejb.CreateException;
+
+   public BLocal findByPrimaryKey(Long pk)
+      throws javax.ejb.FinderException;
+}

Modified: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jdbc2pm/ejbstore/test/JDBC2PmEjbStoreUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jdbc2pm/ejbstore/test/JDBC2PmEjbStoreUnitTestCase.java	2009-10-06 15:23:48 UTC (rev 94416)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/cmp2/jdbc2pm/ejbstore/test/JDBC2PmEjbStoreUnitTestCase.java	2009-10-06 15:27:30 UTC (rev 94417)
@@ -26,6 +26,8 @@
 import org.jboss.test.JBossTestCase;
 import org.jboss.test.cmp2.jdbc2pm.ejbstore.ejb.ALocal;
 import org.jboss.test.cmp2.jdbc2pm.ejbstore.ejb.ALocalHome;
+import org.jboss.test.cmp2.jdbc2pm.ejbstore.ejb.BLocal;
+import org.jboss.test.cmp2.jdbc2pm.ejbstore.ejb.BLocalHome;
 import org.jboss.test.util.ejb.EJBTestCase;
 import junit.framework.Test;
 
@@ -38,7 +40,7 @@
 {
    public static Test suite() throws Exception
    {
-      return JBossTestCase.getDeploySetup(JDBC2PmEjbStoreUnitTestCase.class, "cmp2-jdbc2pm-ejbstore.jar");
+      return JBossTestCase.getDeploySetup(JDBC2PmEjbStoreUnitTestCase.class, "cmp2-jdbc2pm-ejbstoreb.jar, cmp2-jdbc2pm-ejbstore.jar");
    }
 
    public JDBC2PmEjbStoreUnitTestCase(String methodName)
@@ -66,6 +68,12 @@
       assertEquals(storeCount + 1, a.getStoreCount().intValue());      
    }
 
+   public void testCorrectView() throws Throwable
+   {
+      BLocal b = getBLocalHome().create(new Long(11), "test");
+      ALocal a = getALocalHome().findByPrimaryKey(new Long(1));
+   }
+
    // Private
 
    private ALocalHome getALocalHome()
@@ -74,6 +82,12 @@
       return (ALocalHome)lookup("ALocal");
    }
 
+   private BLocalHome getBLocalHome()
+      throws NamingException
+   {
+      return (BLocalHome)lookup("BLocal");
+   }
+
    private Object lookup(String name) throws NamingException
    {
       InitialContext ic = new InitialContext();

Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/cmp2/jdbc2pm/ejbstore/b/META-INF/ejb-jar.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/cmp2/jdbc2pm/ejbstore/b/META-INF/ejb-jar.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/cmp2/jdbc2pm/ejbstore/b/META-INF/ejb-jar.xml	2009-10-06 15:27:30 UTC (rev 94417)
@@ -0,0 +1,53 @@
+<?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>
+      <entity >
+         <ejb-name>B</ejb-name>
+
+         <local-home>org.jboss.test.cmp2.jdbc2pm.ejbstore.ejb.BLocalHome</local-home>
+         <local>org.jboss.test.cmp2.jdbc2pm.ejbstore.ejb.BLocal</local>
+
+         <ejb-class>org.jboss.test.cmp2.jdbc2pm.ejbstore.ejb.BBean</ejb-class>
+         <persistence-type>Container</persistence-type>
+         <prim-key-class>java.lang.Long</prim-key-class>
+         <reentrant>false</reentrant>
+         <cmp-version>2.x</cmp-version>
+         <abstract-schema-name>B</abstract-schema-name>
+         <cmp-field >
+            <description><![CDATA[]]></description>
+            <field-name>id</field-name>
+         </cmp-field>
+         <cmp-field >
+            <description><![CDATA[]]></description>
+            <field-name>stringField</field-name>
+         </cmp-field>
+         <cmp-field >
+            <description><![CDATA[]]></description>
+            <field-name>storeCount</field-name>
+         </cmp-field>
+         <primkey-field>id</primkey-field>
+      </entity>
+   </enterprise-beans>
+
+   <assembly-descriptor >
+      <container-transaction >
+         <method >
+            <ejb-name>B</ejb-name>
+            <method-name>getStoreCount</method-name>
+         </method>
+         <trans-attribute>RequiresNew</trans-attribute>
+      </container-transaction>
+      <container-transaction >
+         <method >
+            <ejb-name>B</ejb-name>
+            <method-name>setStringField</method-name>
+         </method>
+         <trans-attribute>RequiresNew</trans-attribute>
+      </container-transaction>
+   </assembly-descriptor>
+
+</ejb-jar>

Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/cmp2/jdbc2pm/ejbstore/b/META-INF/jboss.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/cmp2/jdbc2pm/ejbstore/b/META-INF/jboss.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/cmp2/jdbc2pm/ejbstore/b/META-INF/jboss.xml	2009-10-06 15:27:30 UTC (rev 94417)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<jboss>
+   <enterprise-beans>
+      <entity>
+         <ejb-name>B</ejb-name>
+         <local-jndi-name>BLocal</local-jndi-name>
+         <configuration-name>custom</configuration-name>
+      </entity>
+   </enterprise-beans>
+
+    <container-configurations>
+        <container-configuration extends="cmp2.x jdbc2 pm">
+            <container-name>custom</container-name>
+            <call-ejb-store-on-clean>false</call-ejb-store-on-clean>
+        </container-configuration>
+    </container-configurations>
+</jboss>

Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/cmp2/jdbc2pm/ejbstore/b/META-INF/jbosscmp-jdbc.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/cmp2/jdbc2pm/ejbstore/b/META-INF/jbosscmp-jdbc.xml	                        (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/resources/cmp2/jdbc2pm/ejbstore/b/META-INF/jbosscmp-jdbc.xml	2009-10-06 15:27:30 UTC (rev 94417)
@@ -0,0 +1,9 @@
+<?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>
+</jbosscmp-jdbc>




More information about the jboss-cvs-commits mailing list