KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > test > orb > ORBInitTest


1 package org.jacorb.test.orb;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 1997-2001 Gerald Brose.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */

22
23 import junit.framework.*;
24 import junit.extensions.TestSetup;
25 import org.jacorb.test.common.ORBSetup;
26 import org.jacorb.orb.ParsedIOR;
27 import org.omg.IIOP.ProfileBody_1_1;
28
29
30 /**
31  * <code>ORBInitTest</code> tests ORBInit parsing
32  *
33  * @author <a HREF="mailto:rnc@prismtechnologies.com"></a>
34  * @version 1.0
35  */

36 public class ORBInitTest extends TestCase
37 {
38     /**
39      * <code>ORBInitTest</code> constructor - for JUnit.
40      *
41      * @param name a <code>String</code> value
42      */

43     public ORBInitTest (String JavaDoc name)
44     {
45         super (name);
46     }
47
48
49     /**
50      * <code>suite</code> lists the tests for Junit to run.
51      *
52      * @return a <code>Test</code> value
53      */

54     public static Test suite ()
55     {
56         TestSuite suite = new TestSuite ("ORBInit Test");
57
58         suite.addTest (new ORBInitTest ("testParse1"));
59         suite.addTest (new ORBInitTest ("testParse2"));
60
61         return suite;
62     }
63
64
65     /**
66      * <code>testParse1</code>
67      */

68     public void testParse1 ()
69     {
70         String JavaDoc args[] = new String JavaDoc[3];
71         args[0] = "-ORBInitRef";
72         args[1] = "NameService";
73         args[2] = "foo.ior";
74
75         try
76         {
77             org.omg.CORBA.ORB JavaDoc orbtest = org.omg.CORBA.ORB.init( args, null );
78         }
79         catch (org.omg.CORBA.BAD_PARAM JavaDoc e )
80         {
81             // Correct exception
82
return;
83         }
84         catch (Exception JavaDoc e )
85         {
86             fail( "Incorrect exception " + e);
87         }
88         fail( "No exception");
89     }
90
91
92     /**
93      * <code>testParse2</code>
94      */

95     public void testParse2 ()
96     {
97         String JavaDoc args[] = new String JavaDoc[2];
98         args[0] = "-ORBInitRef";
99         args[1] = "NameService=foo.ior";
100
101         try
102         {
103             org.omg.CORBA.ORB JavaDoc orbtest = org.omg.CORBA.ORB.init( args, null );
104         }
105         catch (Exception JavaDoc e )
106         {
107             fail( "Incorrect exception " + e);
108         }
109     }
110 }
111
Popular Tags