/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* CVS $Id: IntegrationXmlRpcTests.java,v 1.9 2004/02/24 03:22:45 vgritsenko Exp $
*/
package org.apache.xindice;
import org.apache.xindice.integration.IntegrationTests;
import org.apache.xindice.integration.client.XmlDbClient;
import org.apache.xindice.integration.client.XmlDbClientSetup;
import org.xmldb.api.DatabaseManager;
import org.xmldb.api.base.Database;
import junit.framework.Test;
import junitx.extensions.TestSetup;
/**
* Integration tests for the client code which communicates
* with the server by XML-RPC. The host and port may be
* configured with the system property <code>test.xmlrpc.hostport</code>,
* which is expected to be a string of the form <code>host:port</code>
* or <code>host</code>. The path to the XML-RPC service in the web server
* may be configured with the system property
* <code>test.xmlrpc.service-location</code>,
* which is expected to be a string of the form <code>/path.../</code>.
* @version CVS $Revision: 1.9 $, $Date: 2004/02/24 03:22:45 $
* @author Vladimir R. Bossicard <vladimir@apache.org>
* @author Gary Shea <shea@gtsdesign.com>
*/
public class IntegrationXmlRpcTests {
public static void main(java.lang.String[] args) throws Exception{
junit.textui.TestRunner.run(suite());
}
public static Test suite() throws Exception {
String url = "xmldb:xindice://";
String hostport = System.getProperty("test.xmlrpc.hostport", "localhost:8888");
if (hostport != null) {
url = url + hostport;
}
return new TestSetup(new XmlDbClientSetup(IntegrationTests.testSuite("XmlRpc client integration tests"), new XmlDbClient(url))) {
private Database database;
public void setUp() throws Exception {
String driver = "org.apache.xindice.client.xmldb.xmlrpc.DatabaseImpl";
Class cls = Class.forName(driver);
database = (Database) cls.newInstance();
String serviceLocation = System.getProperty("test.xmlrpc.service-location");
if (serviceLocation != null) {
database.setProperty("service-location", serviceLocation);
}
String xmlrpcDriver = System.getProperty("test.xmlrpc.driver");
if (xmlrpcDriver != null) {
database.setProperty("xmlrpc-driver", xmlrpcDriver);
}
DatabaseManager.registerDatabase(database);
}
public void tearDown() throws Exception {
if (database != null) {
DatabaseManager.deregisterDatabase(database);
}
}
};
}
}