Search in sources :

Example 11 with PLSQLPackageType

use of org.eclipse.persistence.tools.oracleddl.metadata.PLSQLPackageType in project eclipselink by eclipse-ee4j.

the class XMLTypeTestSuite 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_DBWS_XML_WRAPPER_TYPE, ddlDebug);
        runDdl(conn, CREATE_XMLTYPETESTPKG_PACKAGE, ddlDebug);
    }
    String schema = System.getProperty(DATABASE_USERNAME_KEY, DEFAULT_DATABASE_USERNAME);
    List<String> procedurePatterns = new ArrayList<String>();
    procedurePatterns.add("GET_XMLTYPE");
    procedurePatterns.add("RETURN_XMLTYPE");
    // 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, "XMLTYPETESTPKG");
        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

PLSQLPackageType (org.eclipse.persistence.tools.oracleddl.metadata.PLSQLPackageType)11 ProcedureType (org.eclipse.persistence.tools.oracleddl.metadata.ProcedureType)10 ArrayList (java.util.ArrayList)9 ParseException (org.eclipse.persistence.tools.oracleddl.parser.ParseException)7 AllTests.documentToString (org.eclipse.persistence.tools.metadata.generation.test.AllTests.documentToString)6 DatabaseTypeBuilder (org.eclipse.persistence.tools.oracleddl.util.DatabaseTypeBuilder)6 BeforeClass (org.junit.BeforeClass)6 CompositeDatabaseType (org.eclipse.persistence.tools.oracleddl.metadata.CompositeDatabaseType)4 TableType (org.eclipse.persistence.tools.oracleddl.metadata.TableType)4 ObjectTableType (org.eclipse.persistence.tools.oracleddl.metadata.ObjectTableType)3 HashSet (java.util.HashSet)2 ArgumentType (org.eclipse.persistence.tools.oracleddl.metadata.ArgumentType)2 DatabaseType (org.eclipse.persistence.tools.oracleddl.metadata.DatabaseType)2 FieldType (org.eclipse.persistence.tools.oracleddl.metadata.FieldType)2 FunctionType (org.eclipse.persistence.tools.oracleddl.metadata.FunctionType)2 PLSQLRecordType (org.eclipse.persistence.tools.oracleddl.metadata.PLSQLRecordType)2 ROWTYPEType (org.eclipse.persistence.tools.oracleddl.metadata.ROWTYPEType)2 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1