Search in sources :

Example 1 with OracleHelper

use of org.eclipse.persistence.tools.dbws.oracle.OracleHelper in project eclipselink by eclipse-ee4j.

the class TableTypeTestSuite method setUp.

@BeforeClass
public static void setUp() throws WSDLException, SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
    if (conn == null) {
        try {
            conn = buildConnection();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    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_TABLETYPE_TABLE, ddlDebug);
        runDdl(conn, CREATE_TABLETYPE2_TABLE, ddlDebug);
        try {
            Statement stmt = conn.createStatement();
            for (int i = 0; i < POPULATE_TABLETYPE_TABLE.length; i++) {
                stmt.addBatch(POPULATE_TABLETYPE_TABLE[i]);
            }
            stmt.executeBatch();
            stmt = conn.createStatement();
            for (int i = 0; i < POPULATE_TABLETYPE2_TABLE.length; i++) {
                stmt.addBatch(POPULATE_TABLETYPE2_TABLE[i]);
            }
            stmt.executeBatch();
        } catch (SQLException e) {
        // e.printStackTrace();
        }
    }
    DBWS_BUILDER_XML_USERNAME = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<dbws-builder xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + "<properties>" + "<property name=\"projectName\">tabletype</property>" + "<property name=\"logLevel\">off</property>" + "<property name=\"username\">";
    DBWS_BUILDER_XML_PASSWORD = "</property><property name=\"password\">";
    DBWS_BUILDER_XML_URL = "</property><property name=\"url\">";
    DBWS_BUILDER_XML_DRIVER = "</property><property name=\"driver\">";
    DBWS_BUILDER_XML_PLATFORM = "</property><property name=\"platformClassname\">";
    DBWS_BUILDER_XML_MAIN = "</property>" + "</properties>" + "<table " + "schemaPattern=\"%\" " + "tableNamePattern=\"TABLETYPE\" " + "/>" + "<table " + "schemaPattern=\"%\" " + "tableNamePattern=\"TABLETYPE2\" " + "/>" + "</dbws-builder>";
    builder = new DBWSBuilder();
    OracleHelper builderHelper = new OracleHelper(builder);
    builder.setBuilderHelper(builderHelper);
    Field workbenchProj_field = BaseDBWSBuilderHelper.class.getDeclaredField("workbenchXMLProject");
    workbenchProj_field.setAccessible(true);
    ObjectPersistenceWorkbenchXMLProject workbenchXMLProject = (ObjectPersistenceWorkbenchXMLProject) workbenchProj_field.get(builderHelper);
    XMLTransformationMapping versionMapping = (XMLTransformationMapping) workbenchXMLProject.getDescriptor(Project.class).getMappings().get(0);
    TransformerBasedFieldTransformation versionTransformer = (TransformerBasedFieldTransformation) versionMapping.getFieldTransformations().get(0);
    Field transformerField = TransformerBasedFieldTransformation.class.getDeclaredField("transformer");
    transformerField.setAccessible(true);
    ConstantTransformer constantTransformer = (ConstantTransformer) transformerField.get(versionTransformer);
    constantTransformer.setValue("Eclipse Persistence Services - " + releaseVersion);
    DBWSTestSuite.setUp(".");
}
Also used : TransformerBasedFieldTransformation(org.eclipse.persistence.internal.descriptors.TransformerBasedFieldTransformation) SQLException(java.sql.SQLException) Statement(java.sql.Statement) XMLTransformationMapping(org.eclipse.persistence.oxm.mappings.XMLTransformationMapping) OracleHelper(org.eclipse.persistence.tools.dbws.oracle.OracleHelper) ConstantTransformer(org.eclipse.persistence.mappings.transformers.ConstantTransformer) SQLException(java.sql.SQLException) WSDLException(javax.wsdl.WSDLException) DBWSBuilder(org.eclipse.persistence.tools.dbws.DBWSBuilder) Field(java.lang.reflect.Field) DatabaseField(org.eclipse.persistence.internal.helper.DatabaseField) ObjectPersistenceWorkbenchXMLProject(org.eclipse.persistence.internal.sessions.factories.ObjectPersistenceWorkbenchXMLProject) Project(org.eclipse.persistence.sessions.Project) ObjectPersistenceWorkbenchXMLProject(org.eclipse.persistence.internal.sessions.factories.ObjectPersistenceWorkbenchXMLProject) BeforeClass(org.junit.BeforeClass)

Example 2 with OracleHelper

use of org.eclipse.persistence.tools.dbws.oracle.OracleHelper in project eclipselink by eclipse-ee4j.

the class SimpleNestedTableTestSuite method setUp.

