[jboss-svn-commits] JBoss Common SVN: r2523 - in jbossxb-builder/trunk/src/test: java/org/jboss/test/ejb/metadata/test and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Aug 31 11:44:12 EDT 2007


Author: alex.loubyansky at jboss.com
Date: 2007-08-31 11:44:12 -0400 (Fri, 31 Aug 2007)
New Revision: 2523

Added:
   jbossxb-builder/trunk/src/test/java/org/jboss/ejb/metadata/jboss/cmp/JBossCMPDependentValueClassMetaData.java
   jbossxb-builder/trunk/src/test/resources/org/jboss/test/ejb/metadata/test/JBossCMP_testDependentValueClasses.xml
Removed:
   jbossxb-builder/trunk/src/test/java/org/jboss/ejb/metadata/jboss/cmp/JBossCMPDependentValueClassesMetaData.java
Modified:
   jbossxb-builder/trunk/src/test/java/org/jboss/ejb/metadata/jboss/cmp/JBossCMPMetaData.java
   jbossxb-builder/trunk/src/test/java/org/jboss/test/ejb/metadata/test/JBossCMPUnitTestCase.java
Log:
dependent-value-classes

Added: jbossxb-builder/trunk/src/test/java/org/jboss/ejb/metadata/jboss/cmp/JBossCMPDependentValueClassMetaData.java
===================================================================
--- jbossxb-builder/trunk/src/test/java/org/jboss/ejb/metadata/jboss/cmp/JBossCMPDependentValueClassMetaData.java	                        (rev 0)
+++ jbossxb-builder/trunk/src/test/java/org/jboss/ejb/metadata/jboss/cmp/JBossCMPDependentValueClassMetaData.java	2007-08-31 15:44:12 UTC (rev 2523)
@@ -0,0 +1,102 @@
+/*
+ * 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.ejb.metadata.jboss.cmp;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+
+
+/**
+ * A JBossCMPDependentValueClassMetaData.
+ * 
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public class JBossCMPDependentValueClassMetaData
+{
+   private String description;
+   private String className;
+   private List<JBossCMPPropertyMetaData> properties;
+   
+   /**
+    * Get the className.
+    * 
+    * @return the className.
+    */
+   public String getClassName()
+   {
+      return className;
+   }
+
+   /**
+    * Set the className.
+    * 
+    * @param className The className to set.
+    */
+   @XmlElement(name="class")
+   public void setClassName(String className)
+   {
+      this.className = className;
+   }
+   
+   /**
+    * Get the description.
+    * 
+    * @return the description.
+    */
+   public String getDescription()
+   {
+      return description;
+   }
+
+   /**
+    * Set the description.
+    * 
+    * @param description The description to set.
+    */
+   public void setDescription(String description)
+   {
+      this.description = description;
+   }
+
+   /**
+    * Get the properties.
+    * 
+    * @return the properties.
+    */
+   public List<JBossCMPPropertyMetaData> getProperties()
+   {
+      return properties;
+   }
+
+   /**
+    * Set the properties.
+    * 
+    * @param properties The properties to set.
+    */
+   @XmlElement(name="property")
+   public void setProperties(List<JBossCMPPropertyMetaData> properties)
+   {
+      this.properties = properties;
+   }
+}

Deleted: jbossxb-builder/trunk/src/test/java/org/jboss/ejb/metadata/jboss/cmp/JBossCMPDependentValueClassesMetaData.java
===================================================================
--- jbossxb-builder/trunk/src/test/java/org/jboss/ejb/metadata/jboss/cmp/JBossCMPDependentValueClassesMetaData.java	2007-08-31 10:00:35 UTC (rev 2522)
+++ jbossxb-builder/trunk/src/test/java/org/jboss/ejb/metadata/jboss/cmp/JBossCMPDependentValueClassesMetaData.java	2007-08-31 15:44:12 UTC (rev 2523)
@@ -1,34 +0,0 @@
-/*
- * 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.ejb.metadata.jboss.cmp;
-
-
-/**
- * A JBossCMPDependentValueClassesMetaData.
- * 
- * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
- * @version $Revision: 1.1 $
- */
-public class JBossCMPDependentValueClassesMetaData
-{
-
-}

