Package com.volantis.mcs.repository.jdbc

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


        final HypersonicManager hypersonicMgr = new HypersonicManager(
                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");
                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


        final HypersonicManager hypersonicMgr = new HypersonicManager(
                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");
                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

        final HypersonicManager hypersonicMgr = new HypersonicManager(
                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");
                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

        final HypersonicManager hypersonicMgr = new HypersonicManager(
                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 DefaultRangePolicyType(1, 100);
                descriptor.setPolicyType(type);
                accessor.addPolicyDescriptor(connection, "range", descriptor);

                // Check the database contents
                checkPolicyTypeRow(conn, null, "range", 0, 0);
                checkTypesRow(conn, null, 0, 3);
                checkCategoryRow(conn, null, 0, "category");
                checkTypesRangeRow(conn, null, 0, 1, 100);

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

        final HypersonicManager hypersonicMgr = new HypersonicManager(
                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");
                descriptor.setPolicyType(new DefaultRangePolicyType(3, 4));
                accessor.addPolicyDescriptor(connection, "range", descriptor);
                accessor.removePolicyDescriptor(connection, "range");

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

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

        final HypersonicManager hypersonicMgr = new HypersonicManager(
                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");
                DefaultStructurePolicyType type =
                        new DefaultStructurePolicyType();
                type.addFieldType("f1", new DefaultBooleanPolicyType());
                type.addFieldType("f2", new DefaultRangePolicyType(2, 99));
                type.complete();
                descriptor.setPolicyType(type);
                accessor.addPolicyDescriptor(connection, "structure", descriptor);

                // Check the database contents
                checkCategoryRow(conn, null, 0, "category");
                checkPolicyTypeRow(conn, null, "structure", 0, 0);
                checkTypesRow(conn, "TYPE_INSTANCE_ID=0", 0, 7);
                // structure row and dependent boolean type
                checkTypesStructureRow(conn, "FIELDNAME='f1'", 0, "f1", 1);
                checkTypesRow(conn, "TYPE_INSTANCE_ID=1", 1, 0);
                // structure row and dependent range type
                checkTypesStructureRow(conn, "FIELDNAME='f2'", 0, "f2", 2);
                checkTypesRow(conn, "TYPE_INSTANCE_ID=2", 2, 3);
                checkTypesRangeRow(conn, null, 2, 2, 99);

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

        final HypersonicManager hypersonicMgr = new HypersonicManager(
                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");
                DefaultStructurePolicyType structure =
                        new DefaultStructurePolicyType();
                structure.addFieldType("f1", new DefaultBooleanPolicyType());
                structure.addFieldType("f2", new DefaultIntPolicyType());
                structure.complete();
                descriptor.setPolicyType(structure);
                accessor.addPolicyDescriptor(connection, "structure", descriptor);
                accessor.removePolicyDescriptor(connection, "structure");

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

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

        final HypersonicManager hypersonicMgr = new HypersonicManager(
                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");
                DefaultOrderedSetPolicyType type =
                        new DefaultOrderedSetPolicyType(
                                new DefaultBooleanPolicyType());
                descriptor.setPolicyType(type);
                accessor.addPolicyDescriptor(connection, "oset", descriptor);

                // Check the database contents
                checkCategoryRow(conn, null, 0, "category");
                checkPolicyTypeRow(conn, null, "oset", 0, 0);
                checkTypesRow(conn, "TYPE_INSTANCE_ID=0", 0, 5);
                // set row and dependent boolean type
                checkTypesSetRow(conn, null, 0, 1, true);
                checkTypesRow(conn, "TYPE_INSTANCE_ID=1", 1, 0);

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

        final HypersonicManager hypersonicMgr = new HypersonicManager(
                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");
                DefaultOrderedSetPolicyType type =
                        new DefaultOrderedSetPolicyType(
                                new DefaultBooleanPolicyType());
                descriptor.setPolicyType(type);
                accessor.addPolicyDescriptor(connection, "oset", descriptor);
                accessor.removePolicyDescriptor(connection, "oset");

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

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

        final HypersonicManager hypersonicMgr = new HypersonicManager(
                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");
                DefaultUnorderedSetPolicyType type =
                        new DefaultUnorderedSetPolicyType(
                                new DefaultBooleanPolicyType());
                descriptor.setPolicyType(type);
                accessor.addPolicyDescriptor(connection, "uset", descriptor);

                // Check the database contents
                checkCategoryRow(conn, null, 0, "category");
                checkPolicyTypeRow(conn, null, "uset", 0, 0);
                checkTypesRow(conn, "TYPE_INSTANCE_ID=0", 0, 6);
                // set row and dependent boolean type
                checkTypesSetRow(conn, null, 0, 1, true);
                checkTypesRow(conn, "TYPE_INSTANCE_ID=1", 1, 0);

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

TOP

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

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.