felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r1045175 - in /felix/trunk/ipojo/tests/core/service-dependency/src/main: java/org/apache/felix/ipojo/test/scenarios/component/inner/ java/org/apache/felix/ipojo/test/scenarios/service/dependency/ java/org/apache/felix/ipojo/test/scenarios/s...
Date Mon, 13 Dec 2010 15:35:32 GMT
Author: clement
Date: Mon Dec 13 15:35:31 2010
New Revision: 1045175

URL: http://svn.apache.org/viewvc?rev=1045175&view=rev
Log:
Try to reproduce the issue described in http://www.mail-archive.com/users@felix.apache.org/msg09205.html

Added:
    felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/
    felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/C1.java
    felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/C2.java
    felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/C3.java
    felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/MyFilter.java
    felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/inner/
    felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/inner/InnerProxyMixTest.java
    felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/service/Call.java
Modified:
    felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyTestSuite.java
    felix/trunk/ipojo/tests/core/service-dependency/src/main/resources/metadata.xml

Added: felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/C1.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/C1.java?rev=1045175&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/C1.java
(added)
+++ felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/C1.java
Mon Dec 13 15:35:31 2010
@@ -0,0 +1,11 @@
+package org.apache.felix.ipojo.test.scenarios.component.inner;
+
+import org.apache.felix.ipojo.test.scenarios.service.dependency.service.Call;
+
+public class C1 implements Call {
+
+	public String callMe() {
+		return "called";
+	}
+
+}

Added: felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/C2.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/C2.java?rev=1045175&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/C2.java
(added)
+++ felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/C2.java
Mon Dec 13 15:35:31 2010
@@ -0,0 +1,13 @@
+package org.apache.felix.ipojo.test.scenarios.component.inner;
+
+import org.apache.felix.ipojo.test.scenarios.service.dependency.service.Call;
+
+public class C2 {
+
+	private Call c1;
+
+	public String authenticate() {
+		return c1.callMe();
+	}
+
+}

Added: felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/C3.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/C3.java?rev=1045175&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/C3.java
(added)
+++ felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/C3.java
Mon Dec 13 15:35:31 2010
@@ -0,0 +1,19 @@
+package org.apache.felix.ipojo.test.scenarios.component.inner;
+
+public class C3 {
+
+	private C2 c2;
+
+	public MyFilter getFilter()	{
+		return new MyFilter() {
+			public String authenticate() {
+				System.out.println("My Filter ...");
+				String r = c2.authenticate();
+				System.out.println(" ... " + r);
+				return r;
+			}
+		};
+
+	}
+
+}

Added: felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/MyFilter.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/MyFilter.java?rev=1045175&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/MyFilter.java
(added)
+++ felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/component/inner/MyFilter.java
Mon Dec 13 15:35:31 2010
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.test.scenarios.component.inner;
+
+public interface MyFilter {
+
+	public String authenticate();
+
+}

Modified: felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyTestSuite.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyTestSuite.java?rev=1045175&r1=1045174&r2=1045175&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyTestSuite.java
(original)
+++ felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/DependencyTestSuite.java
Mon Dec 13 15:35:31 2010
@@ -22,6 +22,7 @@ import junit.framework.Test;
 
 import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
 import org.apache.felix.ipojo.test.scenarios.service.dependency.di.DefaultImplementationTestSuite;
