Package org.apache.xindice

Source Code of org.apache.xindice.IntegrationXmlRpcTests

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements.  See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
* $Id: IntegrationXmlRpcTests.java 512591 2007-02-28 03:35:44Z vgritsenko $
*/

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 junit.framework.Test;
import junitx.extensions.TestSetup;
import org.xmldb.api.DatabaseManager;
import org.xmldb.api.base.Database;

/**
* 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 $Revision: 512591 $, $Date: 2007-02-27 22:35:44 -0500 (Tue, 27 Feb 2007) $
* @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);
                }
            }
        };
    }

}
TOP

Related Classes of org.apache.xindice.IntegrationXmlRpcTests

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.