Search in sources :

Example 6 with DatabaseTypeBuilder

use of org.eclipse.persistence.tools.oracleddl.util.DatabaseTypeBuilder in project eclipselink by eclipse-ee4j.

the class ShadowDDLGenerationTestSuite method setUp.

@BeforeClass
public static void setUp() throws ParseException, ClassNotFoundException, SQLException {
    username = System.getProperty(DATABASE_USERNAME_KEY, DEFAULT_DATABASE_USERNAME);
    conn = buildConnection();
    String ddlCreateProp = System.getProperty(DATABASE_DDL_CREATE_KEY, DEFAULT_DATABASE_DDL_CREATE);
    if ("true".equalsIgnoreCase(ddlCreateProp)) {
        ddlCreate = true;
    }
    String ddlDropProp = System.getProperty(DATABASE_DDL_DROP_KEY, DEFAULT_DATABASE_DDL_DROP);
    if ("true".equalsIgnoreCase(ddlDropProp)) {
        ddlDrop = true;
    }
    String ddlDebugProp = System.getProperty(DATABASE_DDL_DEBUG_KEY, DEFAULT_DATABASE_DDL_DEBUG);
    if ("true".equalsIgnoreCase(ddlDebugProp)) {
        ddlDebug = true;
    }
    if (ddlCreate) {
        runDdl(conn, CREATE_SHADOWDDLTEST_PACKAGE, ddlDebug);
        runDdl(conn, CREATE_SHADOWDDLTEST_PACKAGE_BODY, ddlDebug);
    }
    shadowDDLTestPackage = new DatabaseTypeBuilder().buildPackages(conn, username, SHADOWDDLTEST_PACKAGE).get(0);
}
Also used : DatabaseTypeBuilder(org.eclipse.persistence.tools.oracleddl.util.DatabaseTypeBuilder) BeforeClass(org.junit.BeforeClass)

Example 7 with DatabaseTypeBuilder

use of org.eclipse.persistence.tools.oracleddl.util.DatabaseTypeBuilder in project eclipselink by eclipse-ee4j.

the class FunctionTypeTestSuite method setUp.

@BeforeClass
public static void setUp() throws ClassNotFoundException, SQLException {
    AllTests.setUp();
    String ddlCreateProp = System.getProperty(DATABASE_DDL_CREATE_KEY, DEFAULT_DATABASE_DDL_CREATE);
    if ("true".equalsIgnoreCase(ddlCreateProp)) {
        ddlCreate = true;
    }
    String ddlDropProp = System.getProperty(DATABASE_DDL_DROP_KEY, DEFAULT_DATABASE_DDL_DROP);
    if ("true".equalsIgnoreCase(ddlDropProp)) {
        ddlDrop = true;
    }
    String ddlDebugProp = System.getProperty(DATABASE_DDL_DEBUG_KEY, DEFAULT_DATABASE_DDL_DEBUG);
    if ("true".equalsIgnoreCase(ddlDebugProp)) {
        ddlDebug = true;
    }
    if (ddlCreate) {
        runDdl(conn, CREATE_FINDMAXSALFORDEPT_FUNC, ddlDebug);
    }
    // use DatabaseTypeBuilder to generate a list of ProcedureTypes
    dbTypeBuilder = new DatabaseTypeBuilder();
    try {
        dbProcedures = dbTypeBuilder.buildFunctions(conn, "TOPLEVEL", "FINDMAXSALFORDEPT");
    } catch (ParseException e) {
        e.printStackTrace();
    }
}
Also used : DatabaseTypeBuilder(org.eclipse.persistence.tools.oracleddl.util.DatabaseTypeBuilder) AllTests.documentToString(org.eclipse.persistence.tools.metadata.generation.test.AllTests.documentToString) ParseException(org.eclipse.persistence.tools.oracleddl.parser.ParseException) BeforeClass(org.junit.BeforeClass)

Example 8 with DatabaseTypeBuilder

use of org.eclipse.persistence.tools.oracleddl.util.DatabaseTypeBuilder in project eclipselink by eclipse-ee4j.

the class ObjectTableTypeTestSuite method setUp.

