1 22 package org.jboss.test.xml; 23 24 import junit.framework.Test; 25 26 import org.jboss.beans.metadata.plugins.AbstractBeanMetaData; 27 import org.jboss.test.xml.initializer.Container; 28 import org.jboss.test.xml.initializer.ContainerInitializer; 29 import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory; 30 import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver; 31 import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; 32 33 39 public class SingletonSchemaBindingResolverUnitTestCase extends AbstractJBossXBTest 40 { 41 public static SchemaBindingResolver initResolver() throws Exception 42 { 43 DefaultSchemaResolver resolver = (DefaultSchemaResolver) SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver(); 44 Class clazz = SingletonSchemaBindingResolverUnitTestCase.class; 45 resolver.addSchemaInitializer(ContainerInitializer.NS, ContainerInitializer.class.getName()); 46 String location = getSchemaLocation(clazz, "SchemaBindingInitializerUnitTestCaseContainer.xsd"); 47 resolver.addSchemaLocation(ContainerInitializer.NS, location); 48 return resolver; 49 } 50 51 public void testBean() throws Exception 52 { 53 Container container = (Container) unmarshal(rootName + "ContainerStrictBean.xml", Container.class); 54 Object object = container.getValue(); 55 assertNotNull("Should have a value", object); 56 assertTrue(object instanceof AbstractBeanMetaData); 57 AbstractBeanMetaData bean = (AbstractBeanMetaData) object; 58 assertEquals("TestClass", bean.getBean()); 59 } 60 61 protected void configureLogging() 62 { 63 enableTrace("org.jboss.test.xml"); 64 } 65 66 71 public static Test suite() 72 { 73 return suite(SingletonSchemaBindingResolverUnitTestCase.class); 74 } 75 76 81 public SingletonSchemaBindingResolverUnitTestCase(String name) 82 { 83 super(name); 84 } 85 } 86 | Popular Tags |