From 51ee1c2eabf2be7a67043498a3a9ca286b7b2c17 Mon Sep 17 00:00:00 2001 From: erik Date: Thu, 12 Nov 2009 20:48:07 +0000 Subject: [PATCH] --- .../system/core/DefaultProvidedInterface.java | 5 ---- .../system/core/ProvidedInterface.java | 9 ------- .../adapters/ClassConfigurationTest.java | 6 ++--- .../ConstructorConfigurationTest.java | 8 +++---- .../adapters/SetterConfigurationTest.java | 24 +++++++++---------- 5 files changed, 19 insertions(+), 33 deletions(-) diff --git a/trunk/system/general/src/main/java/org/wamblee/system/core/DefaultProvidedInterface.java b/trunk/system/general/src/main/java/org/wamblee/system/core/DefaultProvidedInterface.java index 6ec52a44..2f9aee65 100644 --- a/trunk/system/general/src/main/java/org/wamblee/system/core/DefaultProvidedInterface.java +++ b/trunk/system/general/src/main/java/org/wamblee/system/core/DefaultProvidedInterface.java @@ -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(); diff --git a/trunk/system/general/src/main/java/org/wamblee/system/core/ProvidedInterface.java b/trunk/system/general/src/main/java/org/wamblee/system/core/ProvidedInterface.java index 46bf5f24..f09a5270 100644 --- a/trunk/system/general/src/main/java/org/wamblee/system/core/ProvidedInterface.java +++ b/trunk/system/general/src/main/java/org/wamblee/system/core/ProvidedInterface.java @@ -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); /** diff --git a/trunk/system/general/src/test/java/org/wamblee/system/adapters/ClassConfigurationTest.java b/trunk/system/general/src/test/java/org/wamblee/system/adapters/ClassConfigurationTest.java index aee32166..a5cd1a09 100644 --- a/trunk/system/general/src/test/java/org/wamblee/system/adapters/ClassConfigurationTest.java +++ b/trunk/system/general/src/test/java/org/wamblee/system/adapters/ClassConfigurationTest.java @@ -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); diff --git a/trunk/system/general/src/test/java/org/wamblee/system/adapters/ConstructorConfigurationTest.java b/trunk/system/general/src/test/java/org/wamblee/system/adapters/ConstructorConfigurationTest.java index b7b1497c..0cec6fba 100644 --- a/trunk/system/general/src/test/java/org/wamblee/system/adapters/ConstructorConfigurationTest.java +++ b/trunk/system/general/src/test/java/org/wamblee/system/adapters/ConstructorConfigurationTest.java @@ -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 diff --git a/trunk/system/general/src/test/java/org/wamblee/system/adapters/SetterConfigurationTest.java b/trunk/system/general/src/test/java/org/wamblee/system/adapters/SetterConfigurationTest.java index e13c9fc0..1d7ec75e 100644 --- a/trunk/system/general/src/test/java/org/wamblee/system/adapters/SetterConfigurationTest.java +++ b/trunk/system/general/src/test/java/org/wamblee/system/adapters/SetterConfigurationTest.java @@ -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()); -- 2.31.1