Examples of TestConfiguration


Examples of org.apache.derbyTesting.junit.TestConfiguration

        // 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();
        JDBCDataSource.setBeanProperty(startMasterDS, "connectionAttributes",
                "startMaster=true;slaveHost=" + config.getHostName() +
                ";slavePort=" + config.getPort());
        long giveUp =
            System.currentTimeMillis() + NetworkServerTestSetup.getWaitTime();
        Connection c = null;
        while (c == null) {
            try {
View Full Code Here

Examples of org.apache.derbyTesting.junit.TestConfiguration

        assertResults( conn, query, EXPECTED_CONSTRAINT_STATE, true );

        //
        // Create a dblook script.
        //
        TestConfiguration   config = getTestConfiguration();
        String      dbName = config.getPhysicalDatabaseName( config.getDefaultDatabaseName() );
        new dblook
            (
             new String[]
             {
                 "-d",
View Full Code Here

Examples of org.apache.derbyTesting.junit.TestConfiguration

            return new BaseTestSuite("Compatibility tests skipped because " +
                                 "client or server is missing");
        }
        BaseTestSuite suite = new BaseTestSuite();
        addVersionCombinations(suite);
        TestConfiguration config = TestConfiguration.getCurrent();
        return new SecurityManagerSetup(
                new ServerSetup(suite, "localhost", config.getPort()),
                // Need permission for getProtectionDomain to determine what
                // to put on the classpath for the spawned process(es).
                VersionCombinationConfigurator.class.getName().
                    replaceAll("\\.", "/") + ".policy",
                true);
View Full Code Here

Examples of org.apache.derbyTesting.junit.TestConfiguration

        return suite;
    }

    public void testReadMeFilesExist() throws IOException, SQLException {
        getConnection();
        TestConfiguration currentConfig = TestConfiguration.getCurrent();
        String dbPath = currentConfig.getDatabasePath(currentConfig.getDefaultDatabaseName());
        lookForReadmeFile(dbPath);
        lookForReadmeFile(dbPath+File.separator+"seg0");

        String logDevice = currentConfig.getConnectionAttributes().getProperty("logDevice");
        if (logDevice != null) {
            lookForReadmeFile(logDir+File.separator+"log");
        } else {
            lookForReadmeFile(dbPath+File.separator+"log");
        }
View Full Code Here

Examples of org.apache.derbyTesting.junit.TestConfiguration

        // First get a connection to make sure the engine is booted.
        getConnection().close();

        // Shut down the engine. This used to fail with an
        // AccessControlException on Java 8 before DERBY-6224.
        TestConfiguration config = TestConfiguration.getCurrent();
        config.shutdownEngine();

        // Test whether shutdown deregistered the driver. On versions prior
        // to Java 8/JDBC 4.2, we expect the driver to be deregistered even
        // though the permission is missing, and the call to getDrivers()
        // should not return any instance of AutoloadedDriver.
View Full Code Here

Examples of org.apache.derbyTesting.junit.TestConfiguration

     * test if any of the fixtures fail.
     * </p>
     */
    public void runBareOverridable() throws Throwable {
        PrintStream out = System.out;
        TestConfiguration config = getTestConfiguration();
        boolean stopAfterFirstFail = config.stopAfterFirstFail();
        try {
            super.runBareOverridable();  
        }
        // To log the exception to file, copy the derby.log file and copy
        // the database of the failed test.
View Full Code Here

Examples of org.apache.derbyTesting.junit.TestConfiguration

        }
        super.tearDown();
    }

    public void testTempNotReadable() throws SQLException {
        final TestConfiguration config = TestConfiguration.getCurrent();

        // First make sure the database exists and is not booted.
        getConnection().close();
        config.shutdownDatabase();

        // Now make sure the database has a tmp directory that cannot be read.
        tmpDir = new File(
            config.getDatabasePath(config.getDefaultDatabaseName()), "tmp");
        assertTrue(PrivilegedFileOpsForTests.mkdir(tmpDir));
        PrivilegedFileOpsForTests.setReadable(tmpDir, false, true);

        // Booting the database used to fail with a NullPointerException.
        // Should succeed now.
View Full Code Here

Examples of org.apache.derbyTesting.junit.TestConfiguration

     * @throws UnknownHostException if the server host cannot be resolved
     */
    private Socket createSocket()
            throws IOException, UnknownHostException {
        Socket socket = null;
        final TestConfiguration cfg = getTestConfiguration();
        try {
            socket = AccessController.doPrivileged (
                new java.security.PrivilegedExceptionAction<Socket>() {
                    public Socket run()
                            throws IOException, UnknownHostException {
                        return new Socket(cfg.getHostName(), cfg.getPort());
                    }
                }
            );
        } catch (PrivilegedActionException pae) {
            if (pae.getCause() instanceof IOException) {
View Full Code Here

Examples of org.apache.derbyTesting.junit.TestConfiguration

    protected void setUp() throws SQLException
    {
        UpgradeChange.phase.set(new Integer(phase));
        UpgradeChange.oldVersion.set(version);
       
        TestConfiguration config = TestConfiguration.getCurrent();
        trace = config.doTrace();
        if ( trace )
        {
            String versStr = ((int[]) UpgradeChange.oldVersion.get())[0]
                    + "." ((int[]) UpgradeChange.oldVersion.get())[1]
                    + "." ((int[]) UpgradeChange.oldVersion.get())[2]
View Full Code Here

Examples of org.apache.derbyTesting.junit.TestConfiguration

    }

    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
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.