Search in sources :

Example 21 with PLSQLStoredProcedureCall

use of org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredProcedureCall in project eclipselink by eclipse-ee4j.

the class Ni6TestSet method writeToXml.

@Test
public void writeToXml() {
    // (y in natural)
    PLSQLStoredProcedureCall call = new PLSQLStoredProcedureCall();
    call.setProcedureName("natural_in_test");
    call.addNamedArgument("Y", OraclePLSQLTypes.Natural);
    DataModifyQuery query = new DataModifyQuery();
    query.addArgument("Y", Integer.class);
    query.setCall(call);
    project.getDescriptor(Empty.class).getQueryManager().addQuery("Ni6", query);
    Project projectToXml = project.clone();
    // trim off login 'cause it changes under test - this way, a comparison
    // can be done to a control document
    projectToXml.setDatasourceLogin(null);
    XMLContext context = new XMLContext(workbenchXMLProject);
    XMLMarshaller marshaller = context.createMarshaller();
    Document doc = marshaller.objectToXML(projectToXml);
    Document controlDoc = xmlParser.parse(new StringReader(NI6_PROJECT_XML));
    assertTrue("control document not same as instance document", comparer.isNodeEqual(controlDoc, doc));
}
Also used : ObjectPersistenceWorkbenchXMLProject(org.eclipse.persistence.internal.sessions.factories.ObjectPersistenceWorkbenchXMLProject) NonJDBCTestHelper.buildTestProject(org.eclipse.persistence.testing.tests.nonJDBC.NonJDBCTestHelper.buildTestProject) NonJDBCTestHelper.buildWorkbenchXMLProject(org.eclipse.persistence.testing.tests.nonJDBC.NonJDBCTestHelper.buildWorkbenchXMLProject) Project(org.eclipse.persistence.sessions.Project) PLSQLStoredProcedureCall(org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredProcedureCall) XMLContext(org.eclipse.persistence.oxm.XMLContext) XMLMarshaller(org.eclipse.persistence.oxm.XMLMarshaller) StringReader(java.io.StringReader) Document(org.w3c.dom.Document) DataModifyQuery(org.eclipse.persistence.queries.DataModifyQuery) Test(org.junit.Test)

Example 22 with PLSQLStoredProcedureCall

use of org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredProcedureCall in project eclipselink by eclipse-ee4j.

the class Ni5TestSet method writeToXml.

@Test
public void writeToXml() {
    // (y in int)
    PLSQLStoredProcedureCall call = new PLSQLStoredProcedureCall();
    call.setProcedureName("int_in_test");
    call.addNamedArgument("Y", OraclePLSQLTypes.Int);
    DataModifyQuery query = new DataModifyQuery();
    query.addArgument("Y", Integer.class);
    query.setCall(call);
    project.getDescriptor(Empty.class).getQueryManager().addQuery("Ni5", query);
    Project projectToXml = project.clone();
    // trim off login 'cause it changes under test - this way, a comparison
    // can be done to a control document
    projectToXml.setDatasourceLogin(null);
    XMLContext context = new XMLContext(workbenchXMLProject);
    XMLMarshaller marshaller = context.createMarshaller();
    Document doc = marshaller.objectToXML(projectToXml);
    Document controlDoc = xmlParser.parse(new StringReader(NI5_PROJECT_XML));
    assertTrue("control document not same as instance document", comparer.isNodeEqual(controlDoc, doc));
}
Also used : ObjectPersistenceWorkbenchXMLProject(org.eclipse.persistence.internal.sessions.factories.ObjectPersistenceWorkbenchXMLProject) NonJDBCTestHelper.buildTestProject(org.eclipse.persistence.testing.tests.nonJDBC.NonJDBCTestHelper.buildTestProject) NonJDBCTestHelper.buildWorkbenchXMLProject(org.eclipse.persistence.testing.tests.nonJDBC.NonJDBCTestHelper.buildWorkbenchXMLProject) Project(org.eclipse.persistence.sessions.Project) PLSQLStoredProcedureCall(org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredProcedureCall) XMLContext(org.eclipse.persistence.oxm.XMLContext) XMLMarshaller(org.eclipse.persistence.oxm.XMLMarshaller) StringReader(java.io.StringReader) Document(org.w3c.dom.Document) DataModifyQuery(org.eclipse.persistence.queries.DataModifyQuery) Test(org.junit.Test)

Example 23 with PLSQLStoredProcedureCall

use of org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredProcedureCall in project eclipselink by eclipse-ee4j.

the class Ni9TestSet method writeToXml.