@BeforeClass
public static void setUp() throws ClassNotFoundException, SQLException {
    AllTests.setUp();
    String ddlCreateProp = System.getProperty(DATABASE_DDL_CREATE_KEY, DEFAULT_DATABASE_DDL_CREATE);
    if ("true".equalsIgnoreCase(ddlCreateProp)) {
        ddlCreate = true;
    }
    String ddlDropProp = System.getProperty(DATABASE_DDL_DROP_KEY, DEFAULT_DATABASE_DDL_DROP);
    if ("true".equalsIgnoreCase(ddlDropProp)) {
        ddlDrop = true;
    }
    String ddlDebugProp = System.getProperty(DATABASE_DDL_DEBUG_KEY, DEFAULT_DATABASE_DDL_DEBUG);
    if ("true".equalsIgnoreCase(ddlDebugProp)) {
        ddlDebug = true;
    }
    if (ddlCreate) {
        runDdl(conn, CREATE_PHONE_TYPE, ddlDebug);
        runDdl(conn, CREATE_PHONE_TYPE_TABLE, ddlDebug);
        runDdl(conn, CREATE_GET_PHONETYPE_TABLE_PROC, ddlDebug);
    }
    // use DatabaseTypeBuilder to generate a list of ProcedureTypes
    dbTypeBuilder = new DatabaseTypeBuilder();
    try {
        dbProcedures = dbTypeBuilder.buildProcedures(conn, "TOPLEVEL", "GET_PHONETYPE_TABLE");
    } catch (ParseException e) {
        e.printStackTrace();
    }
}
Also used : DatabaseTypeBuilder(org.eclipse.persistence.tools.oracleddl.util.DatabaseTypeBuilder) AllTests.documentToString(org.eclipse.persistence.tools.metadata.generation.test.AllTests.documentToString) ParseException(org.eclipse.persistence.tools.oracleddl.parser.ParseException) BeforeClass(org.junit.BeforeClass)

Example 9 with DatabaseTypeBuilder

use of org.eclipse.persistence.tools.oracleddl.util.DatabaseTypeBuilder in project eclipselink by eclipse-ee4j.

the class ObjectTypeTestSuite method setUp.

@BeforeClass
public static void setUp() throws ClassNotFoundException, SQLException {
    AllTests.setUp();
    String ddlCreateProp = System.getProperty(DATABASE_DDL_CREATE_KEY, DEFAULT_DATABASE_DDL_CREATE);
    if ("true".equalsIgnoreCase(ddlCreateProp)) {
        ddlCreate = true;
    }
    String ddlDropProp = System.getProperty(DATABASE_DDL_DROP_KEY, DEFAULT_DATABASE_DDL_DROP);
    if ("true".equalsIgnoreCase(ddlDropProp)) {
        ddlDrop = true;
    }
    String ddlDebugProp = System.getProperty(DATABASE_DDL_DEBUG_KEY, DEFAULT_DATABASE_DDL_DEBUG);
    if ("true".equalsIgnoreCase(ddlDebugProp)) {
        ddlDebug = true;
    }
    if (ddlCreate) {
        runDdl(conn, CREATE_PHONE_TYPE, ddlDebug);
        runDdl(conn, CREATE_A_CONTACT_TYPE, ddlDebug);
        runDdl(conn, CREATE_PHONE_TYPE_PROC, ddlDebug);
        runDdl(conn, CREATE_CONTACT_TYPE_PROC, ddlDebug);
    }
    ArrayList<String> schemas = new ArrayList<String>();
    ArrayList<String> procedures = new ArrayList<String>();
    schemas.add("TOPLEVEL");
    procedures.add("CREATE_PHONE_TYPE");
    schemas.add("TOPLEVEL");
    procedures.add("CREATE_CONTACT_TYPE");
    // use DatabaseTypeBuilder to generate a list of ProcedureTypes
    dbTypeBuilder = new DatabaseTypeBuilder();
    try {
        dbProcedures = dbTypeBuilder.buildProcedures(conn, schemas, procedures);
    } catch (ParseException e) {
        e.printStackTrace();
    }
}
Also used : DatabaseTypeBuilder(org.eclipse.persistence.tools.oracleddl.util.DatabaseTypeBuilder) ArrayList(java.util.ArrayList) AllTests.documentToString(org.eclipse.persistence.tools.metadata.generation.test.AllTests.documentToString) ParseException(org.eclipse.persistence.tools.oracleddl.parser.ParseException) BeforeClass(org.junit.BeforeClass)

Example 10 with DatabaseTypeBuilder

