01: /*
02: * (c) Copyright 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: * All rights reserved.
04: * [See end of file]
05: */
06:
07: package com.hp.hpl.jena.test;
08:
09: import java.lang.reflect.Method;
10:
11: import junit.framework.TestSuite;
12:
13: /** This class provides an indiret way to get the ARQ test suite.
14: * This is done to remove a Jena compile-time dependency on ARQ.
15: * @author Andy Seaborne
16: * @version $Id: TestPackageARQ.java,v 1.4 2008/01/02 12:09:47 andy_seaborne Exp $
17: */
18:
19: public class TestPackageARQ extends TestSuite {
20: public static TestSuite suite() {
21: return suiteByReflection("com.hp.hpl.jena.sparql.test.ARQTestSuite");
22: }
23:
24: private static TestSuite suiteByReflection(String className) {
25: // Reflection to invoke <class>.suite() and return a TestSuite.
26: Class cmd = null;
27: try {
28: cmd = Class.forName(className);
29: } catch (ClassNotFoundException ex) {
30: return null;
31: }
32:
33: Method method = null;
34: try {
35: method = cmd.getMethod("suite", new Class[] {});
36: } catch (NoSuchMethodException ex) {
37: System.err.println("'suite' not found but the class '"
38: + className + "' was");
39: return null;
40: }
41:
42: try {
43: return (TestSuite) method.invoke(null, new Object[] {});
44: } catch (Exception ex) {
45: System.err.println("Failed to invoke static method 'suite'"
46: + ex.getMessage());
47: ex.printStackTrace(System.err);
48: }
49: return null;
50: }
51: }
52:
53: /*
54: * (c) Copyright 2006, 2007, 2008 Hewlett-Packard Development Company, LP
55: * All rights reserved.
56: *
57: * Redistribution and use in source and binary forms, with or without
58: * modification, are permitted provided that the following conditions
59: * are met:
60: * 1. Redistributions of source code must retain the above copyright
61: * notice, this list of conditions and the following disclaimer.
62: * 2. Redistributions in binary form must reproduce the above copyright
63: * notice, this list of conditions and the following disclaimer in the
64: * documentation and/or other materials provided with the distribution.
65: * 3. The name of the author may not be used to endorse or promote products
66: * derived from this software without specific prior written permission.
67: *
68: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
69: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
70: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
71: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
72: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
73: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
74: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
75: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
76: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
77: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
78: */
|