2 * Copyright 2008 the original author or authors.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.wamblee.system.adapters;
18 import java.util.List;
20 import junit.framework.TestCase;
22 import org.wamblee.system.core.DefaultProvidedInterface;
23 import org.wamblee.system.core.DefaultScope;
24 import org.wamblee.system.core.ProvidedInterface;
25 import org.wamblee.system.core.RequiredInterface;
26 import org.wamblee.system.core.Scope;
27 import org.wamblee.test.AssertionUtils;
28 import org.wamblee.test.EventTracker;
30 public class ClassConfigurationTest extends AdapterTestCase {
33 public void testConstructorConfig() {
34 ClassConfiguration classConfig = new ClassConfiguration(X1.class);
36 ConstructorConfiguration config = classConfig.getConstructorConfig()
38 ProvidedInterface provided = new DefaultProvidedInterface("arg",
40 List<RequiredInterface> required = config.getRequiredInterfaces();
42 assertEquals(1, required.size());
43 assertFalse(required.get(0).isOptional());
45 required.get(0).setProvider(provided);
47 provided.publish("hello", _scope);
48 config.create(_scope);
50 AssertionUtils.assertEquals(new String[] { "x1(hello)" }, AdapterTestCase.EVENT_TRACKER
51 .getEvents(Thread.currentThread()).toArray());