use of org.eclipse.persistence.tools.oracleddl.util.DatabaseTypeBuilder in project eclipselink by eclipse-ee4j.

the class PLSQLRecordTypeTestSuite method setUp.

@SuppressWarnings({ "rawtypes", "unchecked" })
@BeforeClass
public static void setUp() throws ClassNotFoundException, SQLException {
    AllTests.setUp();
    String ddlCreateProp = System.getProperty(DATABASE_DDL_CREATE_KEY, DEFAULT_DATABASE_DDL_CREATE);
    if ("true".equalsIgnoreCase(ddlCreateProp)) {
        ddlCreate = true;
    }
    String ddlDropProp = System.getProperty(DATABASE_DDL_DROP_KEY, DEFAULT_DATABASE_DDL_DROP);
    if ("true".equalsIgnoreCase(ddlDropProp)) {
        ddlDrop = true;
    }
    String ddlDebugProp = System.getProperty(DATABASE_DDL_DEBUG_KEY, DEFAULT_DATABASE_DDL_DEBUG);
    if ("true".equalsIgnoreCase(ddlDebugProp)) {
        ddlDebug = true;
    }
    if (ddlCreate) {
        runDdl(conn, CREATE_A_PHONE_TYPE, ddlDebug);
        runDdl(conn, CREATE_A_PHONE_TYPE_TABLE, ddlDebug);
        runDdl(conn, CREATE_A_PHONE_TYPE_VARRAY, ddlDebug);
        runDdl(conn, CREATE_A_CONTACT_TYPE, ddlDebug);
        runDdl(conn, CREATE_PACKAGE2_PACKAGE, ddlDebug);
        runDdl(conn, CREATE_PACKAGE2_EMPREC_TYPE, ddlDebug);
    }
    String schema = System.getProperty(DATABASE_USERNAME_KEY, DEFAULT_DATABASE_USERNAME);
    List<String> procedurePatterns = new ArrayList<String>();
    procedurePatterns.add("COPYRECORD");
    procedurePatterns.add("COPYRECORD_FUNC");
    procedurePatterns.add("COPYCOMPLEXRECORD");
    procedurePatterns.add("COPYCOMPLEXRECORD_FUNC");
    procedurePatterns.add("COPYMORECOMPLEXRECORD_FUNC");
    procedurePatterns.add("COPYSUPERCOMPLEXRECORD");
    // use DatabaseTypeBuilder to generate a list of PackageTypes
    dbTypeBuilder = new DatabaseTypeBuilder();
    dbProcedures = new ArrayList();
    try {
        // process the package
        List<PLSQLPackageType> packages = dbTypeBuilder.buildPackages(conn, schema, "PACKAGE2");
        for (PLSQLPackageType pkgType : packages) {
            // now get the desired procedures/functions from the processed package
            for (ProcedureType procType : pkgType.getProcedures()) {
                if (procedurePatterns.contains(procType.getProcedureName())) {
                    dbProcedures.add(procType);
                }
            }
        }
    } catch (ParseException e) {
        e.printStackTrace();
    }
}
Also used : ProcedureType(org.eclipse.persistence.tools.oracleddl.metadata.ProcedureType) DatabaseTypeBuilder(org.eclipse.persistence.tools.oracleddl.util.DatabaseTypeBuilder) PLSQLPackageType(org.eclipse.persistence.tools.oracleddl.metadata.PLSQLPackageType) ArrayList(java.util.ArrayList) AllTests.documentToString(org.eclipse.persistence.tools.metadata.generation.test.AllTests.documentToString) ParseException(org.eclipse.persistence.tools.oracleddl.parser.ParseException) BeforeClass(org.junit.BeforeClass)

Aggregations

DatabaseTypeBuilder (org.eclipse.persistence.tools.oracleddl.util.DatabaseTypeBuilder)13 BeforeClass (org.junit.BeforeClass)13 AllTests.documentToString (org.eclipse.persistence.tools.metadata.generation.test.AllTests.documentToString)12 ParseException (org.eclipse.persistence.tools.oracleddl.parser.ParseException)12 ArrayList (java.util.ArrayList)7 PLSQLPackageType (org.eclipse.persistence.tools.oracleddl.metadata.PLSQLPackageType)6 ProcedureType (org.eclipse.persistence.tools.oracleddl.metadata.ProcedureType)6 TableType (org.eclipse.persistence.tools.oracleddl.metadata.TableType)1