geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r772083 - in /geronimo/sandbox/blueprint/blueprint-core/src/test: java/org/apache/geronimo/blueprint/WiringTest.java java/org/apache/geronimo/blueprint/pojos/PojoCircular.java resources/test-circular.xml
Date Wed, 06 May 2009 07:21:21 GMT
Author: gnodet
Date: Wed May  6 07:21:21 2009
New Revision: 772083

URL: http://svn.apache.org/viewvc?rev=772083&view=rev
Log:
Add a simple test for circular deps

Added:
    geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/pojos/PojoCircular.java
    geronimo/sandbox/blueprint/blueprint-core/src/test/resources/test-circular.xml
Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/WiringTest.java

Modified: geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/WiringTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/WiringTest.java?rev=772083&r1=772082&r2=772083&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/WiringTest.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/WiringTest.java
Wed May  6 07:21:21 2009
@@ -274,6 +274,20 @@
         assertEquals(intValue, ((Multiple)obj).getInt());
         assertEquals(stringValue, ((Multiple)obj).getString());
         assertEquals(integerValue, ((Multiple)obj).getInteger());        
-    }    
+    }
+
+    public void testCircular() throws Exception {
+        ComponentDefinitionRegistryImpl registry = parse("/test-circular.xml");
+        RecipeBuilder i = new RecipeBuilder(new TestBlueprintContext(registry));
+        Repository repository = i.createRepository(registry);
+        BlueprintObjectInstantiator graph = new BlueprintObjectInstantiator(repository);
+
+        try {
+            Object obj1 = graph.create("a");
+            fail("Test should have thrown an exception caused by the circular reference");
+        } catch (Exception e) {
+            // ok
+        }
+    }
      
 }

Added: geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/pojos/PojoCircular.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/pojos/PojoCircular.java?rev=772083&view=auto
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/pojos/PojoCircular.java
(added)
+++ geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/pojos/PojoCircular.java
Wed May  6 07:21:21 2009
@@ -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.geronimo.blueprint.pojos;
+
+public class PojoCircular {
+
+    private PojoCircular circular;
+
+    public PojoCircular getCircular() {
+        return circular;
+    }
+
+    public void setCircular(PojoCircular circular) {
+        this.circular = circular;
+    }
+}

Added: geronimo/sandbox/blueprint/blueprint-core/src/test/resources/test-circular.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/test/resources/test-circular.xml?rev=772083&view=auto
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/test/resources/test-circular.xml (added)
+++ geronimo/sandbox/blueprint/blueprint-core/src/test/resources/test-circular.xml Wed May
 6 07:21:21 2009
@@ -0,0 +1,30 @@
+<?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.geronimo.blueprint.pojos.PojoCircular">
+        <property name="circular" ref="b"/>
+    </bean>
+
+    <bean id="b" class="org.apache.geronimo.blueprint.pojos.PojoCircular">
+        <property name="circular" ref="a"/>
+    </bean>
+
+</blueprint>
\ No newline at end of file



Mime
View raw message