KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > j2ee > j2eeobjectnames > NameFactoryTest


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

17 package org.apache.geronimo.j2ee.j2eeobjectnames;
18
19 import javax.management.ObjectName JavaDoc;
20
21 import junit.framework.TestCase;
22
23 /**
24  * @version $Rev: $ $Date: $
25  */

26 public class NameFactoryTest extends TestCase {
27     String JavaDoc d = "d";
28     String JavaDoc s = "s";
29     String JavaDoc a = "a";
30     String JavaDoc mt = "mt";
31     String JavaDoc m = "m";
32     String JavaDoc t = "t";
33     String JavaDoc n = "n";
34     J2eeContext context = new J2eeContextImpl("d1", "s1", "a1", "mt1", "m1", "n1", "t1");
35
36
37     public void testquery1() throws Exception JavaDoc {
38         ObjectName JavaDoc o1 = NameFactory.getComponentNameQuery(d, s, a, n, t, context);
39         ObjectName JavaDoc o2 = NameFactory.getComponentNameQuery(d, s, a, null, "*", n, t, context);
40         assertEquals(o1, o2);
41         assertEquals(o1, ObjectName.getInstance("d:J2EEServer=s,J2EEApplication=a,j2eeType=t,name=n,*"));
42     }
43
44     public void testquery2() throws Exception JavaDoc {
45         ObjectName JavaDoc o1 = NameFactory.getComponentInModuleQuery(d, s, a, mt, m, t, context);
46         ObjectName JavaDoc o2 = NameFactory.getComponentNameQuery(d, s, a, mt, m, "*", t, context);
47         assertEquals(o1, o2);
48 // System.out.println(o1);
49
assertEquals(o1, ObjectName.getInstance("d:j2eeType=t,J2EEServer=s,J2EEApplication=a,mt=m,*"));
50     }
51 }
52
Popular Tags