+import org.apache.felix.ipojo.test.scenarios.service.dependency.inner.InnerProxyMixTest;
 import org.osgi.framework.BundleContext;
 
 public class DependencyTestSuite {
@@ -63,6 +64,7 @@ public class DependencyTestSuite {
         ots.addTestSuite(ModifyDependencies.class);
         ots.addTestSuite(ProxyTest.class);
         ots.addTestSuite(NonProxiedNotInterfaceDependencies.class);
+        ots.addTestSuite(InnerProxyMixTest.class);
         return ots;
     }
 

Added: felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/inner/InnerProxyMixTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/inner/InnerProxyMixTest.java?rev=1045175&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/inner/InnerProxyMixTest.java
(added)
+++ felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/inner/InnerProxyMixTest.java
Mon Dec 13 15:35:31 2010
@@ -0,0 +1,66 @@
+package org.apache.felix.ipojo.test.scenarios.service.dependency.inner;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
+import org.apache.felix.ipojo.test.scenarios.component.inner.C1;
+import org.apache.felix.ipojo.test.scenarios.component.inner.C2;
+import org.apache.felix.ipojo.test.scenarios.component.inner.C3;
+
+public class InnerProxyMixTest extends OSGiTestCase {
+
+	public static String C1 = C1.class.getName();
+	public static String C2 = C2.class.getName();
+	public static String C3 = C3.class.getName();
+
+	IPOJOHelper ipojo;
+	private ComponentInstance instancec1;
+	private ComponentInstance instancec2;
+	private ComponentInstance instancec3;
+
+	public void setUp() {
+		ipojo = new IPOJOHelper(this);
+		// Create the instances
+		instancec1 = ipojo.createComponentInstance(C1);
+		instancec2 = ipojo.createComponentInstance(C2);
+		instancec3 = ipojo.createComponentInstance(C3);
+	}
+
+	public void tearDown() {
+		ipojo.dispose();
+	}
+
+	public void testMix() {
+		// Check that everything is OK
+		assertEquals(ComponentInstance.VALID, instancec1.getState());
+		assertEquals(ComponentInstance.VALID, instancec2.getState());
+		assertEquals(ComponentInstance.VALID, instancec3.getState());
+
+		// Call C3
+		C3 svc = (C3) getServiceObject(C3, null);
+		assertNotNull(svc);
+		assertEquals("called", svc.getFilter().authenticate());
+
+		// So far, all right
+
+		//We stop c1 and c2.
+		instancec1.stop();
+		instancec2.stop();
+
+		assertEquals(ComponentInstance.INVALID, instancec3.getState()); // C2 dependency invalid
+
+		instancec1.start();
+		instancec2.start();
+
+		// Check that everything is OK
+		assertEquals(ComponentInstance.VALID, instancec1.getState());
+		assertEquals(ComponentInstance.VALID, instancec2.getState());
+		assertEquals(ComponentInstance.VALID, instancec3.getState());
+
+		// Call C3
+		svc = (C3) getServiceObject(C3, null);
+		assertNotNull(svc);
+		assertEquals("called", svc.getFilter().authenticate());
+	}
+
+}

Added: felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/service/Call.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/service/Call.java?rev=1045175&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/service/Call.java
(added)
+++ felix/trunk/ipojo/tests/core/service-dependency/src/main/java/org/apache/felix/ipojo/test/scenarios/service/dependency/service/Call.java
Mon Dec 13 15:35:31 2010
@@ -0,0 +1,8 @@
+package org.apache.felix.ipojo.test.scenarios.service.dependency.service;
+
+public interface Call {
+
+
+	public String callMe();
+
+}

Modified: felix/trunk/ipojo/tests/core/service-dependency/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/service-dependency/src/main/resources/metadata.xml?rev=1045175&r1=1045174&r2=1045175&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/service-dependency/src/main/resources/metadata.xml (original)
+++ felix/trunk/ipojo/tests/core/service-dependency/src/main/resources/metadata.xml Mon Dec
13 15:35:31 2010
@@ -1045,4 +1045,20 @@ xmlns:xsi="http://www.w3.org/2001/XMLSch
     <requires field="map"/>
   </component>
 
+	<!-- Inner + Proxy mix -->
+  <component
+  	classname="org.apache.felix.ipojo.test.scenarios.component.inner.C1">
+  		<provides/>
+  </component>
+  <component
+  	classname="org.apache.felix.ipojo.test.scenarios.component.inner.C2">
+  		<provides specifications="org.apache.felix.ipojo.test.scenarios.component.inner.C2"/>
+		<requires field="c1"/>
+  </component>
+  <component
+  	classname="org.apache.felix.ipojo.test.scenarios.component.inner.C3">
+  		<provides specifications="org.apache.felix.ipojo.test.scenarios.component.inner.C3"/>
+		<requires field="c2"/>
+  </component>
+
 </ipojo>



Mime
View raw message