@BeforeClass
public static void setUp() throws WSDLException {
    if (conn == null) {
        try {
            conn = buildConnection();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    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_NUMBER_TABLE, ddlDebug);
        runDdl(conn, CREATE_NUMBER_WRAPPER, ddlDebug);
        runDdl(conn, CREATE_TEST_NUMBER_PACKAGE, ddlDebug);
        runDdl(conn, CREATE_TEST_NUMBER_PACKAGE_BODY, ddlDebug);
        runDdl(conn, CREATE_USERS_TABLE, ddlDebug);
        runDdl(conn, CREATE_USERS_ID_LIST_TYPE, ddlDebug);
        runDdl(conn, CREATE_USERS_PKG, ddlDebug);
        runDdl(conn, CREATE_USERS_BODY, ddlDebug);
        try {
            Statement stmt = conn.createStatement();
            for (int i = 0; i < POPULATE_TABLE.length; i++) {
                stmt.addBatch(POPULATE_TABLE[i]);
            }
            stmt.executeBatch();
        } catch (SQLException e) {
        // e.printStackTrace();
        }
    }
    DBWS_BUILDER_XML_USERNAME = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<dbws-builder xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + "<properties>" + "<property name=\"projectName\">SimpleNestedTableTest</property>" + "<property name=\"logLevel\">off</property>" + "<property name=\"username\">";
    DBWS_BUILDER_XML_PASSWORD = "</property><property name=\"password\">";
    DBWS_BUILDER_XML_URL = "</property><property name=\"url\">";
    DBWS_BUILDER_XML_DRIVER = "</property><property name=\"driver\">";
    DBWS_BUILDER_XML_PLATFORM = "</property><property name=\"platformClassname\">";
    DBWS_BUILDER_XML_MAIN = "</property>" + "</properties>" + "<plsql-procedure " + "name=\"GetUsersTest\" " + "catalogPattern=\"USERS_PKG\" " + "procedurePattern=\"GET_USERS_NAME_TEST\" " + "/>" + "<plsql-procedure " + "name=\"NumberTableTest\" " + "catalogPattern=\"TEST_NUMBER_LIST_PKG\" " + "procedurePattern=\"TEST_NUM\" " + // "returnType=\"wrapper_numtabType\" " +
    "/>" + "</dbws-builder>";
    builder = new DBWSBuilder();
    OracleHelper builderHelper = new OracleHelper(builder);
    builder.setBuilderHelper(builderHelper);
    DBWSTestSuite.setUp(".");
}
Also used : SQLException(java.sql.SQLException) Statement(java.sql.Statement) OracleHelper(org.eclipse.persistence.tools.dbws.oracle.OracleHelper) WSDLException(javax.wsdl.WSDLException) SQLException(java.sql.SQLException) DBWSBuilder(org.eclipse.persistence.tools.dbws.DBWSBuilder) BeforeClass(org.junit.BeforeClass)

Example 3 with OracleHelper

use of org.eclipse.persistence.tools.dbws.oracle.OracleHelper in project eclipselink by eclipse-ee4j.

the class SimplePLSQLSFTestSuite method setUp.

@BeforeClass
public static void setUp() throws WSDLException {
    if (conn == null) {
        try {
            conn = buildConnection();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    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_OBJECT_TYPE, ddlDebug);
        runDdl(conn, CREATE_SIMPLESF_TABLE, ddlDebug);
        runDdl(conn, CREATE_SIMPLEPACKAGE2_PACKAGE, ddlDebug);
        runDdl(conn, CREATE_SIMPLEPACKAGE2_BODY, ddlDebug);
        try {
            Statement stmt = conn.createStatement();
            for (int i = 0; i < POPULATE_SIMPLESF_TABLE.length; i++) {
                stmt.addBatch(POPULATE_SIMPLESF_TABLE[i]);
            }
            stmt.executeBatch();
        } catch (SQLException e) {
        // e.printStackTrace();
        }
    }
    DBWS_BUILDER_XML_USERNAME = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<dbws-builder xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + "<properties>" + "<property name=\"projectName\">simplePLSQLSF</property>" + "<property name=\"logLevel\">off</property>" + "<property name=\"username\">";
    DBWS_BUILDER_XML_PASSWORD = "</property><property name=\"password\">";
    DBWS_BUILDER_XML_URL = "</property><property name=\"url\">";
    DBWS_BUILDER_XML_DRIVER = "</property><property name=\"driver\">";
    DBWS_BUILDER_XML_PLATFORM = "</property><property name=\"platformClassname\">";
    DBWS_BUILDER_XML_MAIN = "</property>" + "</properties>" + "<plsql-procedure " + "name=\"FindMaxSalTest\" " + "catalogPattern=\"SIMPLEPACKAGE2\" " + "procedurePattern=\"FINDPLSQLMAXSAL\" " + "isCollection=\"false\" " + "isSimpleXMLFormat=\"true\" " + "/>" + "<plsql-procedure " + "name=\"FindMaxSalForDeptTest\" " + "catalogPattern=\"SIMPLEPACKAGE2\" " + "procedurePattern=\"FINDPLSQLMAXSALFOR%\" " + "isCollection=\"false\" " + "isSimpleXMLFormat=\"true\" " + "simpleXMLFormatTag=\"max-sal-for-dept\" " + "/>" + "<plsql-procedure " + "name=\"TestMultipleOut\" " + "catalogPattern=\"SIMPLEPACKAGE2\" " + "procedurePattern=\"TEST_MULTI_OUT\" " + "/>" + "<plsql-procedure " + "name=\"XMLTypeTest\" " + "catalogPattern=\"SIMPLEPACKAGE2\" " + "procedurePattern=\"GET_XMLTYPE\" " + "isSimpleXMLFormat=\"true\" " + "/>" + "</dbws-builder>";
    builder = new DBWSBuilder();
    OracleHelper builderHelper = new OracleHelper(builder);
    builder.setBuilderHelper(builderHelper);
    DBWSTestSuite.setUp(".");
}
Also used : SQLException(java.sql.SQLException) Statement(java.sql.Statement) OracleHelper(org.eclipse.persistence.tools.dbws.oracle.OracleHelper) WSDLException(javax.wsdl.WSDLException) SQLException(java.sql.SQLException) DBWSBuilder(org.eclipse.persistence.tools.dbws.DBWSBuilder) BeforeClass(org.junit.BeforeClass)