@Test
public void writeToXml() {
    // (y in positiven)
    PLSQLStoredProcedureCall call = new PLSQLStoredProcedureCall();
    call.setProcedureName("positiven_in_test");
    call.addNamedArgument("Y", OraclePLSQLTypes.PositiveN);
    DataModifyQuery query = new DataModifyQuery();
    query.addArgument("Y", Integer.class);
    query.setCall(call);
    project.getDescriptor(Empty.class).getQueryManager().addQuery("Ni9", query);
    Project projectToXml = project.clone();
    // trim off login 'cause it changes under test - this way, a comparison
    // can be done to a control document
    projectToXml.setDatasourceLogin(null);
    XMLContext context = new XMLContext(workbenchXMLProject);
    XMLMarshaller marshaller = context.createMarshaller();
    Document doc = marshaller.objectToXML(projectToXml);
    Document controlDoc = xmlParser.parse(new StringReader(NI9_PROJECT_XML));
    assertTrue("control document not same as instance document", comparer.isNodeEqual(controlDoc, doc));
}
Also used : ObjectPersistenceWorkbenchXMLProject(org.eclipse.persistence.internal.sessions.factories.ObjectPersistenceWorkbenchXMLProject) NonJDBCTestHelper.buildTestProject(org.eclipse.persistence.testing.tests.nonJDBC.NonJDBCTestHelper.buildTestProject) NonJDBCTestHelper.buildWorkbenchXMLProject(org.eclipse.persistence.testing.tests.nonJDBC.NonJDBCTestHelper.buildWorkbenchXMLProject) Project(org.eclipse.persistence.sessions.Project) PLSQLStoredProcedureCall(org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredProcedureCall) XMLContext(org.eclipse.persistence.oxm.XMLContext) XMLMarshaller(org.eclipse.persistence.oxm.XMLMarshaller) StringReader(java.io.StringReader) Document(org.w3c.dom.Document) DataModifyQuery(org.eclipse.persistence.queries.DataModifyQuery) Test(org.junit.Test)

Example 24 with PLSQLStoredProcedureCall

use of org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredProcedureCall in project eclipselink by eclipse-ee4j.

the class NijiTestSet method writeToXml.

@Test
public void writeToXml() {
    // (x in boolean, y in varchar)
    PLSQLStoredProcedureCall call = new PLSQLStoredProcedureCall();
    call.setProcedureName("niji");
    call.addNamedArgument("X", OraclePLSQLTypes.PLSQLBoolean);
    call.addNamedArgument("Y", JDBCTypes.VARCHAR_TYPE, 40);
    DataModifyQuery query = new DataModifyQuery();
    query.addArgument("X", Integer.class);
    query.addArgument("Y", String.class);
    query.setCall(call);
    project.getDescriptor(Empty.class).getQueryManager().addQuery("Niji", query);
    Project projectToXml = project.clone();
    // trim off login 'cause it changes under test - this way, a comparison
    // can be done to a control document
    projectToXml.setDatasourceLogin(null);
    XMLContext context = new XMLContext(workbenchXMLProject);
    XMLMarshaller marshaller = context.createMarshaller();
    Document doc = marshaller.objectToXML(projectToXml);
    Document controlDoc = xmlParser.parse(new StringReader(NIJI_PROJECT_XML));
    assertTrue("control document not same as instance document", comparer.isNodeEqual(controlDoc, doc));
}
Also used : ObjectPersistenceWorkbenchXMLProject(org.eclipse.persistence.internal.sessions.factories.ObjectPersistenceWorkbenchXMLProject) NonJDBCTestHelper.buildTestProject(org.eclipse.persistence.testing.tests.nonJDBC.NonJDBCTestHelper.buildTestProject) NonJDBCTestHelper.buildWorkbenchXMLProject(org.eclipse.persistence.testing.tests.nonJDBC.NonJDBCTestHelper.buildWorkbenchXMLProject) Project(org.eclipse.persistence.sessions.Project) PLSQLStoredProcedureCall(org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredProcedureCall) XMLContext(org.eclipse.persistence.oxm.XMLContext) XMLMarshaller(org.eclipse.persistence.oxm.XMLMarshaller) StringReader(java.io.StringReader) Document(org.w3c.dom.Document) DataModifyQuery(org.eclipse.persistence.queries.DataModifyQuery) Test(org.junit.Test)

Example 25 with PLSQLStoredProcedureCall

use of org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredProcedureCall in project eclipselink by eclipse-ee4j.

the class PLSQLrecordWithCompatibleTypeInOutTestSet method writeToXml.

