Package com.volantis.mcs.repository.jdbc

Examples of com.volantis.mcs.repository.jdbc.JDBCRepositoryConnection


        JDBCRepositoryImpl repository =
                (JDBCRepositoryImpl) createTestableRepository();

        final String exceptionMessage = "closed connection";

        JDBCRepositoryConnection connection =
                new JDBCRepositoryConnectionImpl(repository, true,
                                             "name", "password", true) {
                    public void closeConnection() throws RepositoryException {
                        throw new RepositoryException(exceptionMessage);
                    }
View Full Code Here


        JDBCRepositoryImpl repository = (JDBCRepositoryImpl)
                createTestableRepository();

        final String closeConnectionMessage = "closeConnection() called";
        JDBCRepositoryConnection connection =
                new JDBCRepositoryConnectionImpl(repository, false, "user",
                                             "password", true) {
                    public void closeConnection() throws RepositoryException {
                        throw new RepositoryException(closeConnectionMessage);
                    }
                };

        try {
            connection.disconnect();
            fail("The closeConnection() method is not called by " +
                 "disconnect().");
        } catch (RepositoryException e) {
            if (!closeConnectionMessage.equals(e.getMessage())) {
                throw e;
View Full Code Here

        JDBCRepositoryImpl repository = (JDBCRepositoryImpl)
                createTestableRepository();

        Collection connections = repository.connections;
        connections.clear();
        JDBCRepositoryConnection connection =
                new JDBCRepositoryConnectionImpl(repository, false, "user",
                                             "password", true);
        connection.getConnection();
        assertEquals("There should be one connection in the connections" +
                     "collection", 1, connections.size());
        connection.closeConnection();
        assertEquals("There should be no connections in the connections" +
                     "collection", 0, connections.size());
    }
View Full Code Here

        JDBCRepositoryImpl repository = (JDBCRepositoryImpl)
                createTestableRepository();

        Collection connections = repository.connections;
        connections.clear();
        JDBCRepositoryConnection connection =
                new JDBCRepositoryConnectionImpl(repository, false, "user",
                                             "password", true);
        connection.getConnection();
        assertEquals("There should be one connection in the connections" +
                     "collection", 1, connections.size());

    }
View Full Code Here

    private void addSomeConnections(JDBCRepositoryImpl repository,
                                    int noOfConnections)
            throws RepositoryException {
       
        for(int i=0; i<noOfConnections; i++) {
            JDBCRepositoryConnection connection = (JDBCRepositoryConnection)
                    repository.openConnection();
            connection.getConnection();
        }
    }
View Full Code Here

            repository = (InternalJDBCRepository)
                    JDBCRepository.createRepository(properties)
                    .getLocalRepository();
            connection = repository.connect();

            JDBCRepositoryConnection jdbcConnection =
                    (JDBCRepositoryConnection) connection;

            conn = jdbcConnection.getConnection();

            createTables(conn);
        } catch (SQLException e) {
            handleException(e);
        } catch (RepositoryException e) {
View Full Code Here

                HypersonicManager.IN_MEMORY_SOURCE);
        hypersonicMgr.useCleanupWith(new Executor() {
            public void execute() throws Exception {
                InternalJDBCRepository repository = createRepository(
                        hypersonicMgr.getSource(), null, "#dp");
                JDBCRepositoryConnection connection =
                        (JDBCRepositoryConnection) repository.connect();
                JDBCDeviceRepositoryAccessor accessor =
                        new JDBCDeviceRepositoryAccessor(repository, location);

                Connection conn = connection.getConnection();
                createTables(conn);

                DefaultPolicyDescriptor descriptor =
                        new DefaultPolicyDescriptor();
                descriptor.setCategory("category");
                PolicyType type = new DefaultBooleanPolicyType();
                descriptor.setPolicyType(type);

                accessor.addPolicyDescriptor(connection, "boolean", descriptor);

                // Check the database contents
                checkPolicyTypeRow(conn, null, "boolean", 0, 0);
                checkTypesRow(conn, null, 0, 0);
                checkCategoryRow(conn, null, 0, "category");

                connection.disconnect();
                repository.terminate();
            }
        });
    }
