Package org.apache.derbyTesting.junit

Examples of org.apache.derbyTesting.junit.TestConfiguration


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

        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

    }

    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

        }
       
        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

     * @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

    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

    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

            // 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<Throwable> errors =
                Collections.synchronizedList(new ArrayList<Throwable>());

        Runnable r = new Runnable() {
View Full Code Here

     * @throws UnknownHostException if the server host cannot be resolved
     */
    private static Socket createSocket()
            throws IOException, UnknownHostException {
        Socket socket = null;
        final TestConfiguration cfg = TestConfiguration.getCurrent();
        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

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.