geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r454790 [3/5] - in /geronimo/xbean/trunk: ./ xbean-spring-itests/ xbean-spring-itests/2.0/ xbean-spring-itests/2.0/src/ xbean-spring-itests/2.0/src/main/ xbean-spring-itests/2.0/src/main/resources/ xbean-spring-itests/2.0/src/main/resources...
Date Tue, 10 Oct 2006 15:46:46 GMT
Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingSpringTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingSpringTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingSpringTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingSpringTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.apache.xbean.spring.example.PizzaService;
+
+/**
+ * @author James Strachan
+ * @version $Id$
+ * @since 2.0
+ */
+public class PizzaUsingSpringTest extends SpringTestSupport {
+
+    public void testPizza() throws Exception {
+        PizzaService pizza = (PizzaService) getBean("pizzaService");
+        pizza.makePizza();
+
+        assertEquals("topping", "Salami", pizza.getTopping());
+        assertEquals("cheese", "Edam", pizza.getCheese());
+        assertEquals("size", 17, pizza.getSize());
+    }
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/pizza-normal.xml");
+    }
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+/**
+ * @author James Strachan
+ * @version $Id$
+ * @since 2.0
+ */
+public class PizzaUsingXBeanTest extends PizzaUsingSpringTest {
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/pizza-xbean.xml");
+    }
+
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWinBeanRefTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWinBeanRefTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWinBeanRefTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWinBeanRefTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.apache.xbean.spring.example.PizzaService;
+
+/**
+ *
+ * @version $Revision: 1.1 $
+ */
+public class PizzaUsingXBeanWinBeanRefTest extends PizzaUsingSpringTest {
+    
+    public void testPizza() throws Exception {
+        PizzaService pizza = (PizzaService) getBean("pizzaService");
+        pizza.makePizza();
+
+        assertEquals("topping", "Salami", pizza.getTopping());
+        assertEquals("cheese", "#Edam", pizza.getCheese());
+        assertEquals("size", 17, pizza.getSize());
+    }
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/pizza-xbean-bean-ref.xml");
+    }
+
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithJavaNamespaceTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithJavaNamespaceTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithJavaNamespaceTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithJavaNamespaceTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+/**
+ * @author James Strachan
+ * @version $Id$
+ * @since 2.0
+ */
+public class PizzaUsingXBeanWithJavaNamespaceTest extends PizzaUsingSpringTest {
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/pizza-xbean-java.xml");
+    }
+
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithPropertiesTextNodeTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithPropertiesTextNodeTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithPropertiesTextNodeTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/PizzaUsingXBeanWithPropertiesTextNodeTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+/**
+ *
+ * @version $Revision: 1.1 $
+ */
+public class PizzaUsingXBeanWithPropertiesTextNodeTest extends PizzaUsingSpringTest {
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/pizza-xbean-properties.xml");
+    }
+
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/QNameUsingSpringTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/QNameUsingSpringTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/QNameUsingSpringTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/QNameUsingSpringTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xbean.spring.example.QNameService;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+public class QNameUsingSpringTest extends SpringTestSupport {
+
+    public void testQName() throws Exception {
+        QNameService svc = (QNameService) getBean("qnameService");
+
+        QName[] services = svc.getServices();
+        assertNotNull(services);
+        assertEquals(2, services.length);
+        assertEquals(new QName("urn:foo", "test"), services[0]);
+        assertEquals(new QName("urn:foo", "bar"), services[1]);
+        
+        List list = svc.getList();
+        assertNotNull(list);
+        assertEquals(1, list.size());
+        assertEquals(new QName("urn:foo", "list"), list.get(0));
+    }
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/qname-normal.xml");
+    }
+
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/QNameUsingXBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/QNameUsingXBeanTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/QNameUsingXBeanTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/QNameUsingXBeanTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+public class QNameUsingXBeanTest extends QNameUsingSpringTest {
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/qname-xbean.xml");
+    }
+
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RecipeUsingSpringTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RecipeUsingSpringTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RecipeUsingSpringTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RecipeUsingSpringTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import java.util.List;
+
+import org.apache.xbean.spring.example.Recipe;
+import org.apache.xbean.spring.example.RecipeService;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+public class RecipeUsingSpringTest extends SpringTestSupport {
+
+    public void testRecipes() throws Exception {
+        RecipeService svc = (RecipeService) getBean("recipeService");
+
+        List list = svc.getRecipes();
+        assertNotNull(list);
+        assertEquals(2, list.size());
+        Recipe r = (Recipe) list.get(0);
+        assertEquals("Food", r.getIngredients());
+        assertEquals("Mash together", r.getInstructions());
+        
+        r = (Recipe) list.get(1);
+        assertEquals("Food", r.getIngredients());
+        assertEquals("Mash together", r.getInstructions());
+        
+        assertNotNull(svc.getTopRecipe());
+        assertEquals("Food", svc.getTopRecipe().getIngredients());
+    }
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/recipe-normal.xml");
+    }
+
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RecipeUsingXBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RecipeUsingXBeanTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RecipeUsingXBeanTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RecipeUsingXBeanTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+public class RecipeUsingXBeanTest extends RecipeUsingSpringTest {
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/recipe-xbean.xml");
+    }
+
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingResourceXmlApplicationContextTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingResourceXmlApplicationContextTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingResourceXmlApplicationContextTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingResourceXmlApplicationContextTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.core.io.ClassPathResource;
+
+/**
+ * @author James Strachan
+ * @version $Id$
+ * @since 2.0
+ */
+public class RestaurantUsingResourceXmlApplicationContextTest extends RestaurantUsingSpringTest {
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ResourceXmlApplicationContext(new ClassPathResource("org/apache/xbean/spring/context/restaurant-xbean.xml"));
+    }
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringExtendedTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringExtendedTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringExtendedTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringExtendedTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+import java.util.List;
+
+/**
+ * @author James Strachan
+ * @version $Id$
+ * @since 2.0
+ */
+public class RestaurantUsingSpringExtendedTest extends RestaurantUsingSpringTest {
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-spring-extended.xml");
+    }
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingSpringTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.apache.xbean.spring.example.PizzaService;
+import org.apache.xbean.spring.example.RestaurantService;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author James Strachan
+ * @version $Id$
+ * @since 2.0
+ */
+public class RestaurantUsingSpringTest extends SpringTestSupport {
+
+    public void testPizza() throws Exception {
+        RestaurantService restaurant = (RestaurantService) getBean("restaurant");
+
+        QName service = restaurant.getServiceName();
+        assertEquals(new QName("http://acme.com", "xyz"), service);
+        
+        // dinners (1-many using list)
+        List dinners = restaurant.getDinnerMenu();
+        assertNotNull("dinners is null!", dinners);
+        assertEquals("dinners size: " + dinners, 2, dinners.size());
+
+        PizzaService pizza = (PizzaService) dinners.get(0);
+        assertEquals("topping", "Ham", pizza.getTopping());
+        assertEquals("cheese", "Mozzarella", pizza.getCheese());
+        assertEquals("size", 15, pizza.getSize());
+        
+         pizza = (PizzaService) dinners.get(1);
+        assertEquals("topping", "Eggs", pizza.getTopping());
+        assertEquals("cheese", "Mozzarella", pizza.getCheese());
+        assertEquals("size", 16, pizza.getSize());
+
+        // lunches (1-many using array)
+        PizzaService[] lunches = restaurant.getLunchMenu();
+        assertNotNull("lunches is null!", lunches);
+        assertEquals("lunches size: " + lunches, 1, lunches.length);
+
+        pizza = lunches[0];
+        assertEquals("topping", "Chicken", pizza.getTopping());
+        assertEquals("cheese", "Brie", pizza.getCheese());
+        assertEquals("size", 17, pizza.getSize());
+
+
+        // favourite (1-1)
+        pizza = restaurant.getFavourite();
+        assertNotNull("Pizza is null!", pizza);
+        pizza.makePizza();
+
+        assertEquals("topping", "Salami", pizza.getTopping());
+        assertEquals("cheese", "Edam", pizza.getCheese());
+        assertEquals("size", 17, pizza.getSize());
+
+    }
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-normal.xml");
+    }
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanAsRootTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanAsRootTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanAsRootTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanAsRootTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+public class RestaurantUsingXBeanAsRootTest extends RestaurantUsingSpringTest {
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-xbean-root.xml");
+    }
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanMixedTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanMixedTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanMixedTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanMixedTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+/**
+ * @author James Strachan
+ * @version $Id$
+ * @since 2.0
+ */
+public class RestaurantUsingXBeanMixedTest extends RestaurantUsingSpringTest {
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-xbean-mixed.xml");
+    }
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.apache.xbean.spring.example.RestaurantService;
+
+import javax.xml.namespace.QName;
+
+import java.net.URI;
+
+/**
+ * @author James Strachan
+ * @version $Id$
+ * @since 2.0
+ */
+public class RestaurantUsingXBeanTest extends RestaurantUsingSpringTest {
+    private static final Log log = LogFactory.getLog(RestaurantUsingXBeanTest.class);
+
+    public void testPizza() throws Exception {
+        super.testPizza();
+
+        RestaurantService restaurant = (RestaurantService) getBean("restaurant");
+        QName name = restaurant.getServiceName();
+        assertNotNull("Name is null", name);
+
+        assertEquals("Namespace URI", "http://acme.com", name.getNamespaceURI());
+        assertEquals("localName", "xyz", name.getLocalPart());
+        assertEquals("prefix", "foo", name.getPrefix());
+
+        log.info("Successfully converted the property to a QName: " + name);
+        
+        URI uri = restaurant.getUri();
+        assertNotNull("URI is null", uri);
+        assertEquals("URI", new URI("http://cheese.com"), uri);
+        
+        log.info("Successfully converted the property to a URI: " + uri);
+    }
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-xbean.xml");
+    }
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanWithSimplerConfigTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanWithSimplerConfigTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanWithSimplerConfigTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/RestaurantUsingXBeanWithSimplerConfigTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+/**
+ * @author James Strachan
+ * @version $Id$
+ * @since 2.0
+ */
+public class RestaurantUsingXBeanWithSimplerConfigTest extends RestaurantUsingSpringTest {
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/restaurant-xbean.xml");
+    }
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SaladUsingSpringTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SaladUsingSpringTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SaladUsingSpringTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SaladUsingSpringTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.apache.xbean.spring.example.SaladService;
+
+/**
+ * @author Dain Sundstrom
+ * @version $Id$
+ * @since 1.0
+ */
+public class SaladUsingSpringTest extends SpringTestSupport {
+    public void testSalad() throws Exception {
+        SaladService salad = (SaladService) getBean("saladService");
+
+        assertEquals("dressing", "Cesar", salad.getDressing());
+        assertEquals("size", "Small", salad.getSize());
+        assertEquals("crouton", true, salad.isCrouton());
+    }
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/salad-normal.xml");
+    }
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SaladUsingXBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SaladUsingXBeanTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SaladUsingXBeanTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SaladUsingXBeanTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+/**
+ * @author Dain Sundstrom
+ * @version $Id$
+ * @since 2.0
+ */
+public class SaladUsingXBeanTest extends SaladUsingSpringTest {
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/salad-xbean.xml");
+    }
+
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SoupUsingSpringTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SoupUsingSpringTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SoupUsingSpringTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SoupUsingSpringTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.apache.xbean.spring.example.SoupService;
+
+/**
+ * @author Dain Sundstrom
+ * @version $Id$
+ * @since 1.0
+ */
+public class SoupUsingSpringTest extends SpringTestSupport {
+    private static final long time = System.currentTimeMillis();
+
+    public void testSoup() throws Exception {
+        SoupService soup = (SoupService) getBean("soupService");
+        SoupService nestedBean = (SoupService) getBean("nestedBean");
+        SoupService nestedValue = (SoupService) getBean("nestedValue");
+
+        asssertValidSoup(soup);
+        asssertValidSoup(nestedBean);
+        asssertValidSoup(nestedValue);
+
+        context.close();
+        assertFalse(soup.exists());
+        assertFalse(nestedBean.exists());
+        assertFalse(nestedValue.exists());
+    }
+
+    private void asssertValidSoup(SoupService soup) {
+        assertEquals("type", "French Onion", soup.getSoupType());
+        assertTrue(soup.getCreateTime() >= time);
+        assertTrue(soup.exists());
+    }
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/soup-normal.xml");
+    }
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SoupUsingXBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SoupUsingXBeanTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SoupUsingXBeanTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SoupUsingXBeanTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+/**
+ * @author Dain Sundstrom
+ * @version $Id$
+ * @since 2.0
+ */
+public class SoupUsingXBeanTest extends SoupUsingSpringTest {
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/soup-xbean.xml");
+    }
+
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SpringExtensionTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SpringExtensionTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SpringExtensionTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SpringExtensionTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+/**
+ * 
+ * @author gnodet
+ * @since 2.7
+ */
+public class SpringExtensionTest extends SpringTestSupport {
+
+    public void test() {
+        
+    }
+    
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/spring-extension.xml");
+    }
+
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SpringTestSupport.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SpringTestSupport.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SpringTestSupport.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/SpringTestSupport.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+import junit.framework.TestCase;
+
+/**
+ * A useful base class for testing spring based utilities.
+ * 
+ * @author James Strachan
+ * @version $Id$
+ * @since 2.0
+ */
+public abstract class SpringTestSupport extends TestCase {
+    protected transient Log log = LogFactory.getLog(getClass());
+
+    protected AbstractXmlApplicationContext context;
+
+    protected void setUp() throws Exception {
+        context = createApplicationContext();
+        assertNotNull("ApplicationContext is null!", context);
+    }
+
+    protected void tearDown() throws Exception {
+        if (context != null) {
+            log.info("Closing down the spring context");
+            context.destroy();
+        }
+    }
+
+    protected Object getBean(String name) {
+        Object answer = answer = context.getBean(name);
+        assertNotNull("Could not find object in Spring for key: " + name, answer);
+        return answer;
+    }
+
+    protected abstract AbstractXmlApplicationContext createApplicationContext();
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/VodkaUsingSpringTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/VodkaUsingSpringTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/VodkaUsingSpringTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/VodkaUsingSpringTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.apache.xbean.spring.example.VodkaService;
+
+/**
+ * @author Dan Diephouse
+ * @version $Id: VodkaUsingSpringTest.java 434369 2006-08-24 10:24:21Z gnodet $
+ * @since 1.0
+ */
+public class VodkaUsingSpringTest extends SpringTestSupport {
+    
+    public void testWine() throws Exception {
+        VodkaService vodka = (VodkaService) getBean("vodkaService");
+
+        assertEquals("name", "Grey Goose", vodka.getName());
+        assertEquals("id", "vodkaService", vodka.getId());
+        
+        // Test more complex classes
+        assertEquals("class", VodkaService.class, vodka.getClass());
+    }
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/vodka-normal.xml");
+    }
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/VodkaUsingXBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/VodkaUsingXBeanTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/VodkaUsingXBeanTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/VodkaUsingXBeanTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+/**
+ * @author James Strachan
+ * @version $Id: VodkaUsingXBeanTest.java 434369 2006-08-24 10:24:21Z gnodet $
+ * @since 2.0
+ */
+public class VodkaUsingXBeanTest extends VodkaUsingSpringTest {
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/vodka-xbean.xml");
+    }
+
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/WineUsingSpringTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/WineUsingSpringTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/WineUsingSpringTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/WineUsingSpringTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.apache.xbean.spring.example.WineService;
+
+/**
+ * @author James Strachan
+ * @version $Id$
+ * @since 1.0
+ */
+public class WineUsingSpringTest extends SpringTestSupport {
+    
+    public void testWine() throws Exception {
+        WineService soup = (WineService) getBean("wineService");
+
+        assertEquals("name", "Amarone", soup.getName());
+        assertEquals("id", "wineService", soup.getId());
+    }
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/wine-normal.xml");
+    }
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/WineUsingXBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/WineUsingXBeanTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/WineUsingXBeanTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/WineUsingXBeanTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context;
+
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
+/**
+ * @author James Strachan
+ * @version $Id$
+ * @since 2.0
+ */
+public class WineUsingXBeanTest extends WineUsingSpringTest {
+
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/wine-xbean.xml");
+    }
+
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/impl/NamedConstructorArgsTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/impl/NamedConstructorArgsTest.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/impl/NamedConstructorArgsTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/context/impl/NamedConstructorArgsTest.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,81 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.context.impl;
+
+import java.io.ByteArrayInputStream;
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Arrays;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Dain Sundstrom
+ * @version $Id$
+ * @since 1.0
+ */
+public class NamedConstructorArgsTest extends TestCase {
+    private Properties properties = new Properties();
+
+    public void testPropertyParsing() {
+        assertEquals("bar", properties.getProperty("foo"));
+        assertEquals("blah", properties.getProperty("foo,chese"));
+        assertEquals("StringBuffer", properties.getProperty("java.lang.String(java.lang.StringBuffer)"));
+        assertEquals("char[]", properties.getProperty("java.lang.String([C)"));
+        assertEquals("byte[],int,int", properties.getProperty("java.lang.String([B,int,int)"));
+        assertEquals("URL[],ClassLoader", properties.getProperty("java.net.URLClassLoader([Ljava.net.URL;,java.lang.ClassLoader)"));
+    }
+
+    public void testMappingMetaData() throws Exception {
+        MappingMetaData mappingMetaData = new MappingMetaData(properties);
+        Constructor constructor = URLClassLoader.class.getConstructor(new Class[] { URL[].class, ClassLoader.class});
+        assertTrue(mappingMetaData.isDefaultConstructor(constructor));
+        assertEquals(Arrays.asList(new String[] { "urls", "parent" }),
+                Arrays.asList(mappingMetaData.getParameterNames(constructor)));
+
+        constructor = String.class.getConstructor(new Class[] { byte[].class, int.class, int.class});
+        assertFalse(mappingMetaData.isDefaultConstructor(constructor));
+        assertEquals(Arrays.asList(new String[] { "bytes", "offset", "length" }),
+                Arrays.asList(mappingMetaData.getParameterNames(constructor)));
+    }
+
+    protected void setUp() throws Exception {
+        StringBuffer buf = new StringBuffer();
+        buf.append("# test properties\n");
+        buf.append("foo=bar\n");
+        buf.append("foo,chese=blah\n");
+        Constructor constructor = String.class.getConstructor(new Class[] { StringBuffer.class});
+        buf.append(MappingMetaData.constructorToPropertyName(constructor) + "=StringBuffer\n");
+        constructor = String.class.getConstructor(new Class[] { char[].class});
+        buf.append(MappingMetaData.constructorToPropertyName(constructor) + "=char[]\n");
+        constructor = String.class.getConstructor(new Class[] { byte[].class, int.class, int.class});
+        buf.append(MappingMetaData.constructorToPropertyName(constructor) + "=byte[],int,int\n");
+        constructor = URLClassLoader.class.getConstructor(new Class[] { URL[].class, ClassLoader.class});
+        buf.append(MappingMetaData.constructorToPropertyName(constructor) + "=URL[],ClassLoader\n");
+
+        properties.load(new ByteArrayInputStream(buf.toString().getBytes()));
+
+        constructor = URLClassLoader.class.getConstructor(new Class[] { URL[].class, ClassLoader.class});
+        properties.put(MappingMetaData.constructorToPropertyName(constructor) + ".default", "true");
+        properties.put(MappingMetaData.constructorToPropertyName(constructor) + ".parameterNames", "urls,parent");
+        constructor = String.class.getConstructor(new Class[] { byte[].class, int.class, int.class});
+        properties.put(MappingMetaData.constructorToPropertyName(constructor) + ".default", "false");
+        properties.put(MappingMetaData.constructorToPropertyName(constructor) + ".parameterNames", "bytes,offset,length");
+    }
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/BeerService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/BeerService.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/BeerService.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/BeerService.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.example;
+
+
+/**
+ * @org.apache.xbean.XBean element="beer" description="Mmmmm beer"
+ * 
+ * @author James Strachan
+ * @version $Id$
+ * @since 2.0
+ */
+
+// START SNIPPET: bean
+public class BeerService {
+    private String id;
+    private String name;
+    private String source = "tap";
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getSource() {
+        return source;
+    }
+
+    public void setSource(String source) {
+        this.source = source;
+    }
+}
+// END SNIPPET: bean
+

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/ContainerBean.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/ContainerBean.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/ContainerBean.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/ContainerBean.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.example;
+
+public class ContainerBean {
+
+    InnerBean[] beans;
+
+    /**
+     * @return the beans
+     */
+    public InnerBean[] getBeans() {
+        return beans;
+    }
+
+    /**
+     * @param beans the beans to set
+     */
+    public void setBeans(InnerBean[] beans) {
+        this.beans = beans;
+    }
+    
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/DummyBean.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/DummyBean.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/DummyBean.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/DummyBean.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.example;
+
+/**
+ * @org.apache.xbean.XBean element="dummy"
+ * @author gnodet
+ * @since 2.7
+ */
+public class DummyBean {
+
+    private Object inner;
+
+    /**
+     * @return the inner
+     */
+    public Object getInner() {
+        return inner;
+    }
+
+    /**
+     * @param inner the inner to set
+     */
+    public void setInner(Object inner) {
+        this.inner = inner;
+    }
+    
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/FavoriteService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/FavoriteService.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/FavoriteService.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/FavoriteService.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.example;
+
+import java.util.Map;
+
+
+/**
+ * @org.apache.xbean.XBean element="favorite"
+ * 
+ * @author Dan Diephouse
+ * @version $Id$
+ */
+
+// START SNIPPET: bean
+public class FavoriteService {
+    private Map favorites;
+
+    /**
+     * @org.apache.xbean.Map entryName="favorite-item" keyName="person"
+     * @return
+     */
+    public Map getFavorites() {
+        return favorites;
+    }
+
+    public void setFavorites(Map favorites) {
+        this.favorites = favorites;
+    }   
+}
+// END SNIPPET: bean
+

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/GinService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/GinService.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/GinService.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/GinService.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.example;
+
+/**
+ * Gin is made from the distillation of white grain spirit and juniper berries.
+ * @org.apache.xbean.XBean element="gin" contentProperty="name"
+ *
+ * @version $Revision: 1.1 $
+ */
+public class GinService {
+
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+    
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/InnerBean.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/InnerBean.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/InnerBean.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/InnerBean.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.example;
+
+public class InnerBean {
+
+    public static InnerBean INSTANCE = null;
+    
+    public InnerBean() {
+        Thread.dumpStack();
+        if (INSTANCE == null) {
+            INSTANCE = this;
+        } else {
+            throw new IllegalStateException("Already instanciated");
+        }
+    }
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/KegService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/KegService.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/KegService.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/KegService.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.example;
+
+//START SNIPPET: java
+/**
+ * @org.apache.xbean.XBean element="keg" 
+ * 
+ * Used to verify that property PropertyEditors work correctly.
+ * 
+ * @author chirino
+ */
+public class KegService {
+	
+    private long remaining;
+
+	/**
+	 * Gets the amount of beer remaining in the keg (in ml)
+	 * 
+	 * @param remaining
+	 */
+	public long getRemaining() {
+		return remaining;
+	}
+
+	/**
+	 * Sets the amount of beer remaining in the keg (in ml)
+	 * 
+     * @org.apache.xbean.Property propertyEditor="org.apache.xbean.spring.example.MilliLittersPropertyEditor"
+	 * @param remaining
+	 */
+	public void setRemaining(long remaining) {
+		this.remaining = remaining;
+	}
+	
+	public long dispense( long amount ) {
+		this.remaining -= amount;
+		return this.remaining;
+	}
+
+}
+// END SNIPPET: java
+

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/MilliLittersPropertyEditor.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/MilliLittersPropertyEditor.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/MilliLittersPropertyEditor.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/MilliLittersPropertyEditor.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.example;
+
+import java.beans.PropertyEditorSupport;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+//START SNIPPET: java
+/**
+ * 
+ * Used to verify that per property PropertyEditors work correctly.
+ * 
+ * @author chirino
+ */
+public class MilliLittersPropertyEditor extends PropertyEditorSupport {
+
+	public void setAsText(String text) throws IllegalArgumentException {
+
+		Pattern p = Pattern.compile("^(\\d+)\\s*(l(iter)?)?$", Pattern.CASE_INSENSITIVE);
+		Matcher m = p.matcher(text);
+		if( m.matches() ) {
+			setValue(new Long(Long.parseLong(m.group(1))*1000));
+			return;
+		}
+		
+		p = Pattern.compile("^(\\d+)\\s*(ml)?$", Pattern.CASE_INSENSITIVE);
+		m = p.matcher(text);
+		if( m.matches() ) {
+			setValue(new Long(Long.parseLong(m.group(1))));
+			return;
+		}
+
+		p = Pattern.compile("^(\\d+)\\s*pints?$", Pattern.CASE_INSENSITIVE);
+	    m = p.matcher(text);
+		if( m.matches() ) {
+			long pints = Long.parseLong(m.group(1));
+			setValue(new Long( (long)(pints * 1750) ));
+			return;
+		}
+		
+		throw new IllegalArgumentException("Could convert not to long (in ml) for "+ text);		
+	}
+
+	public String getAsText() {
+		Long value = (Long) getValue();
+		return (value != null ? value.toString() : "");
+	}
+}
+//END SNIPPET: java

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/PizzaService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/PizzaService.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/PizzaService.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/PizzaService.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.example;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @org.apache.xbean.XBean element="pizza"
+ *  description="This is a tasty Pizza"
+ *
+ * @author James Strachan
+ * @version $Id$
+ * @since 2.0
+ */
+
+// START SNIPPET: bean
+public class PizzaService {
+
+    private static final Log log = LogFactory.getLog(PizzaService.class);
+    
+    private String topping;
+    private String cheese;
+    private int size;
+    private double price;
+
+    public void makePizza() {
+        log.info("Making a pizza with topping: " + topping + " cheese: " + cheese + " with size: " + size);
+    }
+
+    public String getCheese() {
+        return cheese;
+    }
+
+    public void setCheese(String cheese) {
+        this.cheese = cheese;
+    }
+
+    public double getPrice() {
+        return price;
+    }
+
+    public void setPrice(double price) {
+        this.price = price;
+    }
+
+    public int getSize() {
+        return size;
+    }
+
+    public void setSize(int size) {
+        this.size = size;
+    }
+
+    /**
+     * @org.apache.xbean.Property alias="myTopping"
+     */
+    public String getTopping() {
+        return topping;
+    }
+
+    public void setTopping(String topping) {
+        this.topping = topping;
+    }
+
+}
+// END SNIPPET: bean
+

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/QNameService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/QNameService.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/QNameService.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/QNameService.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.example;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @org.apache.xbean.XBean element="qname-service"
+ * @author gnodet
+ */
+public class QNameService {
+
+    private QName[] services;
+    private List list;
+
+    public QName[] getServices() {
+        return services;
+    }
+
+    public void setServices(QName[] services) {
+        this.services = services;
+    }
+
+    public List getList() {
+        return list;
+    }
+
+    public void setList(List list) {
+        this.list = list;
+    }
+
+
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/Recipe.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/Recipe.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/Recipe.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/Recipe.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.example;
+
+/**
+ * @org.apache.xbean.XBean element="recipe"
+ * @author Dan Diephouse
+ */
+public class Recipe
+{
+    private String ingredients;
+    private String instructions;
+    
+    public String getInstructions()
+    {
+        return instructions;
+    }
+
+    public void setInstructions(String instructions)
+    {
+        this.instructions = instructions;
+    }
+
+    public String getIngredients()
+    {
+        return ingredients;
+    }
+
+    public void setIngredients(String ingredients)
+    {
+        this.ingredients = ingredients;
+    }
+
+}

Added: geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/RecipeService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/RecipeService.java?view=auto&rev=454790
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/RecipeService.java (added)
+++ geronimo/xbean/trunk/xbean-spring-v2c/src/test/java/org/apache/xbean/spring/example/RecipeService.java Tue Oct 10 08:46:36 2006
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xbean.spring.example;
+
+import java.util.List;
+/**
+ * @org.apache.xbean.XBean element="recipe-service"
+ * @author Dan Diephouse
+ */
+public class RecipeService
+{
+    private List recipes;
+    private Recipe topRecipe;
+    
+    /**
+     * @org.apache.xbean.FlatCollection childElement="recipe"
+     * @return
+     */
+    public List getRecipes()
+    {
+        return recipes;
+    }
+
+    public void setRecipes(List recipes)
+    {
+        this.recipes = recipes;
+    }
+
+    /**
+     * @org.apache.xbean.Flat
+     * @return
+     */
+    public Recipe getTopRecipe() {
+        return topRecipe;
+    }
+
+    public void setTopRecipe(Recipe topRecipe) {
+        this.topRecipe = topRecipe;
+    }
+}



Mime
View raw message