KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > hivemind > xml > TestContains


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.xml;
16
17 import hivemind.test.IMultipleService;
18 import hivemind.test.IUniqueService;
19
20 import org.apache.hivemind.Registry;
21
22 /**
23  * Tests Registry.contains functionality.
24  *
25  * @author Naresh Sikha
26  */

27 public class TestContains extends XmlTestCase
28 {
29     private Registry registry;
30
31     protected void setUp() throws Exception JavaDoc
32     {
33         super.setUp();
34         
35         registry = buildFrameworkRegistry("contains.xml");
36     }
37
38     protected void tearDown() throws Exception JavaDoc
39     {
40         super.tearDown();
41         
42         registry.shutdown();
43     }
44
45     public void testConfiguration()
46     {
47         assertTrue(registry.containsConfiguration("hivemind.tests.contains.Simple"));
48     }
49
50     public void testConfigurationFailure()
51     {
52         assertTrue(!registry.containsConfiguration("xhivemind.tests.contains.Simple"));
53     }
54     
55     public void testService()
56     {
57         assertTrue(registry.containsService("hivemind.tests.contains.multipleServiceOne", IMultipleService.class));
58     }
59     
60     public void testServiceFailure()
61     {
62         assertTrue(!registry.containsService("hivemind.tests.contains.multipleServiceOne", IUniqueService.class));
63         assertTrue(!registry.containsService("xhivemind.tests.contains.multipleServiceOne", IMultipleService.class));
64     }
65
66     public void testUniqueService()
67     {
68         assertTrue(registry.containsService(IUniqueService.class));
69     }
70
71     public void testUniqueServiceFailure()
72     {
73         assertTrue(!registry.containsService(IMultipleService.class));
74     }
75
76 }
77
Popular Tags