(no commit message)
authorErik Brakkee <erik@brakkee.org>
Thu, 12 Nov 2009 20:48:07 +0000 (20:48 +0000)
committerErik Brakkee <erik@brakkee.org>
Thu, 12 Nov 2009 20:48:07 +0000 (20:48 +0000)
system/general/src/main/java/org/wamblee/system/core/DefaultProvidedInterface.java
system/general/src/main/java/org/wamblee/system/core/ProvidedInterface.java
system/general/src/test/java/org/wamblee/system/adapters/ClassConfigurationTest.java
system/general/src/test/java/org/wamblee/system/adapters/ConstructorConfigurationTest.java
system/general/src/test/java/org/wamblee/system/adapters/SetterConfigurationTest.java

index 6ec52a44291dfb8d89c88b026669b5502b91b297..2f9aee659d0aaae25db9ae037738ebc8643780f8 100644 (file)
@@ -55,11 +55,6 @@ public class DefaultProvidedInterface implements ProvidedInterface {
                return _interfaces;
        }
        
-       @Override
-       public void publish(Object aImplementation, Scope aScope) {
-               aScope.publishInterface(this, aImplementation);
-       }
-       
        @Override
        public String toString() {
                StringBuffer buf = new StringBuffer();
index 46bf5f24528d143b9c1b488b32c56456f55d0631..f09a5270f66a53d0a4fe824aeaa7e1a9b03fd6e2 100644 (file)
@@ -30,15 +30,6 @@ public interface ProvidedInterface extends NamedInterface {
         * @return Service type. 
         */
        Class[] getInterfaceTypes();
-
-       /**
-        * Publishes an implementation of the interface. The implementation must 
-        * call {@link Scope#publishInterface(ProvidedInterface, Object)} to publish the
-        * interface implementation in a given scope.  
-        * @param aImplementation Implementation to publish. 
-        * @param aScope Scope in which to publish the implementation. 
-        */
-       void publish(Object aImplementation, Scope aScope);
        
        
        /**
index aee3216604103966b953f0c8cce935616366960e..a5cd1a09c6d337ba83c5e494b06ff1a10288b5c4 100644 (file)
@@ -41,7 +41,7 @@ public class ClassConfigurationTest extends AdapterTestCase {
 
         required.get(0).setProvider(provided);
 
-        provided.publish("hello", _scope);
+        _scope.publishInterface(provided, "hello");
         classConfig.create(_scope);
 
         AssertionUtils.assertEquals(new String[] { "x1(hello)" },
@@ -67,8 +67,8 @@ public class ClassConfigurationTest extends AdapterTestCase {
         required.get(0).setProvider(providedBoolean);
         required.get(1).setProvider(providedHost);
 
-        providedBoolean.publish(true, _scope);
-        providedHost.publish("host.name.org", _scope);
+        _scope.publishInterface(providedBoolean, true);
+        _scope.publishInterface(providedHost, "host.name.org");
         
         Object obj = classConfig.create(_scope);
         assertTrue(obj instanceof X7);
index b7b1497c1639a1cadb146ceceeec50678d06bb06..0cec6fba5299f8ca833d1972dae978c674af0aef 100644 (file)
@@ -37,7 +37,7 @@ public class ConstructorConfigurationTest extends AdapterTestCase {
 
                required.get(0).setProvider(provided);
 
-               provided.publish("hello", _scope);
+               _scope.publishInterface(provided, "hello");
                config.create(_scope);
 
                AssertionUtils.assertEquals(new String[] { "x1(hello)" }, AdapterTestCase.EVENT_TRACKER
@@ -65,7 +65,7 @@ public class ConstructorConfigurationTest extends AdapterTestCase {
                assertEquals(1, required.size());
                required.get(0).setProvider(provided);
 
-               provided.publish("hello", _scope);
+               _scope.publishInterface(provided, "hello");
                config.create(_scope);
 
                AssertionUtils.assertEquals(new String[] { "x2(hello)" }, AdapterTestCase.EVENT_TRACKER
@@ -94,7 +94,7 @@ public class ConstructorConfigurationTest extends AdapterTestCase {
                assertEquals(1, required.size());
                required.get(0).setProvider(provided);
 
-               provided.publish("hello", _scope);
+               _scope.publishInterface(provided, "hello");
                config.create(_scope);
 
                AssertionUtils.assertEquals(new String[] { "x1(hello)" }, AdapterTestCase.EVENT_TRACKER
@@ -132,7 +132,7 @@ public class ConstructorConfigurationTest extends AdapterTestCase {
 
                required.get(0).setProvider(provided);
 
-               provided.publish("hello", _scope);
+               _scope.publishInterface(provided, "hello");
                config.create(_scope);
 
                AssertionUtils.assertEquals(new String[] { "x3(hello)" }, AdapterTestCase.EVENT_TRACKER
index e13c9fc03a49f29bc913231a372dd765d14288c9..1d7ec75e3648d35b15842da61f216e07e482a3f4 100644 (file)
@@ -41,7 +41,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
                ProvidedInterface provided = new DefaultProvidedInterface("janse",
                                String.class);
                required.get(0).setProvider(provided);
-               provided.publish("hello", _scope);
+               _scope.publishInterface(provided, "hello");
 
                X5 obj = new X5();
                assertNull(obj.getValue());
@@ -69,13 +69,13 @@ public class SetterConfigurationTest extends AdapterTestCase {
                                "janse", String.class);
                assertTrue(required.get(0).implementedBy(providedString));
                required.get(0).setProvider(providedString);
-               providedString.publish("hello", _scope);
+               _scope.publishInterface(providedString, "hello");
 
                ProvidedInterface providedInt = new DefaultProvidedInterface("xxx",
                                Integer.class);
                assertTrue(required.get(1).implementedBy(providedInt));
                required.get(1).setProvider(providedInt);
-               providedInt.publish(100, _scope);
+               _scope.publishInterface(providedInt, 100);
 
                X5 obj = new X5();
                assertNull(obj.getValue());
@@ -106,19 +106,19 @@ public class SetterConfigurationTest extends AdapterTestCase {
                                "janse", Boolean.class);
                assertTrue(required.get(0).implementedBy(providedBoolean));
                required.get(0).setProvider(providedBoolean);
-               providedBoolean.publish(true, _scope);
+               _scope.publishInterface(providedBoolean, true);
 
                ProvidedInterface providedString = new DefaultProvidedInterface(
                                "janse", String.class);
                assertTrue(required.get(1).implementedBy(providedString));
                required.get(1).setProvider(providedString);
-               providedString.publish("hello", _scope);
+               _scope.publishInterface(providedString, "hello");
 
                ProvidedInterface providedInt = new DefaultProvidedInterface("xxx",
                                Integer.class);
                assertTrue(required.get(2).implementedBy(providedInt));
                required.get(2).setProvider(providedInt);
-               providedInt.publish(100, _scope);
+               _scope.publishInterface(providedInt, 100);
 
                X9 obj = new X9();
                assertNull(obj.getValue());
@@ -141,12 +141,12 @@ public class SetterConfigurationTest extends AdapterTestCase {
                ProvidedInterface provided0 = new DefaultProvidedInterface("janse",
                                String.class);
                required.get(0).setProvider(provided0);
-               provided0.publish("hello", _scope);
+               _scope.publishInterface(provided0, "hello");
 
                ProvidedInterface provided1 = new DefaultProvidedInterface("port",
                                Integer.class);
                required.get(1).setProvider(provided1);
-               provided1.publish(10, _scope);
+               _scope.publishInterface(provided1, 10);
 
                X6 obj = new X6();
                assertNull(obj.getHost());
@@ -166,7 +166,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
                ProvidedInterface provided = new DefaultProvidedInterface("janse",
                                String.class);
                required.get(0).setProvider(provided);
-               provided.publish("hello", _scope);
+               _scope.publishInterface(provided, "hello");
 
                final X6 obj = new X6();
                AssertionUtils.assertException(new AssertionUtils.ErroneousCode() {
@@ -218,7 +218,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
                ProvidedInterface provided0 = new DefaultProvidedInterface("janse",
                                String.class);
                required.get(0).setProvider(provided0);
-               provided0.publish("hello", _scope);
+               _scope.publishInterface(provided0, "hello");
 
                X6 obj = new X6();
                assertNull(obj.getHost());
@@ -240,7 +240,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
                ProvidedInterface provided0 = new DefaultProvidedInterface("janse",
                                String.class);
                required.get(0).setProvider(provided0);
-               provided0.publish("hello", _scope);
+               _scope.publishInterface(provided0, "hello");
 
                X6 obj = new X6();
                assertNull(obj.getHost());
@@ -307,7 +307,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
                ProvidedInterface provided0 = new DefaultProvidedInterface("janse",
                                String.class);
                required.get(0).setProvider(provided0);
-               provided0.publish("hello", _scope);
+               _scope.publishInterface(provided0, "hello");
 
                X6 obj = new X6();
                assertNull(obj.getHost());