1 22 package org.jboss.test.xml; 23 24 import junit.framework.Test; 25 26 import org.jboss.beans.metadata.plugins.StringValueMetaData; 27 import org.jboss.beans.metadata.spi.PropertyMetaData; 28 import org.jboss.beans.metadata.spi.ValueMetaData; 29 import org.jboss.test.xml.importing.Extended; 30 import org.jboss.test.xml.importing.ExtendedSchemaInitializer; 31 import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver; 32 import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; 33 import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory; 34 35 41 public class ExtendedByImportUnitTestCase extends AbstractJBossXBTest 42 { 43 public static SchemaBindingResolver initResolver() throws Exception 44 { 45 DefaultSchemaResolver resolver = (DefaultSchemaResolver) SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver(); 46 Class clazz = ExtendedByImportUnitTestCase.class; 47 resolver.addSchemaInitializer(ExtendedSchemaInitializer.EXTENDED_NS, ExtendedSchemaInitializer.class.getName()); 48 String location = getSchemaLocation(clazz, "ExtendedByImportUnitTestCase.xsd"); 49 resolver.addSchemaLocation(ExtendedSchemaInitializer.EXTENDED_NS, location); 50 return resolver; 51 } 52 53 public void testExtended() throws Exception 54 { 55 Extended extended = (Extended) unmarshal(rootName + ".xml", Extended.class); 56 PropertyMetaData property = extended.getProperty("testProperty"); 57 assertNotNull(property); 58 ValueMetaData vmd = property.getValue(); 59 assertNotNull(vmd); 60 assertTrue(vmd instanceof StringValueMetaData); 61 assertEquals("testString", vmd.getUnderlyingValue()); 62 } 63 64 protected void configureLogging() 65 { 66 enableTrace("org.jboss.test.xml"); 67 } 68 69 74 public static Test suite() 75 { 76 return suite(ExtendedByImportUnitTestCase.class); 77 } 78 79 84 public ExtendedByImportUnitTestCase(String name) 85 { 86 super(name); 87 } 88 } 89 | Popular Tags |