* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.wamblee.system.core;
+package org.wamblee.system.container;
-import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import junit.framework.TestCase;
import org.easymock.classextension.EasyMock;
import org.easymock.classextension.IMocksControl;
import org.wamblee.general.Pair;
+import org.wamblee.system.core.Component;
+import org.wamblee.system.core.DefaultProvidedInterface;
+import org.wamblee.system.core.DefaultRequiredInterface;
+import org.wamblee.system.core.DefaultScope;
+import org.wamblee.system.core.Environment;
+import org.wamblee.system.core.ProvidedInterface;
+import org.wamblee.system.core.RequiredInterface;
+import org.wamblee.system.core.Scope;
+import org.wamblee.system.core.StringComponent;
+import org.wamblee.system.core.SystemAssemblyException;
import org.wamblee.test.AssertionUtils;
import org.wamblee.test.EasyMockMatchers;
import org.wamblee.test.EventTracker;
return result;
}
- public void testFilterProvided() {
- RequiredInterface req1 = new DefaultRequiredInterface("name",
- Runnable.class);
- RequiredInterface req2 = new DefaultRequiredInterface("name",
- Serializable.class);
- ProvidedInterface prov1 = new DefaultProvidedInterface("name",
- Runnable.class);
- ProvidedInterface prov2 = new DefaultProvidedInterface("name",
- Serializable.class);
- ProvidedInterface prov3 = new DefaultProvidedInterface("name",
- MyMultiple.class);
-
- Component client = new Application("client");
- Component dummy = new Application("dummy");
-
- InterfaceRestriction noRestriction = new InterfaceRestriction() {
- @Override
- public boolean isViolated(Component aClient,
- RequiredInterface aRequired, Component aServer,
- ProvidedInterface aProvided) {
- return false;
- }
- };
-
- AssertionUtils.assertEquals(new ProvidedInterface[] { prov1 },
- Container.filterProvidedServices(client, req1,
- createProvidedInput(new ProvidedInterface[] { prov1 },
- dummy), noRestriction));
- AssertionUtils.assertEquals(new ProvidedInterface[] { prov1 },
- Container.filterProvidedServices(client, req1,
- createProvidedInput(new ProvidedInterface[] { prov1,
- prov2 }, dummy), noRestriction));
- AssertionUtils.assertEquals(new ProvidedInterface[] { prov1, prov3 },
- Container.filterProvidedServices(client, req1,
- createProvidedInput(new ProvidedInterface[] { prov1,
- prov3 }, dummy), noRestriction));
-
- InterfaceRestriction everything = new InterfaceRestriction() {
- @Override
- public boolean isViolated(Component aClient,
- RequiredInterface aRequired, Component aServer,
- ProvidedInterface aProvided) {
- return true;
- }
- };
- AssertionUtils.assertEquals(new ProvidedInterface[0], Container
- .filterProvidedServices(client, req1, createProvidedInput(
- new ProvidedInterface[] { prov1, prov3 }, dummy),
- everything));
-
- }
-
public void testEnvironmentApplication() {
Environment environment = new Environment(_tracker);
Application application = new Application(_tracker);