Modified: jbossxb-builder/trunk/src/test/java/org/jboss/ejb/metadata/jboss/cmp/JBossCMPMetaData.java
===================================================================
--- jbossxb-builder/trunk/src/test/java/org/jboss/ejb/metadata/jboss/cmp/JBossCMPMetaData.java	2007-08-31 10:00:35 UTC (rev 2522)
+++ jbossxb-builder/trunk/src/test/java/org/jboss/ejb/metadata/jboss/cmp/JBossCMPMetaData.java	2007-08-31 15:44:12 UTC (rev 2523)
@@ -59,7 +59,7 @@
    private JBossCMPDefaultsMetaData defaults;
    private JBossCMPEnterpriseBeansMetaData enterpriseBeans;
    private JBossCMPRelationshipsMetaData relationships;
-   private JBossCMPDependentValueClassesMetaData dependentValueClasses;
+   private List<JBossCMPDependentValueClassMetaData> dependentValueClasses;
    private List<JBossCMPTypeMappingMetaData> typeMappings;
    private List<JBossCMPEntityCommandMetaData> entityCommands;
    private List<JBossCMPUserTypeMappingMetaData> userTypeMappings;
@@ -96,9 +96,8 @@
     * Get the dependentValueClasses.
     * 
     * @return the dependentValueClasses.
-    */
-   
-   public JBossCMPDependentValueClassesMetaData getDependentValueClasses()
+    */   
+   public List<JBossCMPDependentValueClassMetaData> getDependentValueClasses()
    {
       return dependentValueClasses;
    }
@@ -108,8 +107,9 @@
     * 
     * @param dependentValueClasses The dependentValueClasses to set.
     */
-   
-   public void setDependentValueClasses(JBossCMPDependentValueClassesMetaData dependentValueClasses)
+   @XmlElementWrapper
+   @XmlElement(name="dependent-value-class")
+   public void setDependentValueClasses(List<JBossCMPDependentValueClassMetaData> dependentValueClasses)
    {
       this.dependentValueClasses = dependentValueClasses;
    }
@@ -119,7 +119,6 @@
     * 
     * @return the enterpriseBeans.
     */
