Source code: hivemind/test/TestContains.java
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 hivemind.test;
16
17 import org.apache.hivemind.Registry;
18
19 /**
20 * Tests Registry.contains functionality.
21 *
22 * @author Naresh Sikha
23 */
24 public class TestContains extends FrameworkTestCase
25 {
26 private Registry registry;
27
28 protected void setUp() throws Exception
29 {
30 super.setUp();
31
32 registry = buildFrameworkRegistry("contains.xml");
33 }
34
35 protected void tearDown() throws Exception
36 {
37 super.tearDown();
38
39 registry.shutdown();
40 }
41
42 public void testConfiguration()
43 {
44 assertTrue(registry.containsConfiguration("hivemind.tests.contains.Simple"));
45 }
46
47 public void testConfigurationFailure()
48 {
49 assertTrue(!registry.containsConfiguration("xhivemind.tests.contains.Simple"));
50 }
51
52 public void testService()
53 {
54 assertTrue(registry.containsService("hivemind.tests.contains.multipleServiceOne", IMultipleService.class));
55 }
56
57 public void testServiceFailure()
58 {
59 assertTrue(!registry.containsService("hivemind.tests.contains.multipleServiceOne", IUniqueService.class));
60 assertTrue(!registry.containsService("xhivemind.tests.contains.multipleServiceOne", IMultipleService.class));
61 }
62
63 public void testUniqueService()
64 {
65 assertTrue(registry.containsService(IUniqueService.class));
66 }
67
68 public void testUniqueServiceFailure()
69 {
70 assertTrue(!registry.containsService(IMultipleService.class));
71 }
72
73 }