@Test
public void writeToXml() {
    PLSQLrecord r1 = new PLSQLrecord();
    r1.setTypeName("emp%ROWTYPE");
    r1.setCompatibleType("EMP_TYPE");
    r1.addField("EMPNO", JDBCTypes.NUMERIC_TYPE, 4, 0);
    r1.addField("ENAME", JDBCTypes.VARCHAR_TYPE, 10);
    r1.addField("JOB", JDBCTypes.VARCHAR_TYPE, 9);
    r1.addField("MGR", JDBCTypes.NUMERIC_TYPE, 4, 0);
    r1.addField("HIREDATE", JDBCTypes.DATE_TYPE);
    r1.addField("SAL", JDBCTypes.FLOAT_TYPE, 7, 2);
    r1.addField("COMM", JDBCTypes.NUMERIC_TYPE, 7, 2);
    r1.addField("DEPTNO", JDBCTypes.NUMERIC_TYPE, 2, 0);
    // PROCEDURE REC_TEST_INOUT(Z IN OUT EMP%ROWTYPE)
    PLSQLStoredProcedureCall call = new PLSQLStoredProcedureCall();
    call.setProcedureName("REC_TEST_INOUT");
    call.addNamedInOutputArgument("Z", r1);
    ReadObjectQuery query = new ReadObjectQuery(PLSQLEmployeeType.class);
    query.addArgument("Z", Struct.class);
    query.doNotCacheQueryResults();
    query.dontMaintainCache();
    query.setCall(call);
    project.getDescriptor(PLSQLEmployeeType.class).getQueryManager().addQuery("PLSQLrecordWithCompatibleTypeInOut", query);
    Project projectToXml = project.clone();
    // trim off login 'cause it changes under test - this way, a comparison
    // can be done to a control document
    projectToXml.setDatasourceLogin(null);
    XMLContext context = new XMLContext(workbenchXMLProject);
    XMLMarshaller marshaller = context.createMarshaller();
    Document doc = marshaller.objectToXML(projectToXml);
    Document controlDoc = xmlParser.parse(new StringReader(PLSQLRECORD_WITHCOMPATIBLETYPE_INOUT_PROJECT_XML));
    assertTrue("control document not same as instance document", comparer.isNodeEqual(controlDoc, doc));
}
Also used : ObjectPersistenceWorkbenchXMLProject(org.eclipse.persistence.internal.sessions.factories.ObjectPersistenceWorkbenchXMLProject) Project(org.eclipse.persistence.sessions.Project) PLSQLrecordTestHelper.buildTestProject(org.eclipse.persistence.testing.tests.plsqlrecord.PLSQLrecordTestHelper.buildTestProject) PLSQLrecordTestHelper.buildWorkbenchXMLProject(org.eclipse.persistence.testing.tests.plsqlrecord.PLSQLrecordTestHelper.buildWorkbenchXMLProject) PLSQLStoredProcedureCall(org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredProcedureCall) ReadObjectQuery(org.eclipse.persistence.queries.ReadObjectQuery) XMLContext(org.eclipse.persistence.oxm.XMLContext) XMLMarshaller(org.eclipse.persistence.oxm.XMLMarshaller) PLSQLrecord(org.eclipse.persistence.platform.database.oracle.plsql.PLSQLrecord) StringReader(java.io.StringReader) Document(org.w3c.dom.Document) Test(org.junit.Test)

Aggregations

PLSQLStoredProcedureCall (org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredProcedureCall)67 ObjectPersistenceWorkbenchXMLProject (org.eclipse.persistence.internal.sessions.factories.ObjectPersistenceWorkbenchXMLProject)37 Project (org.eclipse.persistence.sessions.Project)37 StringReader (java.io.StringReader)36 XMLContext (org.eclipse.persistence.oxm.XMLContext)36 XMLMarshaller (org.eclipse.persistence.oxm.XMLMarshaller)36 Test (org.junit.Test)36 Document (org.w3c.dom.Document)36 DataModifyQuery (org.eclipse.persistence.queries.DataModifyQuery)32 NonJDBCTestHelper.buildTestProject (org.eclipse.persistence.testing.tests.nonJDBC.NonJDBCTestHelper.buildTestProject)30 NonJDBCTestHelper.buildWorkbenchXMLProject (org.eclipse.persistence.testing.tests.nonJDBC.NonJDBCTestHelper.buildWorkbenchXMLProject)30 DataReadQuery (org.eclipse.persistence.queries.DataReadQuery)28 PLSQLrecord (org.eclipse.persistence.platform.database.oracle.plsql.PLSQLrecord)24 PLSQLCollection (org.eclipse.persistence.platform.database.oracle.plsql.PLSQLCollection)12 PLSQLrecordTestHelper.buildTestProject (org.eclipse.persistence.testing.tests.plsqlrecord.PLSQLrecordTestHelper.buildTestProject)6 PLSQLrecordTestHelper.buildWorkbenchXMLProject (org.eclipse.persistence.testing.tests.plsqlrecord.PLSQLrecordTestHelper.buildWorkbenchXMLProject)6 PLSQLargument (org.eclipse.persistence.platform.database.oracle.plsql.PLSQLargument)3 ReadObjectQuery (org.eclipse.persistence.queries.ReadObjectQuery)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2