[jboss-cvs] JBossAS SVN: r57517 - trunk/testsuite/src/main/org/jboss/test/xml
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 9 18:19:28 EDT 2006
Author: alex.loubyansky at jboss.com
Date: 2006-10-09 18:19:25 -0400 (Mon, 09 Oct 2006)
New Revision: 57517
Modified:
trunk/testsuite/src/main/org/jboss/test/xml/JNDIBindingUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/xml/PojoServerTestBase.java
trunk/testsuite/src/main/org/jboss/test/xml/PojoServerUnitTestCase.java
Log:
fixes after addition of the global model group binding support
Modified: trunk/testsuite/src/main/org/jboss/test/xml/JNDIBindingUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/xml/JNDIBindingUnitTestCase.java 2006-10-09 19:01:06 UTC (rev 57516)
+++ trunk/testsuite/src/main/org/jboss/test/xml/JNDIBindingUnitTestCase.java 2006-10-09 22:19:25 UTC (rev 57517)
@@ -24,7 +24,6 @@
import java.util.Properties;
import java.net.URL;
import java.net.InetAddress;
-import java.io.IOException;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
@@ -32,9 +31,6 @@
import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
import org.jboss.naming.JNDIBindings;
import org.jboss.naming.JNDIBinding;
-import org.jboss.util.xml.JBossEntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
import junit.framework.TestCase;
@@ -55,27 +51,6 @@
schemaBinding.setIgnoreUnresolvedFieldOrClass(false);
Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- unmarshaller.setEntityResolver(new JBossEntityResolver(){
- public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
- {
- if(systemId.endsWith("jndi-binding-service_1_0.xsd"))
- {
- URL url = Thread.currentThread().getContextClassLoader().
- getResource("xml/naming/jndi-binding-service_1_0.xsd");
- return new InputSource(url.toExternalForm());
- }
- else if(systemId.endsWith("custom-object-binding.xsd"))
- {
- URL url = Thread.currentThread().getContextClassLoader().
- getResource("xml/naming/custom-object-binding.xsd");
- return new InputSource(url.toExternalForm());
- }
- else
- {
- return super.resolveEntity(publicId, systemId);
- }
- }
- });
URL xml = getResource("xml/naming/testBindings.xml");
JNDIBindings bindings = (JNDIBindings)unmarshaller.unmarshal(xml.openStream(), schemaBinding);
Modified: trunk/testsuite/src/main/org/jboss/test/xml/PojoServerTestBase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/xml/PojoServerTestBase.java 2006-10-09 19:01:06 UTC (rev 57516)
+++ trunk/testsuite/src/main/org/jboss/test/xml/PojoServerTestBase.java 2006-10-09 22:19:25 UTC (rev 57517)
@@ -189,6 +189,9 @@
/** The key element name */
protected static final QName keyQName = new QName(BEAN_DEPLOYER_NS, "key");
+ /** The valueGroup name */
+ protected static final QName valueGroupQName = new QName(BEAN_DEPLOYER_NS, "valueGroup");
+
/** The schema binding */
protected static SchemaBinding schemaBinding;
Modified: trunk/testsuite/src/main/org/jboss/test/xml/PojoServerUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/xml/PojoServerUnitTestCase.java 2006-10-09 19:01:06 UTC (rev 57516)
+++ trunk/testsuite/src/main/org/jboss/test/xml/PojoServerUnitTestCase.java 2006-10-09 22:19:25 UTC (rev 57517)
@@ -55,7 +55,10 @@
import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementHandler;
import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementInterceptor;
import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding;
import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.TermBinding;
import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding;
import org.xml.sax.Attributes;
@@ -265,9 +268,26 @@
}
});
+ ModelGroupBinding valueGroup = schemaBinding.getGroup(valueGroupQName);
+ for(Iterator i = valueGroup.getParticles().iterator(); i.hasNext();)
+ {
+ TermBinding term = ((ParticleBinding)i.next()).getTerm();
+ if(!term.isWildcard())
+ {
+ ElementBinding e = (ElementBinding) term;
+ if(e.getQName().equals(nullQName))
+ {
+ e.pushInterceptor(NULLVALUES);
+ }
+ else
+ {
+ e.pushInterceptor(VALUES);
+ }
+ }
+ }
+
// parameter binding
TypeBinding parameterType = schemaBinding.getType(parameterTypeQName);
- configureValueBindings(parameterType);
parameterType.setHandler(new DefaultElementHandler()
{
public Object startElement(Object parent, QName name, ElementBinding element)
@@ -490,7 +510,6 @@
// property binding
TypeBinding propertyType = schemaBinding.getType(propertyTypeQName);
- configureValueBindings(propertyType);
propertyType.setHandler(new DefaultElementHandler()
{
public Object startElement(Object parent, QName name, ElementBinding element)
@@ -738,7 +757,6 @@
// value binding
TypeBinding valueType = schemaBinding.getType(valueTypeQName);
- configureValueBindings(valueType);
valueType.setHandler(new DefaultElementHandler()
{
public Object startElement(Object parent, QName name, ElementBinding element)
@@ -1034,37 +1052,8 @@
}
}
});
-
- configureValueBindings(collectionType);
}
- private static void configureValueBindings(TypeBinding typeBinding)
- {
- // type has values
- typeBinding.pushInterceptor(valueQName, VALUES);
-
- // type has injections
- typeBinding.pushInterceptor(injectQName, VALUES);
-
- // type can take a collection
- typeBinding.pushInterceptor(collectionQName, VALUES);
-
- // type can take a list
- typeBinding.pushInterceptor(listQName, VALUES);
-
- // type can take a set
- typeBinding.pushInterceptor(setQName, VALUES);
-
- // type can take an array
- typeBinding.pushInterceptor(arrayQName, VALUES);
-
- // type can take a map
- typeBinding.pushInterceptor(mapQName, VALUES);
-
- // type has a null
- typeBinding.pushInterceptor(nullQName, NULLVALUES);
- }
-
private static class MapEntry
{
public Object key;
More information about the jboss-cvs-commits
mailing list