Package org.apache.derbyTesting.junit

Examples of org.apache.derbyTesting.junit.TestConfiguration


                // if it exists, attempt to get rid of it
                PrivilegedFileOpsForTests.delete(traceFile);
            }
        }

        TestConfiguration config = TestConfiguration.getCurrent();
                for (String dbName : ADDITIONAL_DBS) {
            removeDirectory(config.getDatabasePath(dbName));
        }

        super.tearDown();
    }
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()) {
            List<String> urlComponents = Arrays.asList(url.split(";"));

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

            // Put each actual connection attribute in a HashSet for easy
            // comparison.
            HashSet<String> attrs = new HashSet<String>(
                    urlComponents.subList(1, urlComponents.size()));

            // Put each expected connection attribute in a HashSet.
            HashSet<String> expectedAttrs = new HashSet<String>();
            Properties ca = config.getConnectionAttributes();
            for (String key : ca.stringPropertyNames()) {
                expectedAttrs.add(key + '=' + ca.getProperty(key));
            }

            // Verify that the actual connection attributes match the
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

            return new TestSuite("Compatibility tests skipped because " +
                                 "client or server is missing");
        }
        TestSuite suite = new TestSuite();
        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

        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

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

            // is a bug on Java 6 that causes problems when autoloading happens
            // in multiple threads at once. See DERBY-4480.
            return;
        }

        TestConfiguration tc = getTestConfiguration();
        final String url = tc.getJDBCUrl() + ";create=true";
        final String user = tc.getUserName();
        final String pw = tc.getUserPassword();

        final List errors = Collections.synchronizedList(new ArrayList());

        Runnable r = new Runnable() {
            public void run() {
View Full Code Here

     */
    public void testReadMeFiles() throws SQLException, IOException
    {
        Statement s = createStatement();
        s.close();
        TestConfiguration currentConfig = TestConfiguration.getCurrent();
        String dbPath = currentConfig.getDatabasePath(currentConfig.getDefaultDatabaseName());
        switch (getPhase())
        {
        case PH_CREATE:
        case PH_SOFT_UPGRADE:
        case PH_POST_SOFT_UPGRADE:
View Full Code Here

            getConnection();
            saveEncryptionAlgorithm();
        }

        // Make sure the database is (still) encrypted.
        TestConfiguration tc = getTestConfiguration();
        tc.shutdownDatabase();
        try {
            connect(false, null, null);
            tc.shutdownDatabase();
            // Database has been decrypted. Encrypt it again.
            println("encrypting database (" + encryptionAlgorithm + ")");
            connect(false, BOOTPW, "dataEncryption=true;encryptionAlgorithm=" +
                    encryptionAlgorithm);
            tc.shutdownDatabase();
            connect(false, null, null);
            fail("database encryption failed");
        } catch (SQLException sqle) {
            assertSQLState("XBM06", sqle);
        }
View Full Code Here

        cs.close();
    }

    private void verifyNewLocations(int noOfObjects)
            throws SQLException {
        TestConfiguration tc = TestConfiguration.getCurrent();
        String dbPath = tc.getPhysicalDatabaseName(tc.getDefaultDatabaseName());
        String jarDirName =
            "system" + File.separator + dbPath + File.separator + "jar";
        File jarDir = new File(jarDirName);

        assertTrue(jarDir.isDirectory());
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.