You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by zo...@apache.org on 2011/02/27 18:47:18 UTC

svn commit: r1075094 [15/17] - in /aries/tags/blueprint-0.1-incubating: ./ blueprint-api/ blueprint-api/src/ blueprint-api/src/main/ blueprint-api/src/main/appended-resources/ blueprint-api/src/main/appended-resources/META-INF/ blueprint-api/src/main/j...

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/ListenerA.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/ListenerA.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/ListenerA.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/ListenerA.java Sun Feb 27 17:47:08 2011
@@ -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.aries.blueprint.pojos;
+
+import org.osgi.framework.ServiceReference;
+
+public class ListenerA {
+
+    public void bind(ServiceReference ref) {
+
+    }
+
+    public void unbind(ServiceReference ref) {
+        
+    }
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/Multiple.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/Multiple.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/Multiple.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/Multiple.java Sun Feb 27 17:47:08 2011
@@ -0,0 +1,89 @@
+/*
+ * 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.aries.blueprint.pojos;
+
+import java.util.Map;
+import java.util.Properties;
+
+public class Multiple {
+
+    private int intValue = -1;
+    private Integer integerValue = null;
+    private String stringValue = null;
+    private Map map;
+    private Properties properties;
+
+    public Multiple() {
+    }
+
+    public Multiple(Map map) {
+        this.map = map;
+    }
+
+    public Multiple(Properties props) {
+        this.properties = props;
+    }
+
+    public Multiple(String arg) {   
+        stringValue = arg;
+    }
+
+    public Multiple(int arg) {   
+        intValue = arg;
+    }
+    
+    public Multiple(Integer arg) {   
+        integerValue = arg;
+    }
+
+    public Map getMap() {
+        return map;
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public int getInt() {
+        return intValue;
+    }
+    
+    public Integer getInteger() {
+        return integerValue;
+    }
+
+    public String getString() {
+        return stringValue;
+    }
+
+    public void setAmbiguous(int v) {
+    }
+
+    public void setAmbiguous(Object v) {
+    }
+
+    public static Multiple create(String arg1, Integer arg2) {
+        return new Multiple(arg2.intValue());
+    }
+    
+    public static Multiple create(String arg1, Boolean arg2) {
+        return new Multiple(arg1 + "-boolean");
+    }
+    
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoA.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoA.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoA.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoA.java Sun Feb 27 17:47:08 2011
@@ -0,0 +1,125 @@
+/*
+ * 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.aries.blueprint.pojos;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+public class PojoA implements InterfaceA {
+
+    private PojoB pojob;
+    private List list;
+    private Set set;
+    private Map map;
+    private Number number;
+    private Properties props;
+    
+    private Object[] array;
+    private int[] intArray;
+    private Number[] numberArray;
+
+    public PojoA() {
+    }
+
+    public PojoA(PojoB pojob) {
+        this.pojob = pojob;
+    }
+
+    public PojoB getPojob() {
+        return pojob;
+    }
+
+    public List getList() {
+        return list;
+    }
+
+    public void setList(List list) {
+        this.list = list;
+    }
+
+    public Set getSet() {
+        return set;
+    }
+
+    public void setSet(Set set) {
+        this.set = set;
+    }
+
+    public Map getMap() {
+        return map;
+    }
+
+    public void setMap(Map map) {
+        this.map = map;
+    }
+
+    public Properties getProps() {
+        return props;
+    }
+    
+    public void setProps(Properties props) {
+        this.props = props;
+    }
+    
+    public void setPojob(PojoB pojob) {
+        this.pojob = pojob;
+    }
+
+    public void setNumber(Number number) {
+        this.number = number;
+    }
+    
+    public Number getNumber() {
+        return number;
+    }
+    
+    public void setArray(Object[] array) {
+        this.array = array;
+    }
+    
+    public Object[] getArray() {
+        return array;
+    }
+    
+    public int[] getIntArray() {
+        return intArray;
+    }
+    
+    public void setIntArray(int[] array) {
+        intArray = array;
+    }
+    
+    public Number[] getNumberArray() {
+        return numberArray;
+    }
+    
+    public void setNumberArray(Number[] numberArray) {
+        this.numberArray = numberArray;
+    }
+    
+    public void start() {
+        System.out.println("Starting component " + this);
+    }
+
+    public void stop() {
+        System.out.println("Stopping component " + this);
+    }
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoB.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoB.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoB.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoB.java Sun Feb 27 17:47:08 2011
@@ -0,0 +1,92 @@
+/*
+ * 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.aries.blueprint.pojos;
+
+import java.net.URI;
+import java.util.List;
+
+public class PojoB {
+
+    private List<Object> objects;
+    private URI uri;
+    private int number;
+    private BeanD bean;
+    
+    private boolean initCalled;
+    private boolean destroyCalled;
+    
+    public PojoB() {
+    }
+    
+    public PojoB(URI uri, int number) {
+        this.uri = uri;
+        this.number = number;
+    }
+
+    public URI getUri() {
+        return uri;
+    }
+
+    public void setUri(URI uri) {
+        this.uri = uri;
+    }
+
+    public List<Object> getObjects() {
+        return objects;
+    }
+
+    public void setObjects(List<Object> objects) {
+        this.objects = objects;
+    }
+
+    public void init() {
+        initCalled = true;
+    }
+    
+    public boolean getInitCalled() {
+        return initCalled;
+    }
+    
+    public void destroy() {
+        destroyCalled = true;
+    }
+    
+    public boolean getDestroyCalled() {
+        return destroyCalled;
+    }
+    
+    public int getNumber() {
+        return number;
+    }
+    
+    public BeanD getBean() {
+        if (bean == null) {
+            bean = new BeanD();
+        }
+        return bean;
+    }
+    
+    public static PojoB createStatic(URI uri, int number) {
+        return new PojoB(URI.create(uri + "-static"), number);
+    }
+    
+    public PojoB createDynamic(URI uri, int number) {
+        return new PojoB(URI.create(uri + "-dynamic"), number);
+    }
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoCircular.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoCircular.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoCircular.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoCircular.java Sun Feb 27 17:47:08 2011
@@ -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.aries.blueprint.pojos;
+
+public class PojoCircular {
+
+    private PojoCircular circular;
+
+    public PojoCircular() {        
+    }
+    
+    public PojoCircular(PojoCircular circular) {
+        this.circular = circular;
+    }
+    
+    public PojoCircular getCircular() {
+        return circular;
+    }
+
+    public void setCircular(PojoCircular circular) {
+        this.circular = circular;
+    }
+    
+    public void init() {        
+    }
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoGenerics.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoGenerics.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoGenerics.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoGenerics.java Sun Feb 27 17:47:08 2011
@@ -0,0 +1,77 @@
+/*
+ * 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.aries.blueprint.pojos;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class PojoGenerics {
+
+    private List<Integer> list;
+    private Set<Long> set;
+    private Map<Short, Boolean> map;
+
+    public PojoGenerics() {
+    }
+    
+    public PojoGenerics(List<Integer> list) {
+        this.list = list;        
+    }
+    
+    public PojoGenerics(Set<Long> set) {
+        this.set = set;        
+    }
+    
+    public PojoGenerics(Map<Short, Boolean> map) {
+        this.map = map;
+    }
+
+    public List<Integer> getList() {
+        return list;
+    }
+
+    public void setList(List<Integer> list) {
+        this.list = list;
+    }
+
+    public Set<Long> getSet() {
+        return set;
+    }
+
+    public void setSet(Set<Long> set) {
+        this.set = set;
+    }
+
+    public Map<Short, Boolean> getMap() {
+        return map;
+    }
+
+    public void setMap(Map<Short, Boolean> map) {
+        this.map = map;
+    }
+     
+    public void start() {
+        System.out.println("Starting component " + this);
+    }
+
+    public void stop() {
+        System.out.println("Stopping component " + this);
+    }
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoListener.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoListener.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoListener.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoListener.java Sun Feb 27 17:47:08 2011
@@ -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.aries.blueprint.pojos;
+
+import java.util.Map;
+
+import org.osgi.framework.ServiceRegistration;
+
+public class PojoListener {
+
+    private ServiceRegistration registration;
+    
+    public ServiceRegistration getService() {
+        return registration;
+    }
+    
+    public void setService(ServiceRegistration registration) {
+        this.registration = registration;
+    }
+    
+    public void register(PojoB pojo, Map props) {        
+    }
+    
+    public void unregister(PojoB pojo, Map props) {        
+    }
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoRecursive.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoRecursive.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoRecursive.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PojoRecursive.java Sun Feb 27 17:47:08 2011
@@ -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.aries.blueprint.pojos;
+
+import org.osgi.service.blueprint.container.BlueprintContainer;
+
+public class PojoRecursive {
+
+    private BlueprintContainer container;
+    private String component;
+
+    public PojoRecursive(BlueprintContainer container, String component) {
+        this.container = container;
+        this.component = component;
+    }
+    
+    public PojoRecursive(BlueprintContainer container, String component, int foo) {
+        this.container = container;
+        this.component = component;
+        container.getComponentInstance(component);
+    }
+    
+    public void setFoo(int foo) {
+        container.getComponentInstance(component);
+    }
+    
+    public void init() {    
+        container.getComponentInstance(component);
+    }
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/Primavera.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/Primavera.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/Primavera.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/Primavera.java Sun Feb 27 17:47:08 2011
@@ -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.aries.blueprint.pojos;
+
+interface Product<T> {
+    void setProperty(T value);
+}
+
+public class Primavera implements Product<String> {
+    public String prop;
+
+    public void setProperty(String value) {
+        prop = value;
+    }    
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PrimaveraFactory.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PrimaveraFactory.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PrimaveraFactory.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/pojos/PrimaveraFactory.java Sun Feb 27 17:47:08 2011
@@ -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.aries.blueprint.pojos;
+
+interface GenericFactory<T,U> {
+    T getObject();
+    T getObject(U value);
+}
+
+public class PrimaveraFactory implements GenericFactory<Primavera,String> {
+
+    public Primavera getObject() {
+        return new Primavera();
+    }
+
+    public Primavera getObject(String value) {
+        Primavera res = new Primavera();
+        res.setProperty(value);
+        return res;
+    }
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxySubclassGeneratorTest.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxySubclassGeneratorTest.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxySubclassGeneratorTest.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxySubclassGeneratorTest.java Sun Feb 27 17:47:08 2011
@@ -0,0 +1,385 @@
+/*
+ * 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.aries.blueprint.proxy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ProxySubclassGeneratorTest
+{
+  private static final Class<?> TEST_CLASS = ProxyTestClassGeneral.class;
+  private static final Class<?> FINAL_METHOD_CLASS = ProxyTestClassFinalMethod.class;
+  private static final Class<?> FINAL_CLASS = ProxyTestClassFinal.class;
+  private static final Class<?> GENERIC_CLASS = ProxyTestClassGeneric.class;
+  private static final Class<?> COVARIANT_CLASS = ProxyTestClassCovariantOverride.class;
+  private static ProxySubclassMethodHashSet<String> expectedMethods = new ProxySubclassMethodHashSet<String>(
+      12);
+  private InvocationHandler ih = null;
+  private Class<?> generatedProxySubclass = null;
+  private Object o = null;
+
+  /**
+   * @throws java.lang.Exception
+   */
+  @Before
+  public void setUp() throws Exception
+  {
+    ih = new FakeInvocationHandler();
+    ((FakeInvocationHandler)ih).setDelegate(TEST_CLASS.newInstance());
+    generatedProxySubclass = getGeneratedSubclass();
+    o = getSubclassInstance(generatedProxySubclass);
+  }
+
+  /**
+   * This test uses the ProxySubclassGenerator to generate and load a subclass
+   * of the specified TEST_CLASS.
+   * 
+   * Once the subclass is generated we check that it wasn't null. We check
+   * that the InvocationHandler constructor doesn't return a null object
+   * either
+   * 
+   * Test method for
+   * {@link org.apache.aries.blueprint.proxy.ProxySubclassGenerator#generateAndLoadSubclass()}
+   * .
+   */
+  @Test
+  public void testGenerateAndLoadSubclass() throws Exception
+  {
+    assertNotNull("Generated proxy subclass was null", generatedProxySubclass);
+    assertNotNull("Generated proxy subclass instance was null", o);
+  }
+
+  /**
+   * Test that the methods found declared on the generated proxy subclass are
+   * the ones that we expect.
+   */
+  @Test
+  public void testExpectedMethods() throws Exception
+  {
+    Class<?> superclass = TEST_CLASS;
+
+    do {
+      Method[] declaredMethods = superclass.getDeclaredMethods();
+      List<Method> listOfDeclaredMethods = new ArrayList<Method>();
+      for (Method m : declaredMethods) {
+        int i = m.getModifiers();
+        if (Modifier.isPrivate(i) || Modifier.isFinal(i)) {
+          // private or final don't get added
+        } else if (!(Modifier.isPublic(i) || Modifier.isPrivate(i) || Modifier.isProtected(i))) {
+          // the method is default visibility, check the package
+          if (m.getDeclaringClass().getPackage().equals(TEST_CLASS.getPackage())) {
+            // default vis with same package gets added
+            listOfDeclaredMethods.add(m);
+          }
+        } else {
+          listOfDeclaredMethods.add(m);
+        }
+      }
+
+      declaredMethods = listOfDeclaredMethods.toArray(new Method[] {});
+      ProxySubclassMethodHashSet<String> foundMethods = new ProxySubclassMethodHashSet<String>(
+          declaredMethods.length);
+      foundMethods.addMethodArray(declaredMethods);
+      // as we are using a set we shouldn't get duplicates
+      expectedMethods.addAll(foundMethods);
+      superclass = superclass.getSuperclass();
+    } while (superclass != null);
+
+    // add the getter and setter for the invocation handler to the expected
+    // set
+    // and the unwrapObject method
+    Method[] ihMethods = new Method[] {
+        generatedProxySubclass.getMethod("setInvocationHandler",
+            new Class[] { InvocationHandler.class }),
+        generatedProxySubclass.getMethod("getInvocationHandler", new Class[] {}) };
+    expectedMethods.addMethodArray(ihMethods);
+
+    Method[] generatedProxySubclassMethods = generatedProxySubclass.getDeclaredMethods();
+    ProxySubclassMethodHashSet<String> generatedMethods = new ProxySubclassMethodHashSet<String>(
+        generatedProxySubclassMethods.length);
+    generatedMethods.addMethodArray(generatedProxySubclassMethods);
+
+    // check that all the methods we have generated were expected
+    for (String gen : generatedMethods) {
+      assertTrue("Unexpected method: " + gen, expectedMethods.contains(gen));
+    }
+    // check that all the expected methods were generated
+    for (String exp : expectedMethods) {
+      assertTrue("Method was not generated: " + exp, generatedMethods.contains(exp));
+    }
+    // check the sets were the same
+    assertEquals("Sets were not the same", expectedMethods, generatedMethods);
+
+  }
+
+  /**
+   * Test a basic method invocation on the proxy subclass
+   */
+  @Test
+  public void testMethodInvocation() throws Exception
+  {
+    Method m = generatedProxySubclass.getDeclaredMethod("testMethod", new Class[] { String.class,
+        int.class, Object.class });
+    String x = "x";
+    String returned = (String) m.invoke(o, x, 1, new Object());
+    assertEquals("Object returned from invocation was not correct.", x, returned);
+  }
+
+  /**
+   * Test different argument types on a method invocation
+   */
+  @Test
+  public void testMethodArgs() throws Exception
+  {
+    Method m = generatedProxySubclass.getDeclaredMethod("testArgs", new Class[] { double.class,
+        short.class, long.class, char.class, byte.class, boolean.class });
+    Character xc = Character.valueOf('x');
+    String x = xc.toString();
+    String returned = (String) m.invoke(o, Double.MAX_VALUE, Short.MIN_VALUE, Long.MAX_VALUE, xc
+        .charValue(), Byte.MIN_VALUE, false);
+    assertEquals("Object returned from invocation was not correct.", x, returned);
+  }
+
+  /**
+   * Test a method that returns void
+   */
+  @Test
+  public void testReturnVoid() throws Exception
+  {
+    Method m = generatedProxySubclass.getDeclaredMethod("testReturnVoid", new Class[] {});
+    m.invoke(o);
+  }
+
+  /**
+   * Test a method that returns an int
+   */
+  @Test
+  public void testReturnInt() throws Exception
+  {
+    Method m = generatedProxySubclass.getDeclaredMethod("testReturnInt", new Class[] {});
+    Integer returned = (Integer) m.invoke(o);
+    assertEquals("Expected object was not returned from invocation", Integer.valueOf(17), returned);
+  }
+
+  /**
+   * Test a method that returns an Integer
+   */
+  @Test
+  public void testReturnInteger() throws Exception
+  {
+    Method m = generatedProxySubclass.getDeclaredMethod("testReturnInteger", new Class[] {});
+    Integer returned = (Integer) m.invoke(o);
+    assertEquals("Expected object was not returned from invocation", Integer.valueOf(1), returned);
+  }
+
+  /**
+   * Test a public method declared higher up the superclass hierarchy
+   */
+  @Test
+  public void testPublicHierarchyMethod() throws Exception
+  {
+    Method m = generatedProxySubclass.getDeclaredMethod("bMethod", new Class[] {});
+    m.invoke(o);
+  }
+
+  /**
+   * Test a protected method declared higher up the superclass hierarchy
+   */
+  @Test
+  public void testProtectedHierarchyMethod() throws Exception
+  {
+    Method m = generatedProxySubclass.getDeclaredMethod("bProMethod", new Class[] {});
+    m.invoke(o);
+  }
+
+  /**
+   * Test a default method declared higher up the superclass hierarchy
+   */
+  @Test
+  public void testDefaultHierarchyMethod() throws Exception
+  {
+    Method m = generatedProxySubclass.getDeclaredMethod("bDefMethod", new Class[] {});
+    m.invoke(o);
+  }
+
+  /**
+   * Test a covariant override method
+   */
+  @Test
+  public void testCovariant() throws Exception
+  {
+    ((FakeInvocationHandler)ih).setDelegate(COVARIANT_CLASS.newInstance());
+    o = ProxySubclassGenerator.newProxySubclassInstance(COVARIANT_CLASS, ih);
+    generatedProxySubclass = o.getClass();
+    Method m = generatedProxySubclass.getDeclaredMethod("getCovariant", new Class[] {});
+    Object returned = m.invoke(o);
+    assertTrue("Object was of wrong type: " + returned.getClass().getSimpleName(), COVARIANT_CLASS
+        .isInstance(returned));
+  }
+
+  /**
+   * Test a method with generics
+   */
+  @Test
+  public void testGenerics() throws Exception
+  {
+    ((FakeInvocationHandler)ih).setDelegate(GENERIC_CLASS.newInstance());
+    o = ProxySubclassGenerator.newProxySubclassInstance(GENERIC_CLASS, ih);
+    generatedProxySubclass = o.getClass();
+    Method m = generatedProxySubclass.getDeclaredMethod("setSomething",
+        new Class[] { String.class });
+    m.invoke(o, "aString");
+    m = generatedProxySubclass.getDeclaredMethod("getSomething", new Class[] {});
+    Object returned = m.invoke(o);
+    assertTrue("Object was of wrong type", String.class.isInstance(returned));
+    assertEquals("String had wrong value", "aString", returned);
+  }
+
+  /**
+   * Test a method marked final
+   */
+  @Test
+  public void testFinalMethod() throws Exception
+  {
+    try {
+      ProxySubclassGenerator.getProxySubclass(FINAL_METHOD_CLASS);
+    } catch (FinalModifierException e) {
+      assertFalse("Should have found final method not final class", e.isFinalClass());
+    }
+  }
+
+  /**
+   * Test a class marked final
+   */
+  @Test
+  public void testFinalClass() throws Exception
+  {
+    try {
+      ProxySubclassGenerator.getProxySubclass(FINAL_CLASS);
+    } catch (FinalModifierException e) {
+      assertTrue("Should have found final class", e.isFinalClass());
+    }
+  }
+
+  /**
+   * Test that we don't generate classes twice
+   */
+  @Test
+  public void testRetrieveClass() throws Exception
+  {
+    Class<?> retrieved = ProxySubclassGenerator.getProxySubclass(TEST_CLASS);
+    assertNotNull("The new class was null", retrieved);
+    assertEquals("The same class was not returned", generatedProxySubclass, retrieved);
+
+  }
+
+  /**
+   * Test a private constructor
+   */
+  @Test
+  public void testPrivateConstructor() throws Exception
+  {
+    Object o = ProxySubclassGenerator.newProxySubclassInstance(
+        ProxyTestClassPrivateConstructor.class, ih);
+    assertNotNull("The new instance was null", o);
+
+  }
+  
+  /**
+   * Test object equality between real and proxy using a Collaborator
+   */
+  @Test
+  public void testObjectEquality() throws Exception
+  {
+    Object delegate = TEST_CLASS.newInstance();
+    InvocationHandler collaborator = new Collaborator(null, null, delegate);
+    Object o = ProxySubclassGenerator.newProxySubclassInstance(TEST_CLASS, collaborator);
+    //Calling equals on the proxy with an arg of the unwrapped object should be true
+    assertTrue("The proxy object should be equal to its delegate",o.equals(delegate));
+    InvocationHandler collaborator2 = new Collaborator(null, null, delegate);
+    Object o2 = ProxySubclassGenerator.newProxySubclassInstance(TEST_CLASS, collaborator2);
+    //The proxy of a delegate should equal another proxy of the same delegate
+    assertTrue("The proxy object should be equal to another proxy instance of the same delegate", o2.equals(o));
+  }
+  
+  private static class ProxyTestOverridesFinalize {
+      public boolean finalizeCalled = false;
+      
+      @Override
+      protected void finalize() {
+          finalizeCalled = true;
+      }
+  }
+  
+  @Test
+  public void testFinalizeNotCalled() throws Exception {
+      ProxyTestOverridesFinalize testObj = new ProxyTestOverridesFinalize();
+      InvocationHandler ih = new Collaborator(null, null, testObj);
+      Object o = ProxySubclassGenerator.newProxySubclassInstance(ProxyTestOverridesFinalize.class, ih);
+      
+      Method m = o.getClass().getDeclaredMethod("finalize");
+      m.setAccessible(true);
+      m.invoke(o);
+      
+      assertFalse(testObj.finalizeCalled);
+  }
+  
+
+  private Class<?> getGeneratedSubclass() throws Exception
+  {
+    return ProxySubclassGenerator.getProxySubclass(TEST_CLASS);
+  }
+
+  private Object getSubclassInstance(Class<?> clazz) throws Exception
+  {
+    return clazz.getConstructor(InvocationHandler.class).newInstance(ih);
+  }
+
+  private class FakeInvocationHandler implements InvocationHandler
+  {
+    private Object delegate = null;
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object,
+     * java.lang.reflect.Method, java.lang.Object[])
+     */
+    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+    {
+      Object result = method.invoke(delegate, args);
+      return result;
+    }
+
+    void setDelegate(Object delegate){
+      this.delegate = delegate;
+    }
+    
+  }
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassCovariant.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassCovariant.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassCovariant.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassCovariant.java Sun Feb 27 17:47:08 2011
@@ -0,0 +1,30 @@
+/*
+ * 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.aries.blueprint.proxy;
+
+public class ProxyTestClassCovariant
+{
+
+  //this method is here to make sure we don't break on covariant override
+  public ProxyTestClassCovariant getCovariant()
+  {
+    return this;
+  }
+
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassCovariantOverride.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassCovariantOverride.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassCovariantOverride.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassCovariantOverride.java Sun Feb 27 17:47:08 2011
@@ -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.
+ */
+package org.apache.aries.blueprint.proxy;
+
+public class ProxyTestClassCovariantOverride extends ProxyTestClassCovariant
+{
+  //this method is here to make sure we don't break on covariant override
+  public ProxyTestClassCovariantOverride getCovariant()
+  {
+    return this;
+  }
+
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassFinal.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassFinal.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassFinal.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassFinal.java Sun Feb 27 17:47:08 2011
@@ -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.
+ */
+package org.apache.aries.blueprint.proxy;
+
+public final class ProxyTestClassFinal
+{
+
+  void someMethod()
+  {
+
+  }
+
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassFinalMethod.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassFinalMethod.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassFinalMethod.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassFinalMethod.java Sun Feb 27 17:47:08 2011
@@ -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.aries.blueprint.proxy;
+
+public class ProxyTestClassFinalMethod
+{
+  public final void someFinalMethod()
+  {
+
+  }
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassGeneral.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassGeneral.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassGeneral.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassGeneral.java Sun Feb 27 17:47:08 2011
@@ -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.aries.blueprint.proxy;
+
+public class ProxyTestClassGeneral extends ProxyTestClassSuper
+{
+
+  public String testMethod(String x, int y, Object z)
+  {
+    somePrivateMethod();
+    return x;
+  }
+
+  public String testArgs(double a, short b, long c, char d, byte e, boolean f)
+  {
+    return Character.toString(d);
+  }
+
+  protected void testReturnVoid()
+  {
+  }
+
+  int testReturnInt()
+  {
+    return 17;
+  }
+
+  public Integer testReturnInteger()
+  {
+    return Integer.valueOf(1);
+  }
+
+  private void somePrivateMethod()
+  {
+
+  }
+
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassGeneric.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassGeneric.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassGeneric.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassGeneric.java Sun Feb 27 17:47:08 2011
@@ -0,0 +1,28 @@
+/*
+ * 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.aries.blueprint.proxy;
+
+public class ProxyTestClassGeneric extends ProxyTestClassGenericSuper<String>
+{
+
+  public void setSomething(String s)
+  {
+    super.setSomething(s);
+  }
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassGenericSuper.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassGenericSuper.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassGenericSuper.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassGenericSuper.java Sun Feb 27 17:47:08 2011
@@ -0,0 +1,35 @@
+/*
+ * 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.aries.blueprint.proxy;
+
+public class ProxyTestClassGenericSuper<T>
+{
+
+  T something = null;
+
+  public void setSomething(T something)
+  {
+    this.something = something;
+  }
+
+  public T getSomething()
+  {
+    return something;
+  }
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassPrivateConstructor.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassPrivateConstructor.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassPrivateConstructor.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassPrivateConstructor.java Sun Feb 27 17:47:08 2011
@@ -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.aries.blueprint.proxy;
+
+public class ProxyTestClassPrivateConstructor
+{
+  private ProxyTestClassPrivateConstructor()
+  {
+
+  }
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSuper.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSuper.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSuper.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassSuper.java Sun Feb 27 17:47:08 2011
@@ -0,0 +1,44 @@
+/*
+ * 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.aries.blueprint.proxy;
+
+public class ProxyTestClassSuper
+{
+
+  public void bMethod()
+  {
+    aPrivateMethod();
+  }
+
+  protected void bProMethod()
+  {
+
+  }
+
+  void bDefMethod()
+  {
+
+  }
+
+  private void aPrivateMethod()
+  {
+
+  }
+
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/utils/DynamicCollectionTest.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/utils/DynamicCollectionTest.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/utils/DynamicCollectionTest.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/utils/DynamicCollectionTest.java Sun Feb 27 17:47:08 2011
@@ -0,0 +1,113 @@
+/*
+ * 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.aries.blueprint.utils;
+
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+public class DynamicCollectionTest extends TestCase {
+
+    protected static final Object O0 = new Object();
+    protected static final Object O1 = new Object();
+    protected static final Object O2 = new Object();
+    protected static final Object O3 = new Object();
+
+    protected DynamicCollection<Object> collection;
+
+    protected void setUp() {
+        collection = new DynamicCollection<Object>();
+    }
+
+    public void testAddRemove() throws Exception {
+        assertEquals(0, collection.size());
+        assertTrue(collection.isEmpty());
+        collection.add(O0);
+        assertEquals(1, collection.size());
+        assertFalse(collection.isEmpty());
+        assertTrue(collection.contains(O0));
+        assertFalse(collection.contains(O1));
+        collection.clear();
+        assertEquals(0, collection.size());
+        collection.add(O0);
+        collection.add(O0);
+        assertEquals(2, collection.size());
+        assertTrue(collection.remove(O0));
+        assertEquals(1, collection.size());
+        assertTrue(collection.remove(O0));
+        assertEquals(0, collection.size());
+    }
+
+    public void testSimpleIterator() throws Exception {
+        collection.add(O0);
+
+        Iterator iterator = collection.iterator();
+        assertTrue(iterator.hasNext());
+        assertEquals(O0, iterator.next());
+        assertFalse(iterator.hasNext());
+    }
+
+    public void testAddWhileIterating() throws Exception {
+        Iterator iterator = collection.iterator();
+        assertFalse(iterator.hasNext());
+
+        collection.add(O0);
+        assertTrue(iterator.hasNext());
+        assertEquals(O0, iterator.next());
+        assertFalse(iterator.hasNext());
+    }
+
+    public void testRemoveElementWhileIterating() throws Exception {
+        collection.add(O0);
+        collection.add(O1);
+
+        Iterator iterator = collection.iterator();
+        assertTrue(iterator.hasNext());
+        collection.remove(O0);
+        assertEquals(O0, iterator.next());
+        assertTrue(iterator.hasNext());
+        assertEquals(O1, iterator.next());
+        assertFalse(iterator.hasNext());
+    }
+
+    public void testRemoveElementAfterWhileIterating() throws Exception {
+        collection.add(O0);
+        collection.add(O1);
+
+        Iterator iterator = collection.iterator();
+        assertTrue(iterator.hasNext());
+        assertEquals(O0, iterator.next());
+        collection.remove(O1);
+        assertFalse(iterator.hasNext());
+    }
+
+    public void testRemoveElementBeforeWhileIterating() throws Exception {
+        collection.add(O0);
+        collection.add(O1);
+
+        Iterator iterator = collection.iterator();
+        assertTrue(iterator.hasNext());
+        assertEquals(O0, iterator.next());
+        collection.remove(O0);
+        assertTrue(iterator.hasNext());
+        assertEquals(O1, iterator.next());
+        assertFalse(iterator.hasNext());
+    }
+
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/utils/HeaderParserTest.java
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/utils/HeaderParserTest.java?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/utils/HeaderParserTest.java (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/java/org/apache/aries/blueprint/utils/HeaderParserTest.java Sun Feb 27 17:47:08 2011
@@ -0,0 +1,70 @@
+/*
+ * 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.aries.blueprint.utils;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+import org.apache.aries.blueprint.utils.HeaderParser.PathElement;
+
+public class HeaderParserTest extends TestCase {
+
+    public void testSimple() throws Exception {
+        List<PathElement> paths = HeaderParser.parseHeader("/foo.xml, /foo/bar.xml");
+        assertEquals(2, paths.size());
+        assertEquals("/foo.xml", paths.get(0).getName());
+        assertEquals(0, paths.get(0).getAttributes().size());
+        assertEquals(0, paths.get(0).getDirectives().size());
+        assertEquals("/foo/bar.xml", paths.get(1).getName());
+        assertEquals(0, paths.get(1).getAttributes().size());
+        assertEquals(0, paths.get(1).getDirectives().size());
+    }
+    
+    public void testComplex() throws Exception {
+        List<PathElement> paths = HeaderParser.parseHeader("OSGI-INF/blueprint/comp1_named.xml;ignored-directive:=true,OSGI-INF/blueprint/comp2_named.xml;some-other-attribute=1");
+        assertEquals(2, paths.size());
+        assertEquals("OSGI-INF/blueprint/comp1_named.xml", paths.get(0).getName());
+        assertEquals(0, paths.get(0).getAttributes().size());
+        assertEquals(1, paths.get(0).getDirectives().size());
+        assertEquals("true", paths.get(0).getDirective("ignored-directive"));
+        assertEquals("OSGI-INF/blueprint/comp2_named.xml", paths.get(1).getName());
+        assertEquals(1, paths.get(1).getAttributes().size());
+        assertEquals("1", paths.get(1).getAttribute("some-other-attribute"));
+        assertEquals(0, paths.get(1).getDirectives().size());
+    }
+
+    public void testPaths() throws Exception {
+        List<PathElement> paths = HeaderParser.parseHeader("OSGI-INF/blueprint/comp1_named.xml;ignored-directive:=true,OSGI-INF/blueprint/comp2_named.xml;foo.xml;a=b;1:=2;c:=d;4=5");
+        assertEquals(3, paths.size());
+        assertEquals("OSGI-INF/blueprint/comp1_named.xml", paths.get(0).getName());
+        assertEquals(0, paths.get(0).getAttributes().size());
+        assertEquals(1, paths.get(0).getDirectives().size());
+        assertEquals("true", paths.get(0).getDirective("ignored-directive"));
+        assertEquals("OSGI-INF/blueprint/comp2_named.xml", paths.get(1).getName());
+        assertEquals(0, paths.get(1).getAttributes().size());
+        assertEquals(0, paths.get(1).getDirectives().size());
+        assertEquals("foo.xml", paths.get(2).getName());
+        assertEquals(2, paths.get(2).getAttributes().size());
+        assertEquals("b", paths.get(2).getAttribute("a"));
+        assertEquals("5", paths.get(2).getAttribute("4"));
+        assertEquals(2, paths.get(2).getDirectives().size());
+        assertEquals("d", paths.get(2).getDirective("c"));
+        assertEquals("2", paths.get(2).getDirective("1"));
+    }
+}

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/cache.xsd
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/cache.xsd?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/cache.xsd (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/cache.xsd Sun Feb 27 17:47:08 2011
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+    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.
+-->
+<xsd:schema xmlns="http://cache.org"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            targetNamespace="http://cache.org"
+            elementFormDefault="qualified"
+            attributeFormDefault="unqualified"
+            version="1.0.0">
+
+    <xsd:element name="lru-cache">
+        <xsd:complexType>
+            <xsd:attribute name="id" type="xsd:string"/>
+        </xsd:complexType>
+    </xsd:element>
+
+    <xsd:element name="operation">
+        <xsd:complexType>
+            <xsd:attribute name="name" type="xsd:string"/>
+        </xsd:complexType>
+    </xsd:element>
+
+</xsd:schema>

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-bad-id-ref.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-bad-id-ref.xml?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-bad-id-ref.xml (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-bad-id-ref.xml Sun Feb 27 17:47:08 2011
@@ -0,0 +1,27 @@
+<?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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           default-availability="mandatory" >
+
+   <bean id="badIdRef" class="org.apache.aries.blueprint.pojos.BeanD">
+        <property name="name">
+          <idref component-id="doesnotexist"/>
+        </property>
+    </bean>
+    
+</blueprint>
\ No newline at end of file

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-circular.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-circular.xml?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-circular.xml (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-circular.xml Sun Feb 27 17:47:08 2011
@@ -0,0 +1,99 @@
+<?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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <bean id="a" class="org.apache.aries.blueprint.pojos.PojoCircular">
+        <property name="circular" ref="b"/>
+    </bean>
+
+    <bean id="b" class="org.apache.aries.blueprint.pojos.PojoCircular">
+        <property name="circular" ref="a"/>
+    </bean>
+    
+    <bean id="c" class="org.apache.aries.blueprint.pojos.PojoCircular" init-method = "init">
+        <property name="circular" ref="d"/>
+    </bean>
+
+    <bean id="d" class="org.apache.aries.blueprint.pojos.PojoCircular">
+        <property name="circular" ref="c"/>
+    </bean>
+    
+    
+    
+    <bean id="serviceBean" class="org.apache.aries.blueprint.pojos.PojoB">
+        <property name="uri" value="urn:myuri" />
+    </bean>
+    
+    <bean id="listener" class="org.apache.aries.blueprint.pojos.PojoListener">
+        <property name="service" ref="service" />
+    </bean>
+    
+    <service id="service" ref="serviceBean" interface="org.apache.aries.blueprint.pojos.PojoB">
+        <service-properties>
+            <entry key="key1" value="value1"/>
+            <entry key="key2" value="value2"/>
+        </service-properties>
+        <registration-listener ref="listener"
+           registration-method="register"
+           unregistration-method="unregister"/>
+    </service>
+    
+    <!-- for prototype cycle tests -->
+    
+    <bean id="circularPrototype" class="org.apache.aries.blueprint.pojos.PojoCircular" scope = "prototype">
+        <property name="circular" ref="circularPrototype"/>
+    </bean>
+    
+    <bean id="circularPrototypeDriver" class="org.apache.aries.blueprint.pojos.PojoCircular" scope = "prototype">
+        <property name="circular" ref="circularPrototypeDriver"/>
+    </bean>
+            
+     <!-- for dynamic cycle tests (blueprintContainer.getComponentInstance()) -->
+     
+    <bean id="recursiveConstructor" class="org.apache.aries.blueprint.pojos.PojoRecursive">
+        <argument ref="blueprintContainer"/>
+        <argument value="recursiveConstructor"/>
+        <argument value="1"/>
+    </bean>
+    
+    <bean id="recursiveSetter" class="org.apache.aries.blueprint.pojos.PojoRecursive">
+        <argument ref="blueprintContainer"/>
+        <argument value="recursiveSetter"/>
+        <property name="foo" value="1"/>
+    </bean>
+    
+    <bean id="recursiveInitMethod" class="org.apache.aries.blueprint.pojos.PojoRecursive" init-method = "init">
+        <argument ref="blueprintContainer"/>
+        <argument value="recursiveInitMethod"/>
+    </bean>
+
+    <!-- for breaking dependency cycle tests  -->
+
+    <bean id="c1" class="org.apache.aries.blueprint.pojos.PojoCircular">
+        <argument ref="c2"/>
+    </bean>
+    
+    <bean id="c2" class="org.apache.aries.blueprint.pojos.PojoCircular">
+        <argument ref="c3"/>
+    </bean>
+    
+    <bean id="c3" class="org.apache.aries.blueprint.pojos.PojoCircular">
+        <property name="circular" ref="c1"/>
+    </bean>
+    
+</blueprint>
\ No newline at end of file

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-constructor.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-constructor.xml?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-constructor.xml (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-constructor.xml Sun Feb 27 17:47:08 2011
@@ -0,0 +1,114 @@
+<?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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            default-availability="mandatory" >
+
+    <bean id="pojoB" class="org.apache.aries.blueprint.pojos.PojoB">
+        <argument value="urn:myuri" />
+        <argument value="10" />
+    </bean>
+    
+    <bean id="pojoA" class="org.apache.aries.blueprint.pojos.PojoA">
+        <argument ref="pojoB" />
+        <property name="number">
+            <value type="java.math.BigInteger">10</value>
+        </property>
+    </bean>
+
+    <bean id="pojoC" class="org.apache.aries.blueprint.pojos.PojoB" factory-method = "createStatic" >
+        <argument><value type="int">15</value></argument>
+        <argument value="urn:myuri" />
+    </bean>
+    
+    <bean id="pojoD" class="org.apache.aries.blueprint.pojos.PojoB" factory-method = "createStatic" >
+        <argument value="15" index = "1" />
+        <argument value="urn:myuri" index = "0" />
+    </bean>
+    
+    <bean id="pojoE" factory-method = "createDynamic" factory-ref = "pojoB" >
+        <argument><value type="int">20</value></argument>
+        <argument value="urn:myuri" />
+    </bean>
+    
+    <bean id="multipleInt" class="org.apache.aries.blueprint.pojos.Multiple">
+        <argument type="int" value="123"/>
+    </bean>
+    
+    <bean id="multipleInteger" class="org.apache.aries.blueprint.pojos.Multiple">
+        <argument type="java.lang.Integer" value="123"/>
+    </bean>
+    
+    <bean id="multipleString" class="org.apache.aries.blueprint.pojos.Multiple">
+        <argument type="java.lang.String" value="123"/>
+    </bean>
+    
+    <bean id="multipleStringConvertable" class="org.apache.aries.blueprint.pojos.Multiple">
+        <argument value="hello"/>
+    </bean>
+    
+    <bean id="multipleFactory1" class="org.apache.aries.blueprint.pojos.Multiple"
+          factory-method = "create" >
+        <argument value="hello"/>
+        <argument value="1234"/>
+    </bean>
+        
+    <bean id="multipleFactory2" class="org.apache.aries.blueprint.pojos.Multiple"
+          factory-method = "create" >
+        <argument value="helloCreate"/>
+        <argument value="yes"/>
+    </bean>
+
+    <bean id="multipleFactoryNull" class="org.apache.aries.blueprint.pojos.Multiple"
+          factory-method = "create" >
+        <argument value="helloNull"/>
+        <argument><null/></argument>
+    </bean>
+    
+     <bean id="multipleFactoryTypedNull" class="org.apache.aries.blueprint.pojos.Multiple"
+          factory-method = "create" >
+        <argument value="hello"/>
+        <argument type = "java.lang.Boolean"><null/></argument>
+    </bean>
+    
+    <bean id="mapConstruction" class="org.apache.aries.blueprint.pojos.Multiple">
+        <argument>
+            <map>
+                <entry key="a" value="b"/>
+            </map>
+        </argument>
+    </bean>
+
+    <bean id="propsConstruction" class="org.apache.aries.blueprint.pojos.Multiple">
+        <argument>
+            <props>
+                <prop key="a" value="b"/>
+            </props>
+        </argument>
+    </bean>
+
+    <bean id="booleanPrim" class="org.apache.aries.blueprint.pojos.BeanF">
+        <argument><value type="boolean">no</value></argument>
+    </bean>
+
+    <bean id="booleanWrapped" class="org.apache.aries.blueprint.pojos.BeanF">
+        <argument type="java.lang.Boolean" value="no" />
+    </bean>
+
+</blueprint>

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-custom-nodes.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-custom-nodes.xml?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-custom-nodes.xml (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-custom-nodes.xml Sun Feb 27 17:47:08 2011
@@ -0,0 +1,35 @@
+<?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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:cache="http://cache.org">
+
+    <cache:lru-cache id="myCache" />
+    
+    <bean id="fooService" class="FooServiceImpl" cache:cache-return-values="true">
+        <cache:operation name="getVolatile" />
+
+        <property name="myProp" value="12" />
+    </bean>
+    
+    <bean id="barService" class="BarServiceImpl">
+        <property name="localCache">
+            <cache:lru-cache />
+        </property>
+    </bean>
+
+</blueprint>
\ No newline at end of file

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-depends-on.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-depends-on.xml?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-depends-on.xml (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-depends-on.xml Sun Feb 27 17:47:08 2011
@@ -0,0 +1,28 @@
+<?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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <bean id="c" class="org.apache.aries.blueprint.pojos.BeanC" depends-on="d" init-method="init" destroy-method="destroy"/>
+
+    <bean id="d" class="org.apache.aries.blueprint.pojos.BeanD" init-method="init" destroy-method="destroy"/>
+    
+    <bean id="e" class="org.apache.aries.blueprint.pojos.BeanE" init-method="init" destroy-method="destroy">
+        <argument ref="c"/>
+    </bean>
+
+</blueprint>
\ No newline at end of file

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-generics.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-generics.xml?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-generics.xml (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-generics.xml Sun Feb 27 17:47:08 2011
@@ -0,0 +1,92 @@
+<?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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            default-availability="mandatory" >
+
+    <bean id="method" class="org.apache.aries.blueprint.pojos.PojoGenerics">
+        <property name="list">
+            <list>
+                <value>10</value>
+                <value>20</value>
+                <value>50</value>
+            </list>
+        </property>
+        <property name="set">
+            <set>
+                <value>1000</value>
+                <value>2000</value>
+                <value>5000</value>
+            </set>
+        </property>
+        <property name="map">
+            <map>
+                <entry key="1" value="yes"/>
+                <entry key="2" value="no" />
+                <entry>
+                     <key><value>5</value></key>
+                     <value>true</value>
+                </entry>
+            </map>
+        </property>        
+    </bean>
+    
+    <bean id="constructorList" class="org.apache.aries.blueprint.pojos.PojoGenerics">
+        <argument type="java.util.List">
+            <list>
+                <value>10</value>
+                <value>20</value>
+                <value>50</value>
+            </list>
+        </argument>      
+    </bean>
+    
+    <bean id="constructorSet" class="org.apache.aries.blueprint.pojos.PojoGenerics">
+       <argument type="java.util.Set">
+            <set>
+                <value>1000</value>
+                <value>2000</value>
+                <value>5000</value>
+            </set>
+        </argument>
+    </bean>
+    
+    <bean id="constructorMap" class="org.apache.aries.blueprint.pojos.PojoGenerics">
+        <argument>
+            <map>
+                <entry key="1" value="yes"/>
+                <entry key="2" value="no" />
+                <entry>
+                     <key><value>5</value></key>
+                     <value>true</value>
+                </entry>
+            </map>
+        </argument>
+    </bean>
+    
+		<bean id="genericPojoFactory" class="org.apache.aries.blueprint.pojos.PrimaveraFactory" />
+		<bean id="genericPojo" factory-ref="genericPojoFactory" factory-method="getObject">
+				<property name="property" value="string" />
+		</bean>
+
+		<bean id="doubleGenericPojo" factory-ref="genericPojoFactory" factory-method="getObject">
+	    	<property name="property" value="stringToo" />
+		</bean>
+    
+</blueprint>

Added: aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-simple-component.xml
URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-simple-component.xml?rev=1075094&view=auto
==============================================================================
--- aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-simple-component.xml (added)
+++ aries/tags/blueprint-0.1-incubating/blueprint-core/src/test/resources/test-simple-component.xml Sun Feb 27 17:47:08 2011
@@ -0,0 +1,53 @@
+<?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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <bean id="pojoA" class="org.apache.aries.blueprint.pojos.PojoA" depends-on=" pojoB  pojoC ">
+        <argument value="val0"/>
+        <argument ref="val1" />
+        <argument>
+            <description>null value</description>
+            <null/>
+        </argument>
+        <argument type="java.lang.String">
+            <value>val3</value>
+        </argument>
+        <argument>
+            <array>
+                <value>val0</value>
+                <bean class="java.lang.String"/>
+                <null/>
+            </array>
+        </argument>
+        <argument>
+            <ref component-id="pojoB"/>
+        </argument>
+        <property name="prop1" ref="pojoB"/>
+        <property name="prop2" value="value" />
+        <property name="prop3">
+            <description>property</description>
+            <value>val</value>
+        </property>
+    </bean>
+
+    <bean id="pojoB" class="org.apache.aries.blueprint.pojos.PojoA" init-method="initPojo" >
+        <argument index = "1" value="val0"/>
+        <argument index = "0" ref="val1" />
+    </bean>
+
+</blueprint>
\ No newline at end of file