-   
    public JBossCMPEnterpriseBeansMetaData getEnterpriseBeans()
    {
       return enterpriseBeans;
@@ -130,7 +129,6 @@
     * 
     * @param enterpriseBeans The enterpriseBeans to set.
     */
-   
    public void setEnterpriseBeans(JBossCMPEnterpriseBeansMetaData enterpriseBeans)
    {
       this.enterpriseBeans = enterpriseBeans;

Modified: jbossxb-builder/trunk/src/test/java/org/jboss/test/ejb/metadata/test/JBossCMPUnitTestCase.java
===================================================================
--- jbossxb-builder/trunk/src/test/java/org/jboss/test/ejb/metadata/test/JBossCMPUnitTestCase.java	2007-08-31 10:00:35 UTC (rev 2522)
+++ jbossxb-builder/trunk/src/test/java/org/jboss/test/ejb/metadata/test/JBossCMPUnitTestCase.java	2007-08-31 15:44:12 UTC (rev 2523)
@@ -30,6 +30,7 @@
 import org.jboss.ejb.metadata.jboss.cmp.JBossCMPCMPFieldMetaData;
 import org.jboss.ejb.metadata.jboss.cmp.JBossCMPDeclaredSqlMetaData;
 import org.jboss.ejb.metadata.jboss.cmp.JBossCMPDefaultsMetaData;
+import org.jboss.ejb.metadata.jboss.cmp.JBossCMPDependentValueClassMetaData;
 import org.jboss.ejb.metadata.jboss.cmp.JBossCMPEjbRelationMetaData;
 import org.jboss.ejb.metadata.jboss.cmp.JBossCMPEjbRelationshipRoleMetaData;
 import org.jboss.ejb.metadata.jboss.cmp.JBossCMPEnterpriseBeansMetaData;
@@ -953,4 +954,48 @@
       assertFalse(role.isBatchCascadeDelete());
       assertNull(role.getReadAhead());
    }
+   
+   public void testDependentValueClasses() throws Exception
+   {
+      //enableTrace("org.jboss.xb.builder");
+
+      JBossCMPMetaData jbossMetaData = unmarshal();    
+      assertNotNull(jbossMetaData);
+      List<JBossCMPDependentValueClassMetaData> dependentValueClasses = jbossMetaData.getDependentValueClasses();
+      assertNotNull(dependentValueClasses);
+      assertEquals(2, dependentValueClasses.size());
+      JBossCMPDependentValueClassMetaData dvc = dependentValueClasses.get(0);
+      assertNotNull(dvc);
+      assertEquals("DVC description", dvc.getDescription());
+      assertEquals("dependent.ValueClass", dvc.getClassName());
+      List<JBossCMPPropertyMetaData> properties = dvc.getProperties();
+      assertNotNull(properties);
+      assertEquals(2, properties.size());
+      JBossCMPPropertyMetaData prop = properties.get(0);
+      assertEquals("prop1", prop.getPropertyName());
+      assertEquals("PROP1", prop.getColumnName());
+      assertFalse(prop.isNotNull());
+      assertEquals(0, prop.getJdbcType());
+      assertNull(prop.getSqlType());
+      prop = properties.get(1);
+      assertEquals("prop2", prop.getPropertyName());
+      assertNull(prop.getColumnName());
+      assertTrue(prop.isNotNull());
+      assertEquals(Types.VARCHAR, prop.getJdbcType());
+      assertEquals("VARCHAR(111)", prop.getSqlType());
+      
+      dvc = dependentValueClasses.get(1);
+      assertNotNull(dvc);
+      assertNull(dvc.getDescription());
+      assertEquals("DependentValueClass", dvc.getClassName());
+      properties = dvc.getProperties();
+      assertNotNull(properties);
+      assertEquals(1, properties.size());
+      prop = properties.get(0);
+      assertEquals("prop1", prop.getPropertyName());
+      assertEquals("PROP1", prop.getColumnName());
+      assertTrue(prop.isNotNull());
+      assertEquals(Types.INTEGER, prop.getJdbcType());
+      assertEquals("INTEGER", prop.getSqlType());
+   }
 }

Added: jbossxb-builder/trunk/src/test/resources/org/jboss/test/ejb/metadata/test/JBossCMP_testDependentValueClasses.xml
===================================================================
--- jbossxb-builder/trunk/src/test/resources/org/jboss/test/ejb/metadata/test/JBossCMP_testDependentValueClasses.xml	                        (rev 0)
+++ jbossxb-builder/trunk/src/test/resources/org/jboss/test/ejb/metadata/test/JBossCMP_testDependentValueClasses.xml	2007-08-31 15:44:12 UTC (rev 2523)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbosscmp-jdbc xmlns="http://www.jboss.com/xml/ns/javaee/cmp2x"
+       xmlns:jee="http://java.sun.com/xml/ns/javaee"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee/cmp2x http://www.jboss.org/j2ee/schema/jbosscmp-jdbc_5_0.xsd">
+
+   <dependent-value-classes>
+      <dependent-value-class>
+         <description>DVC description</description>
+         <class>dependent.ValueClass</class>
+         <property>
+            <property-name>prop1</property-name>
+            <column-name>PROP1</column-name>
+         </property>
+         <property>
+            <property-name>prop2</property-name>
+            <not-null>true</not-null>
+            <jdbc-type>VARCHAR</jdbc-type>
+            <sql-type>VARCHAR(111)</sql-type>
+         </property>
+      </dependent-value-class>
+      <dependent-value-class>
+         <class>DependentValueClass</class>
+         <property>
+            <property-name>prop1</property-name>
+            <column-name>PROP1</column-name>
+            <not-null>true</not-null>
+            <jdbc-type>INTEGER</jdbc-type>
+            <sql-type>INTEGER</sql-type>
+         </property>
+      </dependent-value-class>
+   </dependent-value-classes>
+
+</jbosscmp-jdbc>




More information about the jboss-svn-commits mailing list