KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > hivemind > impl > TestRegistryInfrastructureConstructor


1 // Copyright 2004, 2005 The Apache Software Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15 package org.apache.hivemind.impl;
16
17 import hivemind.test.FrameworkTestCase;
18
19 import org.apache.commons.logging.LogFactory;
20 import org.apache.hivemind.definition.ConfigurationPointDefinition;
21 import org.apache.hivemind.definition.RegistryDefinition;
22 import org.apache.hivemind.definition.impl.ModuleDefinitionImpl;
23 import org.apache.hivemind.definition.impl.RegistryDefinitionImpl;
24 import org.apache.hivemind.definition.impl.ServicePointDefinitionImpl;
25 import org.apache.hivemind.internal.ConfigurationPoint;
26 import org.apache.hivemind.internal.RegistryInfrastructure;
27 import org.apache.hivemind.internal.ServicePoint;
28
29 /**
30  * Tests for {@link RegistryInfrastructureConstructor}.
31  *
32  * @author Knut Wannheden
33  * @since 1.1
34  */

35 public class TestRegistryInfrastructureConstructor extends FrameworkTestCase
36 {
37     public void testFound()
38     {
39         DefaultErrorHandler errorHandler = new DefaultErrorHandler();
40
41         RegistryDefinition definition = new RegistryDefinitionImpl();
42         
43         ModuleDefinitionImpl fooBar = createModuleDefinition("foo.bar");
44
45         ServicePointDefinitionImpl spd = createServicePointDefinition(fooBar, "sp1", Runnable JavaDoc.class);
46
47         fooBar.addServicePoint(spd);
48
49         ModuleDefinitionImpl zipZoop = createModuleDefinition("zip.zoop");
50
51         ConfigurationPointDefinition cpd = createConfigurationPointDefinition(fooBar, "cp1");
52         
53         zipZoop.addConfigurationPoint(cpd);
54         
55         definition.addModule(fooBar);
56         definition.addModule(zipZoop);
57
58         RegistryInfrastructureConstructor ric = new RegistryInfrastructureConstructor(errorHandler,
59                 LogFactory.getLog(TestRegistryInfrastructureConstructor.class), null);
60
61         RegistryInfrastructure registryInfrastructure = ric.constructRegistryInfrastructure(definition);
62
63         ServicePoint sp = registryInfrastructure.getServicePoint("foo.bar.sp1", null);
64         assertNotNull(sp);
65
66         ConfigurationPoint cp = registryInfrastructure.getConfigurationPoint("zip.zoop.cp1", null);
67         assertNotNull(cp);
68     }
69 }
Popular Tags