(no commit message)
[utils] / system / general / src / test / java / org / wamblee / system / adapters / SetterConfigurationTest.java
index eda9dd08a2eae4fc1e1057e9deb0f63ce5023c87..b38b66c866d1a1c0d45cc8663a73d14d3ea1692e 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright 2008 the original author or authors.
- *
+ * Copyright 2005-2010 the original author or authors.
+ * 
  * Licensed 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.
  */
 package org.wamblee.system.adapters;
 
-import org.wamblee.system.core.DefaultProvidedInterface;
-import org.wamblee.system.core.ProvidedInterface;
-import org.wamblee.system.core.RequiredInterface;
-import org.wamblee.system.core.RequiredInterfaceComparator;
-
-import org.wamblee.test.AssertionUtils;
-
 import java.lang.reflect.Method;
-
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -31,6 +23,13 @@ import java.util.List;
 
 import javax.sql.DataSource;
 
+import org.wamblee.system.core.DefaultProvidedInterface;
+import org.wamblee.system.core.ProvidedInterface;
+import org.wamblee.system.core.RequiredInterface;
+import org.wamblee.system.core.RequiredInterfaceComparator;
+import org.wamblee.system.core.Scope;
+import org.wamblee.test.AssertionUtils;
+
 /**
  * 
  * @author $author$
@@ -48,6 +47,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
         ProvidedInterface provided = new DefaultProvidedInterface("janse",
             String.class);
         required.get(0).setProvider(provided);
+        Scope scope = getScope();
         scope.publishInterface(provided, "hello");
 
         X5 obj = new X5();
@@ -77,6 +77,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
             "janse", String.class);
         assertTrue(required.get(0).implementedBy(providedString));
         required.get(0).setProvider(providedString);
+        Scope scope = getScope();
         scope.publishInterface(providedString, "hello");
 
         ProvidedInterface providedInt = new DefaultProvidedInterface("xxx",
@@ -115,6 +116,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
             "janse", Boolean.class);
         assertTrue(required.get(0).implementedBy(providedBoolean));
         required.get(0).setProvider(providedBoolean);
+        Scope scope = getScope();
         scope.publishInterface(providedBoolean, true);
 
         ProvidedInterface providedString = new DefaultProvidedInterface(
@@ -151,6 +153,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
         ProvidedInterface provided0 = new DefaultProvidedInterface("janse",
             String.class);
         required.get(0).setProvider(provided0);
+        Scope scope = getScope();
         scope.publishInterface(provided0, "hello");
 
         ProvidedInterface provided1 = new DefaultProvidedInterface("port",
@@ -177,6 +180,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
         ProvidedInterface provided = new DefaultProvidedInterface("janse",
             String.class);
         required.get(0).setProvider(provided);
+        final Scope scope = getScope();
         scope.publishInterface(provided, "hello");
 
         final X6 obj = new X6();
@@ -198,6 +202,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
 
         X5 obj = new X5();
         assertNull(obj.getValue());
+        Scope scope = getScope();
         config.inject(scope, obj);
         assertEquals("bladibla", obj.getValue());
     }
@@ -214,6 +219,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
         assertNull(obj.getHost());
         assertNull(obj.getPort());
 
+        Scope scope = getScope();
         config.inject(scope, obj);
 
         assertNull(obj.getHost());
@@ -232,6 +238,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
         ProvidedInterface provided0 = new DefaultProvidedInterface("janse",
             String.class);
         required.get(0).setProvider(provided0);
+        Scope scope = getScope();
         scope.publishInterface(provided0, "hello");
 
         X6 obj = new X6();
@@ -255,6 +262,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
         ProvidedInterface provided0 = new DefaultProvidedInterface("janse",
             String.class);
         required.get(0).setProvider(provided0);
+        Scope scope = getScope();
         scope.publishInterface(provided0, "hello");
 
         X6 obj = new X6();
@@ -267,7 +275,6 @@ public class SetterConfigurationTest extends AdapterTestCase {
     }
 
     public void testAddPrivate() {
-        X5 obj = new X5();
         final SetterConfiguration config = new SetterConfiguration(X5.class);
         AssertionUtils.assertException(new AssertionUtils.ErroneousCode() {
             @Override
@@ -324,6 +331,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
         ProvidedInterface provided0 = new DefaultProvidedInterface("janse",
             String.class);
         required.get(0).setProvider(provided0);
+        Scope scope = getScope();
         scope.publishInterface(provided0, "hello");
 
         X6 obj = new X6();
@@ -348,6 +356,7 @@ public class SetterConfigurationTest extends AdapterTestCase {
         ProvidedInterface provided0 = new DefaultProvidedInterface("janse",
             String.class);
         required.get(0).setProvider(provided0);
+        Scope scope = getScope();
         scope.publishInterface(provided0, "hello");
 
         X6 obj = new X6();