View Full Code Here

        hypersonicMgr.useCleanupWith(new Executor() {
            public void execute() throws Exception {

                InternalJDBCRepository repository = createRepository(
                        hypersonicMgr.getSource(), null, "#dp");
                JDBCRepositoryConnection connection =
                        (JDBCRepositoryConnection) repository.connect();
                JDBCDeviceRepositoryAccessor accessor =
                        new JDBCDeviceRepositoryAccessor(repository, location);

                Connection conn = connection.getConnection();
                createTables(conn);

                DefaultPolicyDescriptor descriptor =
                        new DefaultPolicyDescriptor();
                descriptor.setCategory("category");
                descriptor.setPolicyType(new DefaultBooleanPolicyType());
                accessor.addPolicyDescriptor(connection, "boolean", descriptor);
                accessor.removePolicyDescriptor(connection, "boolean");

                // Check the database contents are empty
                checkAllEmpty(conn);

                connection.disconnect();
                repository.terminate();
            }
        });
    }
View Full Code Here

        hypersonicMgr.useCleanupWith(new Executor() {
            public void execute() throws Exception {

                InternalJDBCRepository repository = createRepository(
                        hypersonicMgr.getSource(), null, "#dp");
                JDBCRepositoryConnection connection =
                        (JDBCRepositoryConnection) repository.connect();
                JDBCDeviceRepositoryAccessor accessor =
                        new JDBCDeviceRepositoryAccessor(repository, location);

                Connection conn = connection.getConnection();
                createTables(conn);

                DefaultPolicyDescriptor descriptor =
                        new DefaultPolicyDescriptor();
                descriptor.setCategory("category");
                DefaultSelectionPolicyType type =
                        new DefaultSelectionPolicyType();
                type.addKeyword("k1");
                type.addKeyword("k2");
                type.complete();
                descriptor.setPolicyType(type);
                accessor.addPolicyDescriptor(connection, "selection", descriptor);

                // Check the database contents
                checkPolicyTypeRow(conn, null, "selection", 0, 0);
                checkTypesRow(conn, null, 0, 4);
                checkCategoryRow(conn, null, 0, "category");
                checkTypesSelectionRow(conn, "KEYWORD='k1'", 0, "k1");
                checkTypesSelectionRow(conn, "KEYWORD='k2'", 0, "k2");

                connection.disconnect();
                repository.terminate();
            }
        });
    }
View Full Code Here

        hypersonicMgr.useCleanupWith(new Executor() {
            public void execute() throws Exception {

                InternalJDBCRepository repository = createRepository(
                        hypersonicMgr.getSource(), null, "#dp");
                JDBCRepositoryConnection connection =
                        (JDBCRepositoryConnection) repository.connect();
                JDBCDeviceRepositoryAccessor accessor =
                        new JDBCDeviceRepositoryAccessor(repository, location);

                Connection conn = connection.getConnection();
                createTables(conn);

                DefaultPolicyDescriptor descriptor =
                        new DefaultPolicyDescriptor();
                descriptor.setCategory("category");
                DefaultSelectionPolicyType selection =
                        new DefaultSelectionPolicyType();
                selection.addKeyword("k1");
                selection.addKeyword("k2");
                selection.complete();
                descriptor.setPolicyType(selection);
                accessor.addPolicyDescriptor(connection, "selection",
                        descriptor);
                accessor.removePolicyDescriptor(connection, "selection");

                // Check the database contents are empty
                checkAllEmpty(conn);

                connection.disconnect();
                repository.terminate();
            }
        });
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.repository.jdbc.JDBCRepositoryConnection

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.