Package org.apache.derbyTesting.junit

Examples of org.apache.derbyTesting.junit.TestConfiguration


        createSchema( ruthConnection, Types.INTEGER );
        goodStatement( dboConnection, LOAD_TOOL );
        goodStatement( ruthConnection, INDEX_POEMS );

        TestConfiguration   config = getTestConfiguration();

        String  dbName = config.getDefaultDatabaseName();
        String  physicalDBName = config.getPhysicalDatabaseName( dbName );
        String  dbPath = config.getDatabasePath( physicalDBName );
        File    dbDirectory = new File( dbPath );
        File    luceneDirectory = new File( dbDirectory, "LUCENE" );
        File    ruthDirectory = new File( luceneDirectory, "RUTH" );
        File    poemsDirectory = new File( ruthDirectory, "POEMS" );
        File    poemTextIndexDirectory = new File( poemsDirectory, "POEMTEXT" );
View Full Code Here


        }
       
        assertFalse("getURL is supported!", JDBC.vmSupportsJSR169());
        assertTrue("getURL is supported!", JDBC.vmSupportsJDBC3());

        TestConfiguration config = getTestConfiguration();
        String expectedURL = config.getJDBCUrl();

        // DERBY-4886: Embedded returns the URL without connection attributes,
        // client returns the URL with connection attributes.
        if (usingDerbyNetClient()) {
            String[] urlComponents = url.split(";");

            // Only compare whatever comes before the first semi-colon with
            // the expected URL. Check connection attributes separately.
            url = urlComponents[0];

            // Put each actual connection attribute in a HashSet for easy
            // comparison.
            HashSet attrs = new HashSet();
            for (int i = 1; i < urlComponents.length; i++) {
                attrs.add(urlComponents[i]);
            }

            // Put each expected connection attribute in a HashSet.
            HashSet expectedAttrs = new HashSet();
            Properties ca = config.getConnectionAttributes();
            Enumeration e = ca.propertyNames();
            while (e.hasMoreElements()) {
                String key = (String) e.nextElement();
                expectedAttrs.add(key + '=' + ca.getProperty(key));
            }
View Full Code Here

    {
       Test dtest = new SystemPropertyTestSetup(test, new Properties())
        {
            protected void setUp() throws java.lang.Exception
            {
                TestConfiguration config = TestConfiguration.getCurrent();
               
                // With JDBC 3 connect using a JDBC URL
                if (JDBC.vmSupportsJDBC3())
                {
                   newValues.setProperty(
                        "ij.database",
                        config.getJDBCUrl());
                }
                else if (JDBC.vmSupportsJSR169())
                {
                    // Use a data source and set its database name.
                    // The database will be created by the CleanDatabaseTestSetup
                    // used for each individual fixture/test.
                   
                    newValues.setProperty(
                        "ij.dataSource",
                        "org.apache.derby.jdbc.EmbeddedSimpleDataSource");
                   
                    newValues.setProperty(
                        "ij.dataSource.databaseName",
                        config.getDefaultDatabaseName());
                }
                super.setUp();
            }
        };
       
View Full Code Here

        }
       
        assertFalse("getURL is supported!", JDBC.vmSupportsJSR169());
        assertTrue("getURL is supported!", JDBC.vmSupportsJDBC3());

        TestConfiguration config = getTestConfiguration();
        String expectedURL = config.getJDBCUrl();

        // DERBY-4886: Embedded returns the URL without connection attributes,
        // client returns the URL with connection attributes.
        if (usingDerbyNetClient()) {
            String[] urlComponents = url.split(";");

            // Only compare whatever comes before the first semi-colon with
            // the expected URL. Check connection attributes separately.
            url = urlComponents[0];

            // Put each actual connection attribute in a HashSet for easy
            // comparison.
            HashSet attrs = new HashSet();
            for (int i = 1; i < urlComponents.length; i++) {
                attrs.add(urlComponents[i]);
            }

            // Put each expected connection attribute in a HashSet.
            HashSet expectedAttrs = new HashSet();
            Properties ca = config.getConnectionAttributes();
            Enumeration e = ca.propertyNames();
            while (e.hasMoreElements()) {
                String key = (String) e.nextElement();
                expectedAttrs.add(key + '=' + ca.getProperty(key));
            }
View Full Code Here

    }

    private void    connectToServer()
        throws Exception
    {
        final TestConfiguration config = getTestConfiguration();
        String  url
            = ( "jdbc:derby://localhost:" + config.getPort()
                + "/" + "wombat;create=true"
                + ";user=" + config.getUserName()
                + ";password=" + config.getUserPassword() );

        println( "XXX in connectToServer(). url = " + url );

        // just try to get a connection
        Class.forName( "org.apache.derby.jdbc.ClientDriver" );
View Full Code Here

    private boolean setSecurityMechanism(String derby_security_mechanism)
    throws Exception {
        try {
            // getting a networkservercontrol to shutdown the currently running
            // server, before setting the next security mechanism
            final TestConfiguration config = TestConfiguration.getCurrent();
            NetworkServerControl server = new NetworkServerControl(
                InetAddress.getByName(config.getHostName()),
                config.getPort(),
                config.getUserName(),
                config.getUserPassword());

            // shut down the server
            server.shutdown();
        } catch (Exception e) {
            if (!(e.getMessage().substring(0,17).equals("DRDA_InvalidValue")))
View Full Code Here

        // First establish a connection so that the database is created.
        getConnection().close();

        // Then shut down the database cleanly so that it can be used
        // to seed the replication slave.
        final TestConfiguration config = TestConfiguration.getCurrent();
        config.shutdownDatabase();

        // Copy the database to the slave.
        final String masterDb = config.getDatabasePath(MASTER_DB);
        final String slaveDb = config.getDatabasePath(SLAVE_DB);
        PrivilegedFileOpsForTests.copy(new File(masterDb), new File(slaveDb));

        // And start the slave.
        DataSource startSlaveDS = JDBCDataSource.getDataSource(SLAVE_DB);
        JDBCDataSource.setBeanProperty(startSlaveDS, "connectionAttributes",
                "startSlave=true;slaveHost=" + config.getHostName() +
                ";slavePort=" + config.getPort());
        SlaveThread slave = new SlaveThread(startSlaveDS);
        slave.start();

        // Start the master. This will fail until the slave is up, so do
        // it in a loop until successful or time runs out.
        DataSource startMasterDS = JDBCDataSource.getDataSource();
        String startMasterAttr =
                "startMaster=true;slaveHost=" + config.getHostName() +
                ";slavePort=" + config.getPort();
        JDBCDataSource.setBeanProperty(
                startMasterDS, "connectionAttributes", startMasterAttr);
        println("Starting master with attributes: " + startMasterAttr);
        long giveUp =
            System.currentTimeMillis() + NetworkServerTestSetup.getWaitTime();
View Full Code Here

TOP

Related Classes of org.apache.derbyTesting.junit.TestConfiguration

Copyright © 2018 www.massapicom. 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.