Example 4 with OracleHelper

use of org.eclipse.persistence.tools.dbws.oracle.OracleHelper in project eclipselink by eclipse-ee4j.

the class SimpleSFTestSuite method setUp.

@BeforeClass
public static void setUp() throws WSDLException {
    if (conn == null) {
        try {
            conn = buildConnection();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    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_SIMPLESF_TABLE, ddlDebug);
        runDdl(conn, CREATE_FINDMAXSAL_FUNC, ddlDebug);
        runDdl(conn, CREATE_FINDMAXSALFORDEPT_FUNC, ddlDebug);
        runDdl(conn, CREATE_GET_XMLTYPE_FUNC, ddlDebug);
        try {
            Statement stmt = conn.createStatement();
            for (int i = 0; i < POPULATE_SIMPLESF_TABLE.length; i++) {
                stmt.addBatch(POPULATE_SIMPLESF_TABLE[i]);
            }
            stmt.executeBatch();
        } catch (SQLException e) {
        // e.printStackTrace();
        }
    }
    DBWS_BUILDER_XML_USERNAME = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<dbws-builder xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + "<properties>" + "<property name=\"projectName\">simpleSF</property>" + "<property name=\"logLevel\">off</property>" + "<property name=\"username\">";
    DBWS_BUILDER_XML_PASSWORD = "</property><property name=\"password\">";
    DBWS_BUILDER_XML_URL = "</property><property name=\"url\">";
    DBWS_BUILDER_XML_DRIVER = "</property><property name=\"driver\">";
    DBWS_BUILDER_XML_PLATFORM = "</property><property name=\"platformClassname\">";
    DBWS_BUILDER_XML_MAIN = "</property>" + "</properties>" + "<procedure " + "name=\"FindMaxSalTest\" " + "procedurePattern=\"FINDMAXSAL\" " + "isCollection=\"false\" " + "isSimpleXMLFormat=\"true\" " + "/>" + "<procedure " + "name=\"FindMaxSalForDeptTest\" " + "procedurePattern=\"FINDMAXSALFORDEPT\" " + "isCollection=\"false\" " + "isSimpleXMLFormat=\"true\" " + "simpleXMLFormatTag=\"max-sal-for-dept\" " + "/>" + "<procedure " + "name=\"getXMLTypeData\" " + "procedurePattern=\"GET_XMLTYPE\" " + "isCollection=\"false\" " + "isSimpleXMLFormat=\"true\" " + "/>" + "</dbws-builder>";
    builder = new DBWSBuilder();
    OracleHelper builderHelper = new OracleHelper(builder);
    builder.setBuilderHelper(builderHelper);
    DBWSTestSuite.setUp(".");
}
Also used : SQLException(java.sql.SQLException) Statement(java.sql.Statement) OracleHelper(org.eclipse.persistence.tools.dbws.oracle.OracleHelper) WSDLException(javax.wsdl.WSDLException) SQLException(java.sql.SQLException) ParseException(java.text.ParseException) DBWSBuilder(org.eclipse.persistence.tools.dbws.DBWSBuilder) BeforeClass(org.junit.BeforeClass)

Aggregations

SQLException (java.sql.SQLException)4 Statement (java.sql.Statement)4 WSDLException (javax.wsdl.WSDLException)4 DBWSBuilder (org.eclipse.persistence.tools.dbws.DBWSBuilder)4 OracleHelper (org.eclipse.persistence.tools.dbws.oracle.OracleHelper)4 BeforeClass (org.junit.BeforeClass)4 Field (java.lang.reflect.Field)1 ParseException (java.text.ParseException)1 TransformerBasedFieldTransformation (org.eclipse.persistence.internal.descriptors.TransformerBasedFieldTransformation)1 DatabaseField (org.eclipse.persistence.internal.helper.DatabaseField)1 ObjectPersistenceWorkbenchXMLProject (org.eclipse.persistence.internal.sessions.factories.ObjectPersistenceWorkbenchXMLProject)1 ConstantTransformer (org.eclipse.persistence.mappings.transformers.ConstantTransformer)1 XMLTransformationMapping (org.eclipse.persistence.oxm.mappings.XMLTransformationMapping)1 Project (org.eclipse.persistence.sessions.Project)1