Package atg.tools.dynunit.test.util

Examples of atg.tools.dynunit.test.util.DBUtils


        // Use the DBUtils utility class to get JDBC properties for an in memory
        // HSQL DB called "testdb".
        Properties props = DBUtils.getHSQLDBInMemoryDBConnection("testdb");

        // Start up our database
        DBUtils db = initDB(props);

        boolean rollback = true;

        // Setup our testing configpath
        // RH: disabled logging (last argument to false) to get rid of the double
        // logging statements
        GSATestUtils.getGSATestUtils().initializeMinimalConfigpath(
                configpath, "/SimpleRepository", definitionFiles, props, null, null, null, false
        );

        // Start Nucleus
        Nucleus n = startNucleus(configpath);

        TransactionDemarcation td = new TransactionDemarcation();
        MutableRepository r = (MutableRepository) n.resolveName("/SimpleRepository");

        try {
            // Start a new transaction
            td.begin(((GSARepository) r).getTransactionManager());
            // Create the item
            MutableRepositoryItem item = r.createItem("simpleItem");
            item.setPropertyValue("name", "simpleName");
            // Persist to the repository
            r.addItem(item);
            // Try to get it back from the repository
            String id = item.getRepositoryId();
            RepositoryItem item2 = r.getItem(id, "simpleItem");
            assertNotNull(
                    " We did not get back the item just created from the repository.", item2
            );
            rollback = false;
        } finally {
            // End the transaction, rollback on error
            td.end(rollback);
            // shut down Nucleus
            n.stopService();
            // Shut down HSQLDB
            db.shutdown();
        }
    }
View Full Code Here


     * @throws Exception
     * @throws SQLException
     */
    protected DBUtils initDB(Properties props)
            throws Exception {
        return new DBUtils(
                props.getProperty("URL"),
                props.getProperty("driver"),
                props.getProperty("user"),
                props.getProperty("password")
        );
View Full Code Here

        }
        createGlobal(pRoot);
        createScreenLog(pRoot, pLogging);
        createIdSpaces(pRoot);
        if (pJDBCProperties != null) {
            createIDGeneratorTables(new DBUtils(pJDBCProperties));
        }
        else {
            createIDGeneratorTables(new DBUtils(DBUtils.getHSQLDBInMemoryDBConnection()));
        }
        createSQLRepositoryEventServer(pRoot);
        createNucleus(pRoot);

    }
View Full Code Here

TOP

Related Classes of atg.tools.dynunit.test.util.DBUtils

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.