KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > test > common > JacORBTestCase


1 package org.jacorb.test.common;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 2005 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, 51 Franklin Street, Fifth Floor, Boston,
21  * MA 02110-1301, USA.
22  */

23
24 import junit.framework.*;
25
26 /**
27  * A special TestCase that is capable of deciding whether it applies
28  * to a certain client and server version.
29  *
30  * @author Andre Spiegel spiegel@gnu.org
31  * @version $Id: JacORBTestCase.java,v 1.2 2005/05/16 11:37:57 andre.spiegel Exp $
32  */

33 public class JacORBTestCase extends TestCase implements JacORBTest
34 {
35     private TestAnnotations annotations = null;
36     
37     public JacORBTestCase (String JavaDoc name)
38     {
39         super(name);
40         String JavaDoc clientVersion = System.getProperty ("jacorb.test.client.version",
41                                                    "cvs");
42         String JavaDoc serverVersion = System.getProperty ("jacorb.test.server.version",
43                                                    "cvs");
44         if (!clientVersion.equals("cvs") || !serverVersion.equals("cvs"))
45         {
46             annotations = TestAnnotations.forTestCase (this);
47         }
48     }
49
50     /**
51      * Indicates whether this Test is applicable to a given client and
52      * server ORB version.
53      */

54     public boolean isApplicableTo (String JavaDoc clientVersion, String JavaDoc serverVersion)
55     {
56         if (annotations == null)
57             return true;
58         else
59         {
60             boolean result = annotations.isApplicableTo (clientVersion,
61                                                          serverVersion);
62             if (!result) System.out.println ("not applicable: " + getName());
63             return result;
64         }
65     }
66     
67 }
68
Popular Tags