geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r896312 - in /geronimo/xbean/trunk/xbean-blueprint/src: main/java/org/apache/xbean/blueprint/context/impl/ test/java/org/apache/xbean/blueprint/context/ test/java/org/apache/xbean/blueprint/generator/ test/resources/org/apache/xbean/bluepri...
Date Wed, 06 Jan 2010 02:51:09 GMT
Author: djencks
Date: Wed Jan  6 02:51:08 2010
New Revision: 896312

URL: http://svn.apache.org/viewvc?rev=896312&view=rev
Log:
XBEAN-142 a few more test fixes

Modified:
    geronimo/xbean/trunk/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/context/impl/XBeanNamespaceHandler.java
    geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/context/QNameUsingSpringTest.java
    geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/context/RecipeUsingSpringTest.java
    geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/generator/ModelTest.java
    geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/gin.xml
    geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/qname-normal.xml
    geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/recipe-xbean.xml

Modified: geronimo/xbean/trunk/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/context/impl/XBeanNamespaceHandler.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/context/impl/XBeanNamespaceHandler.java?rev=896312&r1=896311&r2=896312&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/context/impl/XBeanNamespaceHandler.java
(original)
+++ geronimo/xbean/trunk/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/context/impl/XBeanNamespaceHandler.java
Wed Jan  6 02:51:08 2010
@@ -168,10 +168,11 @@
                 String childName = child.getLocalName();
                 Metadata childMetadata = null;
                 String propertyName = mappingMetaData.getNestedListProperty(beanTypeName,
childName);
-                //explicit list?
+                //explicit list
                 if (propertyName != null) {
                     childMetadata = parserContext.parseElement(CollectionMetadata.class,
beanMetaData, child);
                 } else if ((propertyName = mappingMetaData.getFlatCollectionProperty(beanTypeName,
childName)) != null) {
+                    //flat collection
 
 //                } else if ((propertyName = mappingMetaData.getNestedProperty(beanTypeName,
childName)) != null) {
 //

Modified: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/context/QNameUsingSpringTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/context/QNameUsingSpringTest.java?rev=896312&r1=896311&r2=896312&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/context/QNameUsingSpringTest.java
(original)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/context/QNameUsingSpringTest.java
Wed Jan  6 02:51:08 2010
@@ -21,22 +21,30 @@
 import javax.xml.namespace.QName;
 
 import org.apache.xbean.blueprint.example.QNameService;
+import org.apache.aries.blueprint.reflect.BeanMetadataImpl;
+import org.apache.aries.blueprint.reflect.CollectionMetadataImpl;
+import org.osgi.service.blueprint.reflect.Metadata;
 
 public class QNameUsingSpringTest extends BlueprintTestSupport {
 
     public void testQName() throws Exception {
-        QNameService svc = (QNameService) reg.getComponentDefinition("qnameService");
+        BeanMetadataImpl svc = (BeanMetadataImpl) reg.getComponentDefinition("qnameService");
 
-        QName[] services = svc.getServices();
+        List<Metadata> services = ((CollectionMetadataImpl)propertyByName("services",
svc).getValue()).getValues();
         assertNotNull(services);
-        assertEquals(2, services.length);
-        assertEquals(new QName("urn:foo", "test"), services[0]);
-        assertEquals(new QName("urn:foo", "bar"), services[1]);
+        assertEquals(2, services.size());
+        checkQName("urn:foo", "test", services.get(0));
+        checkQName("urn:foo", "bar", services.get(1));
         
-        List list = svc.getList();
+        List<Metadata> list = ((CollectionMetadataImpl)propertyByName("list", svc).getValue()).getValues();
         assertNotNull(list);
         assertEquals(1, list.size());
-        assertEquals(new QName("urn:foo", "list"), list.get(0));
+        checkQName("urn:foo", "list", list.get(0));
+    }
+
+    protected void checkQName(String namespace, String local, Metadata meta) {
+        checkArgumentValue(0, namespace, (BeanMetadataImpl) meta, false);
+        checkArgumentValue(1, local, (BeanMetadataImpl) meta, false);
     }
 
     protected String getPlan() {

Modified: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/context/RecipeUsingSpringTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/context/RecipeUsingSpringTest.java?rev=896312&r1=896311&r2=896312&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/context/RecipeUsingSpringTest.java
(original)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/context/RecipeUsingSpringTest.java
Wed Jan  6 02:51:08 2010
@@ -20,25 +20,29 @@
 
 import org.apache.xbean.blueprint.example.Recipe;
 import org.apache.xbean.blueprint.example.RecipeService;
+import org.apache.aries.blueprint.reflect.BeanMetadataImpl;
+import org.apache.aries.blueprint.reflect.CollectionMetadataImpl;
+import org.osgi.service.blueprint.reflect.Metadata;
 
 public class RecipeUsingSpringTest extends BlueprintTestSupport {
 
     public void testRecipes() throws Exception {
-        RecipeService svc = (RecipeService) reg.getComponentDefinition("recipeService");
+        BeanMetadataImpl svc = (BeanMetadataImpl) reg.getComponentDefinition("recipeService");
 
-        List list = svc.getRecipes();
+        List<Metadata> list = ((CollectionMetadataImpl)propertyByName("recipes", svc).getValue()).getValues();
         assertNotNull(list);
         assertEquals(2, list.size());
-        Recipe r = (Recipe) list.get(0);
-        assertEquals("Food", r.getIngredients());
-        assertEquals("Mash together", r.getInstructions());
+        BeanMetadataImpl r = (BeanMetadataImpl) list.get(0);
+        checkPropertyValue("ingredients", "Food", r);
+        checkPropertyValue("instructions", "Mash together", r);
         
-        r = (Recipe) list.get(1);
-        assertEquals("Food", r.getIngredients());
-        assertEquals("Mash together", r.getInstructions());
-        
-        assertNotNull(svc.getTopRecipe());
-        assertEquals("Food", svc.getTopRecipe().getIngredients());
+        r = (BeanMetadataImpl) list.get(1);
+        checkPropertyValue("ingredients", "Food", r);
+        checkPropertyValue("instructions", "Mash together", r);
+
+        BeanMetadataImpl topRecipe = (BeanMetadataImpl) propertyByName("topRecipe", svc).getValue();
+        assertNotNull(topRecipe);
+        checkPropertyValue("ingredients", "Food", topRecipe);
     }
 
     protected String getPlan() {

Modified: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/generator/ModelTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/generator/ModelTest.java?rev=896312&r1=896311&r2=896312&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/generator/ModelTest.java
(original)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/generator/ModelTest.java
Wed Jan  6 02:51:08 2010
@@ -190,19 +190,19 @@
             }
         });
         //TODO blueprint what ??
-//        builder.setEntityResolver(new EntityResolver() {
-//            public InputSource resolveEntity(String publicId, String systemId) throws SAXException,
IOException {
+        builder.setEntityResolver(new EntityResolver() {
+            public InputSource resolveEntity(String publicId, String systemId) throws SAXException,
IOException {
 //                PluggableSchemaResolver springResolver = new PluggableSchemaResolver(getClass().getClassLoader());
-//                InputSource source = springResolver.resolveEntity(publicId, systemId);
-//                if (source == null && "http://xbean.apache.org/test.xsd".equals(systemId))
{
-//                    source = new InputSource(new FileInputStream(xsd));
-//                    source.setPublicId(publicId);
-//                    source.setSystemId(systemId);
-//                }
-//
-//                return source;
-//            }
-//        });
+                InputSource source = null;//springResolver.resolveEntity(publicId, systemId);
+                if (source == null && "http://xbean.apache.org/test.xsd".equals(systemId))
{
+                    source = new InputSource(new FileInputStream(xsd));
+                    source.setPublicId(publicId);
+                    source.setSystemId(systemId);
+                }
+
+                return source;
+            }
+        });
         builder.parse(xml);
         if (error.get() != null) {
             error.get().printStackTrace();

Modified: geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/gin.xml
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/gin.xml?rev=896312&r1=896311&r2=896312&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/gin.xml
(original)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/gin.xml
Wed Jan  6 02:51:08 2010
@@ -18,10 +18,10 @@
 
 -->
 <!-- START SNIPPET: xml -->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:b="http://xbean.apache.org/schemas/pizza">
+<x:blueprint xmlns:x="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:b="http://xbean.apache.org/schemas/pizza">
 
-  <b:gin id="ginService"><![CDATA[Bombay Sapphire]]></b:gin>
+  <b:gin x:id="ginService"><![CDATA[Bombay Sapphire]]></b:gin>
 
-</blueprint>
+</x:blueprint>
 <!-- END SNIPPET: xml -->
 

Modified: geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/qname-normal.xml
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/qname-normal.xml?rev=896312&r1=896311&r2=896312&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/qname-normal.xml
(original)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/qname-normal.xml
Wed Jan  6 02:51:08 2010
@@ -23,20 +23,20 @@
 		<property name="services">
 			<list>
 				<bean class="javax.xml.namespace.QName">
-			        <constructor-arg value="urn:foo"/>
-			        <constructor-arg value="test"/>
+			        <argument value="urn:foo"/>
+			        <argument value="test"/>
 				</bean>
 				<bean class="javax.xml.namespace.QName">
-			        <constructor-arg value="urn:foo"/>
-			        <constructor-arg value="bar"/>
+			        <argument value="urn:foo"/>
+			        <argument value="bar"/>
 				</bean>
 			</list>
 		</property>
 		<property name="list">
 			<list>
 				<bean class="javax.xml.namespace.QName">
-			        <constructor-arg value="urn:foo"/>
-			        <constructor-arg value="list"/>
+			        <argument value="urn:foo"/>
+			        <argument value="list"/>
 				</bean>
 			</list>
 		</property>

Modified: geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/recipe-xbean.xml
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/recipe-xbean.xml?rev=896312&r1=896311&r2=896312&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/recipe-xbean.xml
(original)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/recipe-xbean.xml
Wed Jan  6 02:51:08 2010
@@ -17,10 +17,10 @@
     limitations under the License.
 
 -->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:x="http://xbean.apache.org/schemas/pizza"
+<b:blueprint xmlns:b="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:x="http://xbean.apache.org/schemas/pizza"
  xmlns:foo="urn:foo">
 
-  <x:recipe-service id="recipeService">
+  <x:recipe-service b:id="recipeService">
     <x:topRecipe>
       <x:instructions>Mash together</x:instructions>
       <x:ingredients>Food</x:ingredients>
@@ -35,4 +35,4 @@
     </x:recipe>
   </x:recipe-service>
 
-</blueprint>
+</b:blueprint>



Mime
View raw message