You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xbean-scm@geronimo.apache.org by dj...@apache.org on 2010/01/05 20:31:42 UTC

svn commit: r896187 [5/6] - in /geronimo/xbean/trunk/xbean-blueprint: ./ src/main/java/org/apache/xbean/blueprint/ src/main/java/org/apache/xbean/blueprint/context/ src/main/java/org/apache/xbean/blueprint/context/impl/ src/main/java/org/apache/xbean/b...

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/context/impl/NamedConstructorArgsTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/context/impl/NamedConstructorArgsTest.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/context/impl/NamedConstructorArgsTest.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/context/impl/NamedConstructorArgsTest.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.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");
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/context/impl/NamedConstructorArgsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/context/impl/NamedConstructorArgsTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/context/impl/NamedConstructorArgsTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/BeerService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/BeerService.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/BeerService.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/BeerService.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.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
+

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/BeerService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/BeerService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/BeerService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/ContainerBean.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/ContainerBean.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/ContainerBean.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/ContainerBean.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.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;
+    }
+    
+}

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/ContainerBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/ContainerBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/ContainerBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/DummyBean.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/DummyBean.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/DummyBean.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/DummyBean.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.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;
+    }
+    
+}

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/DummyBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/DummyBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/DummyBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/FavoriteService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/FavoriteService.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/FavoriteService.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/FavoriteService.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.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
+

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/FavoriteService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/FavoriteService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/FavoriteService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/FlatMapService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/FlatMapService.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/FlatMapService.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/FlatMapService.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.example;
+
+import java.util.Map;
+
+/**
+ * @org.apache.xbean.XBean element="flat-map"
+ * @author gnodet
+ */
+public class FlatMapService {
+
+    private Map services;
+
+    /**
+     * @org.apache.xbean.Map flat="true" dups="always" keyName="id" defaultKey="others"
+     */
+    public Map getServices() {
+        return services;
+    }
+
+    public void setServices(Map services) {
+        this.services = services;
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/FlatMapService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/FlatMapService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/FlatMapService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/GinService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/GinService.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/GinService.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/GinService.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.example;
+
+/**
+ * Gin is made from the distillation of white grain spirit and juniper berries.
+ * @org.apache.xbean.XBean element="gin" contentProperty="name"
+ *
+ * @version $Revision$
+ */
+public class GinService {
+
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+    
+}

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/GinService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/GinService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/GinService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/InnerBean.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/InnerBean.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/InnerBean.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/InnerBean.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.example;
+
+public class InnerBean {
+
+    public static InnerBean INSTANCE = null;
+    
+    public InnerBean() {
+        Thread.dumpStack();
+        if (INSTANCE == null) {
+            INSTANCE = this;
+        } else {
+            throw new IllegalStateException("Already instanciated");
+        }
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/InnerBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/InnerBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/InnerBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/KegService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/KegService.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/KegService.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/KegService.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.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.blueprint.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
+

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/KegService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/KegService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/KegService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/MilliLittersPropertyEditor.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/MilliLittersPropertyEditor.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/MilliLittersPropertyEditor.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/MilliLittersPropertyEditor.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.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

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/MilliLittersPropertyEditor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/MilliLittersPropertyEditor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/MilliLittersPropertyEditor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/PizzaService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/PizzaService.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/PizzaService.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/PizzaService.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.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
+

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/PizzaService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/PizzaService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/PizzaService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/QNameService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/QNameService.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/QNameService.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/QNameService.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.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;
+    }
+
+
+}

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/QNameService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/QNameService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/QNameService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/Recipe.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/Recipe.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/Recipe.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/Recipe.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.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;
+    }
+
+}

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/Recipe.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/Recipe.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/Recipe.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/RecipeService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/RecipeService.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/RecipeService.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/RecipeService.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.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;
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/RecipeService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/RecipeService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/RecipeService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/RestaurantService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/RestaurantService.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/RestaurantService.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/RestaurantService.java Tue Jan  5 19:31:05 2010
@@ -0,0 +1,95 @@
+/**
+ * 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.blueprint.example;
+
+import javax.xml.namespace.QName;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * An owner POJO used for testing out nested properties
+ * 
+ * @org.apache.xbean.XBean namespace="http://xbean.apache.org/schemas/pizza" element="restaurant"
+ *   description="A Restaurant thingy"
+ *
+ * @author James Strachan
+ * @version $Id$
+ * @since 2.0
+ */
+public class RestaurantService {
+
+    private PizzaService favourite;
+    private List dinnerMenu;
+    private PizzaService[] lunchMenu;
+    private Set<PizzaService> snackMenu;
+    private QName serviceName;
+    private URI uri;
+
+    /**
+     * @org.apache.xbean.Property nestedType="org.apache.xbean.blueprint.example.PizzaService"
+     */
+    public List getDinnerMenu() {
+        return dinnerMenu;
+    }
+
+    public void setDinnerMenu(List dinnerMenu) {
+        this.dinnerMenu = dinnerMenu;
+    }
+
+    public PizzaService[] getLunchMenu() {
+        return lunchMenu;
+    }
+
+    public void setLunchMenu(PizzaService[] lunchMenu) {
+        this.lunchMenu = lunchMenu;
+    }
+
+    public Set<PizzaService> getSnackMenu() {
+        return snackMenu;
+    }
+
+    public void setSnackMenu(Set<PizzaService> snackMenu) {
+        this.snackMenu = snackMenu;
+    }
+
+    public PizzaService getFavourite() {
+        return favourite;
+    }
+
+    public void setFavourite(PizzaService favourite) {
+        this.favourite = favourite;
+    }
+
+    public QName getServiceName() {
+        return serviceName;
+    }
+
+    public void setServiceName(QName name) {
+        this.serviceName = name;
+    }
+
+    public URI getUri() {
+        return uri;
+    }
+
+    public void setUri(URI uri) {
+        this.uri = uri;
+    }
+
+}

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/RestaurantService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/RestaurantService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/RestaurantService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SaladService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SaladService.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SaladService.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SaladService.java Tue Jan  5 19:31:05 2010
@@ -0,0 +1,62 @@
+/**
+ * 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.blueprint.example;
+
+/**
+ * Basic salad.
+ * @org.apache.xbean.XBean
+ * 
+ * @author Dain Sundstrom
+ * @version $Id$
+ * @since 1.0
+ */
+
+// START SNIPPET: bean
+public class SaladService {
+    private final String dressing;
+    private final String size;
+    private final boolean crouton;
+
+    public SaladService(String dressing, String size, boolean crouton) {
+        this.dressing = dressing;
+        this.size = size;
+        this.crouton = crouton;
+    }
+
+    /**
+     * Dressing What type of dressing do you want?
+     */
+    public String getDressing() {
+        return dressing;
+    }
+
+    /**
+     * What size do you want?
+     */
+    public String getSize() {
+        return size;
+    }
+
+    /**
+     * Do you want crutons on that?
+     * @org.apache.xbean.Property alias="addCroutons"
+     */
+    public boolean isCrouton() {
+        return crouton;
+    }
+}
+// END SNIPPET: bean

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SaladService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SaladService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SaladService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SocketAddressFactory.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SocketAddressFactory.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SocketAddressFactory.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SocketAddressFactory.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.example;
+
+import java.net.SocketAddress;
+import java.net.InetSocketAddress;
+
+/**
+ * @org.apache.xbean.XBean element="socketAddress" contentProperty="value"
+ */
+public class SocketAddressFactory {
+    /**
+     * @org.apache.xbean.FactoryMethod
+     */
+    public static SocketAddress create(String value) {
+        return new InetSocketAddress(value, 42);
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SocketAddressFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SocketAddressFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SocketAddressFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SocketService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SocketService.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SocketService.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SocketService.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.example;
+
+import java.net.SocketAddress;
+import java.util.List;
+
+/**
+ * @org.apache.xbean.XBean element="socketService"
+ */
+public class SocketService {
+    private List<SocketAddress> addresses;
+
+    public List<SocketAddress> getAddresses() {
+        return addresses;
+    }
+
+    public void setAddresses(List<SocketAddress> addresses) {
+        this.addresses = addresses;
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SocketService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SocketService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SocketService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SoupService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SoupService.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SoupService.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SoupService.java Tue Jan  5 19:31:05 2010
@@ -0,0 +1,83 @@
+/**
+ * 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.blueprint.example;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @org.apache.xbean.XBean element="soup"
+ *  description="This is a tasty soup"
+ *
+ * @author Dain Sundstrom
+ * @version $Id$
+ * @since 2.0
+ */
+
+// START SNIPPET: bean
+public class SoupService {
+    private static final Log log = LogFactory.getLog(SoupService.class);
+
+    /**
+     * @org.apache.xbean.FactoryMethod
+     */
+    public static SoupService newSoup(String type) {
+        return new SoupService(type, System.currentTimeMillis());
+    }
+
+    private final String type;
+    private final long createTime;
+    private boolean exists = false;
+
+    private SoupService(String type, long createTime) {
+        this.type = type;
+        this.createTime = createTime;
+    }
+
+    /**
+     * @org.apache.xbean.InitMethod
+     */
+    public void make() {
+        log.info("Making " + type + "soup");
+        exists = true;
+    }
+
+    /**
+     * @org.apache.xbean.DestroyMethod
+     */
+    public void eat() {
+        log.info("Mummmm " + type + "soup is yummie!");
+        exists = false;
+    }
+
+    public boolean exists() {
+        return exists;
+    }
+
+    /**
+     * What type of soup would you like?
+     */
+    public String getSoupType() {
+        return type;
+    }
+
+    public long getCreateTime() {
+        return createTime;
+    }
+}
+// END SNIPPET: bean
+

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SoupService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SoupService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/SoupService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/VodkaService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/VodkaService.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/VodkaService.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/VodkaService.java Tue Jan  5 19:31:05 2010
@@ -0,0 +1,63 @@
+/**
+ * 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.blueprint.example;
+
+/**
+ * It comes from a potatoe, it must be good.
+ * 
+ * @org.apache.xbean.XBean element="vodka"
+ * 
+ * @author Dan Diephouse
+ * @version $Id: VodkaService.java 434369 2006-08-24 10:24:21Z gnodet $
+ * @since 2.0
+ */
+
+// START SNIPPET: bean
+public class VodkaService {
+    private String id;
+    private String name;
+    private Class vodkaClass;
+    
+    public VodkaService() {
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Class getVodkaClass() {
+        return vodkaClass;
+    }
+
+    public void setVodkaClass(Class vodkaClass) {
+        this.vodkaClass = vodkaClass;
+    }
+}
+// END SNIPPET: bean
+

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/VodkaService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/VodkaService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/VodkaService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/WineService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/WineService.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/WineService.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/WineService.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.example;
+
+/**
+ * A drop of nice
+ * 
+ * @org.apache.xbean.XBean element="wine"
+ * 
+ * @author James Strachan
+ * @version $Id$
+ * @since 2.0
+ */
+
+// START SNIPPET: bean
+public class WineService {
+    private String id;
+    private String name;
+
+    public WineService(String id, String name) {
+        this.id = id;
+        this.name = name;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public String getName() {
+        return name;
+    }
+}
+// END SNIPPET: bean
+

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/WineService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/WineService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/example/WineService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/generator/CheeseService.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/generator/CheeseService.java?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/generator/CheeseService.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/generator/CheeseService.java Tue Jan  5 19:31:05 2010
@@ -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.blueprint.generator;
+
+/**
+ * Cheezy goodness
+ *
+ * @org.apache.xbean.XBean element="cheese"
+ *
+ * @author Dain Sundstrom
+ * @version $Id$
+ */
+public class CheeseService {
+    private String id;
+    private String name;
+
+    private long volume;
+    
+    public CheeseService(String id, String name) {
+        this.id = id;
+        this.name = name;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public String getName() {
+        return name;
+    }
+    
+    public long getVolumeWithPropertyEditor() {
+    	return volume;
+    }
+    
+    /**
+    * @org.apache.xbean.Property propertyEditor="org.apache.xbean.blueprint.example.MilliLittersPropertyEditor"
+    */
+    public void setVolumeWithPropertyEditor(long volume) {
+    	this.volume = volume;
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/generator/CheeseService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/generator/CheeseService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/generator/CheeseService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 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=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/generator/ModelTest.java (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/generator/ModelTest.java Tue Jan  5 19:31:05 2010
@@ -0,0 +1,212 @@
+/**
+ * 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.blueprint.generator;
+
+import junit.framework.TestCase;
+import org.apache.xbean.blueprint.example.BeerService;
+import org.xml.sax.*;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.beans.PropertyEditorManager;
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * @author Dain Sundstrom
+ * @version $Id$
+ * @since 1.0
+ */
+public class ModelTest extends TestCase {
+    private static final String DEFAULT_NAMESPACE = "http://xbean.apache.org/test";
+
+    public void testQdox() throws Exception{
+        String basedir = System.getProperties().getProperty("basedir", ".");
+        QdoxMappingLoader mappingLoader = new QdoxMappingLoader(DEFAULT_NAMESPACE, new File[] { new File(basedir, "/src/test/java")}, null);
+        NamespaceMapping defaultNamespace = getDefaultNamespace(mappingLoader);
+        assertNotNull(defaultNamespace);
+        ElementMapping element = defaultNamespace.getElement("pizza");
+        assertNotNull(element);
+        AttributeMapping attribute = element.getAttribute("myTopping");
+        assertNotNull(attribute);
+        assertEquals("topping", attribute.getPropertyName());
+
+        ElementMapping beer = defaultNamespace.getElement("beer");
+        assertNotNull(beer);
+        AttributeMapping beerId = beer.getAttribute("id");
+        assertNotNull(beerId);
+        AttributeMapping beerName = beer.getAttribute("name");
+        assertNotNull(beerName);
+
+        ElementMapping recipeService = defaultNamespace.getElement("recipe-service");
+        assertNotNull(recipeService);
+
+        Map flatCollections = recipeService.getFlatCollections();
+        assertNotNull(flatCollections);
+        assertEquals(1, flatCollections.size());
+        
+        ElementMapping cheese = defaultNamespace.getElement("cheese");
+        assertNotNull(cheese);
+        AttributeMapping volume = cheese.getAttribute("volumeWithPropertyEditor");
+        assertNotNull(volume);
+        assertNotNull(volume.getPropertyEditor());
+        assertEquals(volume.getType().getName(), "long");
+        
+        // validate xsd has string for attribute VolumeWithPropertyEditor
+        final AtomicBoolean gotExpected = new AtomicBoolean(false);
+        XsdGenerator generator = new XsdGenerator(null);
+        generator.generateSchema(new PrintWriter("dummy") {
+            @Override
+            public void println(String x) {
+                if (x.indexOf("volumeWithPropertyEditor") != -1) {
+                    if (x.indexOf("xs:string") != -1) {
+                        gotExpected.set(true);
+                    }
+                }
+            }
+        }, defaultNamespace);
+
+        assertTrue("xsd with string got genereated", gotExpected.get());
+    }
+
+    public void testQdoxExcludeClass() throws Exception{
+        String basedir = System.getProperties().getProperty("basedir", ".");
+        QdoxMappingLoader mappingLoader = new QdoxMappingLoader(DEFAULT_NAMESPACE,
+                new File[] { new File(basedir, "/src/test/java")},
+                new String[] { BeerService.class.getName() } );
+
+        NamespaceMapping defaultNamespace = getDefaultNamespace(mappingLoader);
+        assertNotNull(defaultNamespace);
+
+        ElementMapping element = defaultNamespace.getElement("pizza");
+        assertNotNull(element);
+        ElementMapping beer = defaultNamespace.getElement("beer");
+        assertNull(beer);
+    }
+
+    public void testQdoxExcludePackage() throws Exception{
+        String basedir = System.getProperties().getProperty("basedir", ".");
+        QdoxMappingLoader mappingLoader = new QdoxMappingLoader(DEFAULT_NAMESPACE,
+                new File[] { new File(basedir, "/src/test/java")},
+                new String[] { "org.apache.xbean.blueprint.example" } );
+
+        NamespaceMapping defaultNamespace = getDefaultNamespace(mappingLoader);
+        assertNotNull(defaultNamespace);
+
+        ElementMapping element = defaultNamespace.getElement("pizza");
+        assertNull(element);
+        ElementMapping beer = defaultNamespace.getElement("beer");
+        assertNull(beer);
+        ElementMapping cheese = defaultNamespace.getElement("cheese");
+        assertNotNull(cheese);
+    }
+
+    private NamespaceMapping getDefaultNamespace(QdoxMappingLoader mappingLoader) throws IOException {
+        Set namespaces = mappingLoader.loadNamespaces();
+        assertFalse(namespaces.isEmpty());
+
+        NamespaceMapping defaultNamespace = null;
+        for (Iterator iterator = namespaces.iterator(); iterator.hasNext();) {
+            NamespaceMapping namespaceMapping = (NamespaceMapping) iterator.next();
+            if (namespaceMapping.getNamespace().equals(DEFAULT_NAMESPACE)) {
+                defaultNamespace = namespaceMapping;
+                break;
+            }
+        }
+        return defaultNamespace;
+    }
+
+    public void testPropertyEditor() {
+        List editorSearchPath = new LinkedList(Arrays.asList(PropertyEditorManager.getEditorSearchPath()));
+        editorSearchPath.add("org.apache.xbean.blueprint.context.impl");
+        PropertyEditorManager.setEditorSearchPath((String[]) editorSearchPath.toArray(new String[editorSearchPath.size()]));
+        assertTrue(Utils.isSimpleType(Type.newSimpleType("java.net.URI")));
+    }
+
+    public void testXSDValidation() throws Exception{
+
+        InputStream xmlFile = ModelTest.class.getResourceAsStream("model-test-xsd-validation.xml");
+        File xsd = generateXSD();
+        validate(xmlFile, xsd);
+
+    }
+
+    private File generateXSD() throws IOException {
+        String basedir = System.getProperties().getProperty("basedir", ".");
+        final File targetXSD = new File(basedir, "target/test-data/model-test.xsd");
+        targetXSD.getParentFile().mkdirs();
+        QdoxMappingLoader mappingLoader = new QdoxMappingLoader(DEFAULT_NAMESPACE, new File[] { new File(basedir, "/src/test/java")}, null);
+        NamespaceMapping namespaceMapping = getDefaultNamespace(mappingLoader);
+        XsdGenerator generator = new XsdGenerator(targetXSD);
+        generator.setLog(new LogFacade() {
+            public void log(String message) {
+            }
+            public void log(String message, int level) {
+            }
+        });
+        generator.generate(namespaceMapping);
+        return targetXSD;
+    }
+
+    private void validate(InputStream xml, final File xsd) throws ParserConfigurationException, SAXException, IOException {
+        assertNotNull(xml);
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        factory.setNamespaceAware(true);
+        factory.setValidating(true);
+        factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+
+        final AtomicReference<SAXParseException> error = new AtomicReference<SAXParseException>();
+
+        DocumentBuilder builder = factory.newDocumentBuilder();
+
+        builder.setErrorHandler(new ErrorHandler() {
+            public void warning(SAXParseException exception) throws SAXException {
+                error.set(exception);
+            }
+
+            public void error(SAXParseException exception) throws SAXException {
+                error.set(exception);
+            }
+
+            public void fatalError(SAXParseException exception) throws SAXException {
+                error.set(exception);
+            }
+        });
+        //TODO blueprint what ??
+//        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;
+//            }
+//        });
+        builder.parse(xml);
+        if (error.get() != null) {
+            error.get().printStackTrace();
+            fail("Validateion failed: " + error.get().getMessage());
+        }
+    }
+}

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/generator/ModelTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/generator/ModelTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/java/org/apache/xbean/blueprint/generator/ModelTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/component
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/component?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/component (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/component Tue Jan  5 19:31:05 2010
@@ -0,0 +1,21 @@
+# 
+# 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.
+#
+#
+container=org.apache.xbean.spring.example.ContainerBean
+inner=org.apache.xbean.spring.example.InnerBean

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/pizza-simple
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/pizza-simple?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/pizza-simple (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/pizza-simple Tue Jan  5 19:31:05 2010
@@ -0,0 +1,29 @@
+# 
+# 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.
+#
+#
+# START SNIPPET: config
+
+# the default package that POJOs are in
+package = org.apache.xbean.spring.example
+
+# Mapping of XML Element localNames to classes 
+pizza = org.apache.xbean.spring.example.PizzaService
+restaurant = org.apache.xbean.spring.example.RestaurantService
+
+# END SNIPPET: config

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/restaurant
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/restaurant?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/restaurant (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/restaurant Tue Jan  5 19:31:05 2010
@@ -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.
+#
+#
+# START SNIPPET: config
+
+# the default package that POJOs are in
+package = org.apache.xbean.spring.example
+
+# Mapping of XML Element localNames to classes 
+pizza = org.apache.xbean.spring.example.PizzaService
+restaurant = org.apache.xbean.spring.example.RestaurantService
+
+# Mapping of XML Attributes to property names
+pizza.alias.myTopping = topping
+
+# Mapping of nested bean properties
+restaurant.dinnerMenu.list = dinnerMenu
+restaurant.favourite = favourite
+
+# END SNIPPET: config

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/salad
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/salad?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/salad (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/salad Tue Jan  5 19:31:05 2010
@@ -0,0 +1,34 @@
+# 
+# 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.
+#
+#
+# START SNIPPET: config
+
+# the default package that POJOs are in
+package = org.apache.xbean.spring.example
+
+# Mapping of XML Element localNames to classes 
+salad = org.apache.xbean.spring.example.SaladService
+
+# Mapping of XML Attributes to property names
+salad.alias.addCroutons = crouton
+
+# Mapping of constructor argument names
+org.apache.xbean.spring.example.SaladService(java.lang.String,java.lang.String,boolean).parameterNames=dressing size crouton
+
+# END SNIPPET: config

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/soup
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/soup?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/soup (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/resources/META-INF/services/org/apache/xbean/blueprint/http/xbean.apache.org/schemas/soup Tue Jan  5 19:31:05 2010
@@ -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.
+#
+#
+# START SNIPPET: config
+
+# the default package that POJOs are in
+package = org.apache.xbean.spring.example
+
+# Mapping of XML Element localNames to classes 
+soup = org.apache.xbean.spring.example.SoupService
+
+# Mapping of life-cycle methods
+soup.initMethod = make
+soup.destroyMethod = eat
+soup.factoryMethod = newSoup
+
+# Mapping of constructor argument names
+org.apache.xbean.spring.example.SoupService.newSoup(java.lang.String).parameterNames=type
+
+# END SNIPPET: config

Added: geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/bad-attribute.xml
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/bad-attribute.xml?rev=896187&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/bad-attribute.xml (added)
+++ geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/bad-attribute.xml Tue Jan  5 19:31:05 2010
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns:b="http://xbean.apache.org/schemas/pizza">
+  
+  <b:beer id="123" unknown="Stella" />
+  
+</beans>

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/bad-attribute.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/bad-attribute.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/xbean/trunk/xbean-blueprint/src/test/resources/org/apache/xbean/blueprint/context/bad-attribute.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml