Package org.apache.derbyTesting.junit

Examples of org.apache.derbyTesting.junit.JDBCClient


    public void testDSRequestAuthentication() throws Exception {

//        if (usingDerbyNetClient())
//            return;
       
        JDBCClient dsclient = getTestConfiguration().getJDBCClient();
        String dsName = dsclient.getDataSourceClassName();
        DataSource ds = (DataSource) Class.forName(dsName).newInstance();

        // DataSource - attributesAsPassword=true");
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);

        // DataSource - attributesAsPassword=true,
        // connectionAttributes=databaseName=kangaroo");
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        JDBCDataSource.setBeanProperty(ds, "connectionAttributes", "databaseName=kangaroo");
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);
        JDBCDataSource.clearStringBeanProperty(ds, "connectionAttributes");

        // Enable Authentication;

        setDatabaseProperty("derby.user.fred", "wilma");
        setDatabaseProperty("derby.user.APP", "APP");
        setDatabaseProperty("derby.authentication.provider", "BUILTIN");
        setDatabaseProperty("derby.connection.requireAuthentication", "true");
       
        JDBCDataSource.setBeanProperty(ds, "shutdownDatabase", "shutdown");
        try {
            ds.getConnection();
            fail("shutdown should raise exception");
        } catch (SQLException sqle) {
            assertSQLState("XJ015", sqle);
        }

        JDBCDataSource.clearStringBeanProperty(ds, "databaseName");
        JDBCDataSource.clearStringBeanProperty(ds, "shutdownDatabase");

        // "AUTHENTICATION NOW ENABLED");

        // DataSource - attributesAsPassword=true
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);

        // ensure the DS property password is not treated as a set of
        // attributes.
        // DataSource - attributesAsPassword=true, user=fred,
        //     password=databaseName=wombat;password=wilma
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        JDBCDataSource.setBeanProperty(ds, "user", "fred");
        JDBCDataSource.setBeanProperty(ds, "password", "databaseName=" + dbName + ";password=wilma");
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);
        JDBCDataSource.clearStringBeanProperty(ds, "user");
        JDBCDataSource.clearStringBeanProperty(ds, "password");
        ds = null;

        // now with ConnectionPoolDataSource
        String cpdsName = dsclient.getConnectionPoolDataSourceClassName();
        ConnectionPoolDataSource cpds =
              (ConnectionPoolDataSource) Class.forName(cpdsName).newInstance();

        // ConnectionPoolDataSource - EMPTY
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ004",
            "XJ004","XJ004","XJ004","XJ004","XJ004"},
            (ConnectionPoolDataSource)cpds);

        // ConnectionPoolDataSource -
        // connectionAttributes=databaseName=wombat
        JDBCDataSource.setBeanProperty(cpds, "connectionAttributes", "databaseName=" + dbName);
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ004",
            "XJ004","XJ004","XJ004","XJ004","XJ004"},
            (ConnectionPoolDataSource)cpds);
        JDBCDataSource.clearStringBeanProperty(cpds, "connectionAttributes");

        // ConnectionPoolDataSource - attributesAsPassword=true
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.TRUE);
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"},
            (ConnectionPoolDataSource)cpds);
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.FALSE);
       
        // ensure the DS property password is not treated as a set of
        // attributes.
        // ConnectionPoolDataSource - attributesAsPassword=true,
        //     user=fred, password=databaseName=wombat;password=wilma");
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.TRUE);
        JDBCDataSource.setBeanProperty(cpds, "user", "fred");
        JDBCDataSource.setBeanProperty(cpds, "password", "databaseName=" + dbName + ";password=wilma");
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"},
            (ConnectionPoolDataSource)cpds);
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.FALSE);
        JDBCDataSource.clearStringBeanProperty(cpds, "user");
        JDBCDataSource.clearStringBeanProperty(cpds, "password");
        cpds = null;

        // now with XADataSource
//        EmbeddedXADataSource xads = new EmbeddedXADataSource();
        String xadsName = dsclient.getXADataSourceClassName();
        XADataSource xads =
                (XADataSource) Class.forName(xadsName).newInstance();

        // XADataSource - EMPTY
        dsConnectionRequests(new String[] { 
View Full Code Here


    // Note that in this simple shape, there is no authentication done
    // but the fixture name is kept the same for reference to the J2EE one.
    public void testDSRequestAuthentication() throws SQLException {

        // Create an empty datasource of the type befitting the jvm/client/server
        JDBCClient dsclient = getTestConfiguration().getJDBCClient();
        String dsName = dsclient.getDataSourceClassName();
        DataSource ds = null;
        try {
            ds = (javax.sql.DataSource) Class.forName(dsName).newInstance();
        } catch (Exception e) {
            fail("unable to complete test because unable to create new instance of datasource");
View Full Code Here

     * not need to be explicitly set in this test.
     */
    public void testSettingBootAllPropertyWithHomePropertySet()
            throws Exception
    {
        JDBCClient embedded = getTestConfiguration().getJDBCClient();

        String driverName = embedded.getJDBCDriverName();
        String url = embedded.getUrlBase();
       
        // Ensure the engine is not booted.
        try {
            DriverManager.getDriver(url);
            fail("Derby is booted!");
View Full Code Here

    public void testDSRequestAuthentication() throws Exception {

//        if (usingDerbyNetClient())
//            return;
       
        JDBCClient dsclient = getTestConfiguration().getJDBCClient();
        String dsName = dsclient.getDataSourceClassName();
        DataSource ds = (DataSource) Class.forName(dsName).newInstance();

        // DataSource - attributesAsPassword=true");
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);

        // DataSource - attributesAsPassword=true,
        // connectionAttributes=databaseName=kangaroo");
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        JDBCDataSource.setBeanProperty(ds, "connectionAttributes", "databaseName=kangaroo");
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);
        JDBCDataSource.clearStringBeanProperty(ds, "connectionAttributes");

        // Enable Authentication;

        setDatabaseProperty("derby.user.fred", "wilma");
        setDatabaseProperty("derby.user.APP", "APP");
        setDatabaseProperty("derby.authentication.provider", "BUILTIN");
        setDatabaseProperty("derby.connection.requireAuthentication", "true");
       
        JDBCDataSource.setBeanProperty(ds, "shutdownDatabase", "shutdown");
        try {
            ds.getConnection();
        } catch (SQLException sqle) {
            assertSQLState("XJ015", sqle);
        }

        JDBCDataSource.clearStringBeanProperty(ds, "databaseName");
        JDBCDataSource.clearStringBeanProperty(ds, "shutdownDatabase");

        // "AUTHENTICATION NOW ENABLED");

        // DataSource - attributesAsPassword=true
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);

        // ensure the DS property password is not treated as a set of
        // attributes.
        // DataSource - attributesAsPassword=true, user=fred,
        //     password=databaseName=wombat;password=wilma
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        JDBCDataSource.setBeanProperty(ds, "user", "fred");
        JDBCDataSource.setBeanProperty(ds, "password", "databaseName=" + dbName + ";password=wilma");
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);
        JDBCDataSource.clearStringBeanProperty(ds, "user");
        JDBCDataSource.clearStringBeanProperty(ds, "password");
        ds = null;

        // now with ConnectionPoolDataSource
        String cpdsName = dsclient.getConnectionPoolDataSourceClassName();
        ConnectionPoolDataSource cpds =
              (ConnectionPoolDataSource) Class.forName(cpdsName).newInstance();

        // ConnectionPoolDataSource - EMPTY
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ004",
            "XJ004","XJ004","XJ004","XJ004","XJ004"},
            (ConnectionPoolDataSource)cpds);

        // ConnectionPoolDataSource -
        // connectionAttributes=databaseName=wombat
        JDBCDataSource.setBeanProperty(cpds, "connectionAttributes", "databaseName=" + dbName);
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ004",
            "XJ004","XJ004","XJ004","XJ004","XJ004"},
            (ConnectionPoolDataSource)cpds);
        JDBCDataSource.clearStringBeanProperty(cpds, "connectionAttributes");

        // ConnectionPoolDataSource - attributesAsPassword=true
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.TRUE);
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"},
            (ConnectionPoolDataSource)cpds);
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.FALSE);
       
        // ensure the DS property password is not treated as a set of
        // attributes.
        // ConnectionPoolDataSource - attributesAsPassword=true,
        //     user=fred, password=databaseName=wombat;password=wilma");
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.TRUE);
        JDBCDataSource.setBeanProperty(cpds, "user", "fred");
        JDBCDataSource.setBeanProperty(cpds, "password", "databaseName=" + dbName + ";password=wilma");
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"},
            (ConnectionPoolDataSource)cpds);
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.FALSE);
        JDBCDataSource.clearStringBeanProperty(cpds, "user");
        JDBCDataSource.clearStringBeanProperty(cpds, "password");
        cpds = null;

        // now with XADataSource
//        EmbeddedXADataSource xads = new EmbeddedXADataSource();
        String xadsName = dsclient.getXADataSourceClassName();
        XADataSource xads =
                (XADataSource) Class.forName(xadsName).newInstance();

        // XADataSource - EMPTY
        dsConnectionRequests(new String[] { 
View Full Code Here

    // Note that in this simple shape, there is no authentication done
    // but the fixture name is kept the same for reference to the J2EE one.
    public void testDSRequestAuthentication() throws SQLException {

        // Create an empty datasource of the type befitting the jvm/client/server
        JDBCClient dsclient = getTestConfiguration().getJDBCClient();
        String dsName = dsclient.getDataSourceClassName();
        DataSource ds = null;
        try {
            ds = (javax.sql.DataSource) Class.forName(dsName).newInstance();
        } catch (Exception e) {
            fail("unable to complete test because unable to create new instance of datasource");
View Full Code Here

     * not need to be explicitly set in this test.
     */
    public void testSettingBootAllPropertyWithHomePropertySet()
            throws Exception
    {
        JDBCClient embedded = getTestConfiguration().getJDBCClient();

        String driverName = embedded.getJDBCDriverName();
        String url = embedded.getUrlBase();
       
        // Ensure the engine is not booted.
        try {
            DriverManager.getDriver(url);
            fail("Derby is booted!");
View Full Code Here

    public void testDSRequestAuthentication() throws Exception {

//        if (usingDerbyNetClient())
//            return;
       
        JDBCClient dsclient = getTestConfiguration().getJDBCClient();
        String dsName = dsclient.getDataSourceClassName();
        DataSource ds = (DataSource) Class.forName(dsName).newInstance();

        // DataSource - attributesAsPassword=true");
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);

        // DataSource - attributesAsPassword=true,
        // connectionAttributes=databaseName=kangaroo");
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        JDBCDataSource.setBeanProperty(ds, "connectionAttributes", "databaseName=kangaroo");
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);
        JDBCDataSource.clearStringBeanProperty(ds, "connectionAttributes");

        // Enable Authentication;

        setDatabaseProperty("derby.user.fred", "wilma");
        setDatabaseProperty("derby.user.APP", "APP");
        setDatabaseProperty("derby.authentication.provider", "BUILTIN");
        setDatabaseProperty("derby.connection.requireAuthentication", "true");
       
        JDBCDataSource.setBeanProperty(ds, "shutdownDatabase", "shutdown");
        try {
            ds.getConnection();
            fail("shutdown should raise exception");
        } catch (SQLException sqle) {
            assertSQLState("XJ015", sqle);
        }

        JDBCDataSource.clearStringBeanProperty(ds, "databaseName");
        JDBCDataSource.clearStringBeanProperty(ds, "shutdownDatabase");

        // "AUTHENTICATION NOW ENABLED");

        // DataSource - attributesAsPassword=true
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);

        // ensure the DS property password is not treated as a set of
        // attributes.
        // DataSource - attributesAsPassword=true, user=fred,
        //     password=databaseName=wombat;password=wilma
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        JDBCDataSource.setBeanProperty(ds, "user", "fred");
        JDBCDataSource.setBeanProperty(ds, "password", "databaseName=" + dbName + ";password=wilma");
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);
        JDBCDataSource.clearStringBeanProperty(ds, "user");
        JDBCDataSource.clearStringBeanProperty(ds, "password");
        ds = null;

        // now with ConnectionPoolDataSource
        String cpdsName = dsclient.getConnectionPoolDataSourceClassName();
        ConnectionPoolDataSource cpds =
              (ConnectionPoolDataSource) Class.forName(cpdsName).newInstance();

        // ConnectionPoolDataSource - EMPTY
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ004",
            "XJ004","XJ004","XJ004","XJ004","XJ004"},
            (ConnectionPoolDataSource)cpds);

        // ConnectionPoolDataSource -
        // connectionAttributes=databaseName=wombat
        JDBCDataSource.setBeanProperty(cpds, "connectionAttributes", "databaseName=" + dbName);
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ004",
            "XJ004","XJ004","XJ004","XJ004","XJ004"},
            (ConnectionPoolDataSource)cpds);
        JDBCDataSource.clearStringBeanProperty(cpds, "connectionAttributes");

        // ConnectionPoolDataSource - attributesAsPassword=true
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.TRUE);
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"},
            (ConnectionPoolDataSource)cpds);
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.FALSE);
       
        // ensure the DS property password is not treated as a set of
        // attributes.
        // ConnectionPoolDataSource - attributesAsPassword=true,
        //     user=fred, password=databaseName=wombat;password=wilma");
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.TRUE);
        JDBCDataSource.setBeanProperty(cpds, "user", "fred");
        JDBCDataSource.setBeanProperty(cpds, "password", "databaseName=" + dbName + ";password=wilma");
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"},
            (ConnectionPoolDataSource)cpds);
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.FALSE);
        JDBCDataSource.clearStringBeanProperty(cpds, "user");
        JDBCDataSource.clearStringBeanProperty(cpds, "password");
        cpds = null;

        // now with XADataSource
//        EmbeddedXADataSource xads = new EmbeddedXADataSource();
        String xadsName = dsclient.getXADataSourceClassName();
        XADataSource xads =
                (XADataSource) Class.forName(xadsName).newInstance();

        // XADataSource - EMPTY
        dsConnectionRequests(new String[] { 
View Full Code Here

    public void testDSRequestAuthentication() throws Exception {

//        if (usingDerbyNetClient())
//            return;
       
        JDBCClient dsclient = getTestConfiguration().getJDBCClient();
        String dsName = dsclient.getDataSourceClassName();
        DataSource ds = (DataSource) Class.forName(dsName).newInstance();

        // DataSource - attributesAsPassword=true");
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);

        // DataSource - attributesAsPassword=true,
        // connectionAttributes=databaseName=kangaroo");
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        JDBCDataSource.setBeanProperty(ds, "connectionAttributes", "databaseName=kangaroo");
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);
        JDBCDataSource.clearStringBeanProperty(ds, "connectionAttributes");

        // Enable Authentication;

        setDatabaseProperty("derby.user.fred", "wilma");
        setDatabaseProperty("derby.user.APP", "APP");
        setDatabaseProperty("derby.authentication.provider", "BUILTIN");
        setDatabaseProperty("derby.connection.requireAuthentication", "true");
       
        JDBCDataSource.setBeanProperty(ds, "shutdownDatabase", "shutdown");
        try {
            ds.getConnection();
            fail("shutdown should raise exception");
        } catch (SQLException sqle) {
            assertSQLState("XJ015", sqle);
        }

        JDBCDataSource.clearStringBeanProperty(ds, "databaseName");
        JDBCDataSource.clearStringBeanProperty(ds, "shutdownDatabase");

        // "AUTHENTICATION NOW ENABLED");

        // DataSource - attributesAsPassword=true
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);

        // ensure the DS property password is not treated as a set of
        // attributes.
        // DataSource - attributesAsPassword=true, user=fred,
        //     password=databaseName=wombat;password=wilma
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        JDBCDataSource.setBeanProperty(ds, "user", "fred");
        JDBCDataSource.setBeanProperty(ds, "password", "databaseName=" + dbName + ";password=wilma");
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);
        JDBCDataSource.clearStringBeanProperty(ds, "user");
        JDBCDataSource.clearStringBeanProperty(ds, "password");
        ds = null;

        // now with ConnectionPoolDataSource
        String cpdsName = dsclient.getConnectionPoolDataSourceClassName();
        ConnectionPoolDataSource cpds =
              (ConnectionPoolDataSource) Class.forName(cpdsName).newInstance();

        // ConnectionPoolDataSource - EMPTY
        dsCPConnectionRequests(new String[] {
            "XJ004","XJ004","XJ004","XJ004",
            "XJ004","XJ004","XJ004","XJ004","XJ004"},
            cpds);

        // ConnectionPoolDataSource -
        // connectionAttributes=databaseName=wombat
        JDBCDataSource.setBeanProperty(cpds, "connectionAttributes", "databaseName=" + dbName);
        dsCPConnectionRequests(new String[] {
            "XJ004","XJ004","XJ004","XJ004",
            "XJ004","XJ004","XJ004","XJ004","XJ004"},
            cpds);
        JDBCDataSource.clearStringBeanProperty(cpds, "connectionAttributes");

        // ConnectionPoolDataSource - attributesAsPassword=true
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.TRUE);
        dsCPConnectionRequests(new String[] {
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"},
            cpds);
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.FALSE);
       
        // ensure the DS property password is not treated as a set of
        // attributes.
        // ConnectionPoolDataSource - attributesAsPassword=true,
        //     user=fred, password=databaseName=wombat;password=wilma");
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.TRUE);
        JDBCDataSource.setBeanProperty(cpds, "user", "fred");
        JDBCDataSource.setBeanProperty(cpds, "password", "databaseName=" + dbName + ";password=wilma");
        dsCPConnectionRequests(new String[] {
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"},
            cpds);
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.FALSE);
        JDBCDataSource.clearStringBeanProperty(cpds, "user");
        JDBCDataSource.clearStringBeanProperty(cpds, "password");
        cpds = null;

        // now with XADataSource
//        EmbeddedXADataSource xads = new EmbeddedXADataSource();
        String xadsName = dsclient.getXADataSourceClassName();
        XADataSource xads =
                (XADataSource) Class.forName(xadsName).newInstance();

        // XADataSource - EMPTY
        dsXAConnectionRequests(new String[] {
View Full Code Here

    public void testDSRequestAuthentication() throws Exception {

//        if (usingDerbyNetClient())
//            return;
       
        JDBCClient dsclient = getTestConfiguration().getJDBCClient();
        String dsName = dsclient.getDataSourceClassName();
        DataSource ds = (DataSource) Class.forName(dsName).newInstance();

        // DataSource - attributesAsPassword=true");
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);

        // DataSource - attributesAsPassword=true,
        // connectionAttributes=databaseName=kangaroo");
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        JDBCDataSource.setBeanProperty(ds, "connectionAttributes", "databaseName=kangaroo");
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);
        JDBCDataSource.clearStringBeanProperty(ds, "connectionAttributes");

        // Enable Authentication;

        setDatabaseProperty("derby.user.fred", "wilma");
        setDatabaseProperty("derby.user.APP", "APP");
        setDatabaseProperty("derby.authentication.provider", "BUILTIN");
        setDatabaseProperty("derby.connection.requireAuthentication", "true");
       
        JDBCDataSource.setBeanProperty(ds, "shutdownDatabase", "shutdown");
        try {
            ds.getConnection();
            fail("shutdown should raise exception");
        } catch (SQLException sqle) {
            assertSQLState("XJ015", sqle);
        }

        JDBCDataSource.clearStringBeanProperty(ds, "databaseName");
        JDBCDataSource.clearStringBeanProperty(ds, "shutdownDatabase");

        // "AUTHENTICATION NOW ENABLED");

        // DataSource - attributesAsPassword=true
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);

        // ensure the DS property password is not treated as a set of
        // attributes.
        // DataSource - attributesAsPassword=true, user=fred,
        //     password=databaseName=wombat;password=wilma
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.TRUE);
        JDBCDataSource.setBeanProperty(ds, "user", "fred");
        JDBCDataSource.setBeanProperty(ds, "password", "databaseName=" + dbName + ";password=wilma");
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"}, ds);
        JDBCDataSource.setBeanProperty(ds, "attributesAsPassword", Boolean.FALSE);
        JDBCDataSource.clearStringBeanProperty(ds, "user");
        JDBCDataSource.clearStringBeanProperty(ds, "password");
        ds = null;

        // now with ConnectionPoolDataSource
        String cpdsName = dsclient.getConnectionPoolDataSourceClassName();
        ConnectionPoolDataSource cpds =
              (ConnectionPoolDataSource) Class.forName(cpdsName).newInstance();

        // ConnectionPoolDataSource - EMPTY
        dsCPConnectionRequests(new String[] {
            "XJ004","XJ004","XJ004","XJ004",
            "XJ004","XJ004","XJ004","XJ004","XJ004"},
            cpds);

        // ConnectionPoolDataSource -
        // connectionAttributes=databaseName=wombat
        JDBCDataSource.setBeanProperty(cpds, "connectionAttributes", "databaseName=" + dbName);
        dsCPConnectionRequests(new String[] {
            "XJ004","XJ004","XJ004","XJ004",
            "XJ004","XJ004","XJ004","XJ004","XJ004"},
            cpds);
        JDBCDataSource.clearStringBeanProperty(cpds, "connectionAttributes");

        // ConnectionPoolDataSource - attributesAsPassword=true
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.TRUE);
        dsCPConnectionRequests(new String[] {
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"},
            cpds);
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.FALSE);
       
        // ensure the DS property password is not treated as a set of
        // attributes.
        // ConnectionPoolDataSource - attributesAsPassword=true,
        //     user=fred, password=databaseName=wombat;password=wilma");
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.TRUE);
        JDBCDataSource.setBeanProperty(cpds, "user", "fred");
        JDBCDataSource.setBeanProperty(cpds, "password", "databaseName=" + dbName + ";password=wilma");
        dsCPConnectionRequests(new String[] {
            "XJ004","XJ004","XJ004","XJ028",
            "XJ028","XJ004","XJ004","XJ004","XJ004"},
            cpds);
        JDBCDataSource.setBeanProperty(cpds, "attributesAsPassword", Boolean.FALSE);
        JDBCDataSource.clearStringBeanProperty(cpds, "user");
        JDBCDataSource.clearStringBeanProperty(cpds, "password");
        cpds = null;

        // now with XADataSource
//        EmbeddedXADataSource xads = new EmbeddedXADataSource();
        String xadsName = dsclient.getXADataSourceClassName();
        XADataSource xads =
                (XADataSource) Class.forName(xadsName).newInstance();

        // XADataSource - EMPTY
        dsXAConnectionRequests(new String[] {
View Full Code Here

    // Note that in this simple shape, there is no authentication done
    // but the fixture name is kept the same for reference to the J2EE one.
    public void testDSRequestAuthentication() throws SQLException {

        // Create an empty datasource of the type befitting the jvm/client/server
        JDBCClient dsclient = getTestConfiguration().getJDBCClient();
        String dsName = dsclient.getDataSourceClassName();
        DataSource ds = null;
        try {
            ds = (javax.sql.DataSource) Class.forName(dsName).newInstance();
        } catch (Exception e) {
            fail("unable to complete test because unable to create new instance of datasource");
View Full Code Here

TOP

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

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.