geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r771542 - /geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/WiringTest.java
Date Tue, 05 May 2009 03:34:17 GMT
Author: gawor
Date: Tue May  5 03:34:17 2009
New Revision: 771542

URL: http://svn.apache.org/viewvc?rev=771542&view=rev
Log:
basic tests for idref

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=771542&r1=771541&r2=771542&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
Tue May  5 03:34:17 2009
@@ -22,13 +22,11 @@
 import java.net.URI;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.geronimo.blueprint.CallbackTracker.Callback;
 import org.apache.geronimo.blueprint.context.BlueprintObjectRepository;
 import org.apache.geronimo.blueprint.context.Instanciator;
 import org.apache.geronimo.blueprint.namespace.ComponentDefinitionRegistryImpl;
-import org.apache.geronimo.blueprint.pojos.BeanC;
 import org.apache.geronimo.blueprint.pojos.BeanD;
 import org.apache.geronimo.blueprint.pojos.Multiple;
 import org.apache.geronimo.blueprint.pojos.PojoA;
@@ -120,6 +118,7 @@
         // tests 'prototype' scope
         Object obj4 = graph.create("pojoC");
         assertNotNull(obj4);
+        
         assertTrue(obj4 != graph.create("pojoC"));
         
         repository.destroy();       
@@ -142,6 +141,28 @@
         assertEquals("hello bean property", pojob.getBean().getName());
     }
 
+    public void testIdRefs() throws Exception {
+        ComponentDefinitionRegistryImpl registry = parse("/test-wiring.xml");
+        Instanciator i = new Instanciator(new TestBlueprintContext(registry));
+        BlueprintObjectRepository repository = i.createRepository(registry);
+        ObjectGraph graph = new ObjectGraph(repository);
+        
+        try {
+            graph.create("badIdRef");
+            fail("Did not throw exception");
+        } catch (RuntimeException e) {
+            // we expect exception
+            // TODO: check error string?
+        }
+        
+        Object obj = graph.create("goodIdRef");
+        assertNotNull(obj);
+        assertTrue(obj instanceof BeanD);
+        BeanD bean = (BeanD) obj;
+    
+        assertEquals("pojoA", bean.getName());
+    }
+    
     public void testDependencies() throws Exception {
         CallbackTracker.clear();
 



Mime
View raw message