Search in sources :

Example 96 with XMLContext

use of org.eclipse.persistence.oxm.XMLContext in project eclipselink by eclipse-ee4j.

the class NojiTestSet method writeToXml.

@Test
public void writeToXml() {
    // (x out binary_integer, y in varchar)
    PLSQLStoredProcedureCall call = new PLSQLStoredProcedureCall();
    call.setProcedureName("noji");
    call.addNamedOutputArgument("X", OraclePLSQLTypes.BinaryInteger);
    call.addNamedArgument("Y", JDBCTypes.VARCHAR_TYPE, 40);
    DataReadQuery query = new DataReadQuery();
    query.setCall(call);
    query.addArgument("Y", String.class);
    project.getDescriptor(Empty.class).getQueryManager().addQuery("Noji", 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(NOJI_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) DataReadQuery(org.eclipse.persistence.queries.DataReadQuery) Document(org.w3c.dom.Document) Test(org.junit.Test)

Example 97 with XMLContext

use of org.eclipse.persistence.oxm.XMLContext in project eclipselink by eclipse-ee4j.

the class jiNiNijiTestSet method writeToXml.

@Test
public void writeToXml() {
    // (x in varchar, y in binary_integer, z in boolean, aa in number)
    PLSQLStoredProcedureCall call = new PLSQLStoredProcedureCall();
    call.setProcedureName("jiNiNiji");
    call.addNamedArgument("X", JDBCTypes.VARCHAR_TYPE, 20);
    call.addNamedArgument("Y", OraclePLSQLTypes.BinaryInteger);
    call.addNamedArgument("Z", OraclePLSQLTypes.PLSQLBoolean);
    call.addNamedArgument("AA", JDBCTypes.NUMERIC_TYPE, 20, 2);
    DataModifyQuery query = new DataModifyQuery();
    query.addArgument("X", String.class);
    query.addArgument("Y", Integer.class);
    query.addArgument("Z", Integer.class);
    query.addArgument("AA", BigDecimal.class);
    query.setCall(call);
    project.getDescriptor(Empty.class).getQueryManager().addQuery("jiNiNiji", 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(JININIJI_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 98 with XMLContext

use of org.eclipse.persistence.oxm.XMLContext in project eclipselink by eclipse-ee4j.

the class jiNiTestSet method writeToXml.

@Test
public void writeToXml() {
    // (x in varchar, y in boolean)
    PLSQLStoredProcedureCall call = new PLSQLStoredProcedureCall();
    call.setProcedureName("jini");
    call.addNamedArgument("X", JDBCTypes.VARCHAR_TYPE, 20);
    call.addNamedArgument("Y", OraclePLSQLTypes.PLSQLBoolean);
    DataModifyQuery query = new DataModifyQuery();
    query.addArgument("X", String.class);
    query.addArgument("Y", Integer.class);
    query.setCall(call);
    project.getDescriptor(Empty.class).getQueryManager().addQuery("jiNi", 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(JINI_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 99 with XMLContext

use of org.eclipse.persistence.oxm.XMLContext in project eclipselink by eclipse-ee4j.

the class jiNijiTestSet method writeToXml.

@Test
public void writeToXml() {
    // (x in varchar, y in boolean, z in number)
    PLSQLStoredProcedureCall call = new PLSQLStoredProcedureCall();
    call.setProcedureName("jiniji");
    call.addNamedArgument("X", JDBCTypes.VARCHAR_TYPE, 20);
    call.addNamedArgument("Y", OraclePLSQLTypes.PLSQLBoolean);
    call.addNamedArgument("Z", JDBCTypes.NUMERIC_TYPE, 10, 2);
    DataModifyQuery query = new DataModifyQuery();
    query.addArgument("X", String.class);
    query.addArgument("Y", Integer.class);
    query.addArgument("Z", BigDecimal.class);
    query.setCall(call);
    project.getDescriptor(Empty.class).getQueryManager().addQuery("jiNiji", 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(JINIJI_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 100 with XMLContext

use of org.eclipse.persistence.oxm.XMLContext in project eclipselink by eclipse-ee4j.

the class jiNioTestSet method writeToXml.

@Test
public void writeToXml() {
    // (X IN VARCHAR2, Y IN OUT BOOLEAN);
    PLSQLStoredProcedureCall call = new PLSQLStoredProcedureCall();
    call.setProcedureName("jiNio");
    call.addNamedArgument("X", JDBCTypes.VARCHAR_TYPE, 20);
    call.addNamedInOutputArgument("Y", OraclePLSQLTypes.PLSQLBoolean);
    DataReadQuery query = new DataReadQuery();
    query.addArgument("X", String.class);
    query.addArgument("Y", Integer.class);
    query.setCall(call);
    query.setCall(call);
    project.getDescriptor(Empty.class).getQueryManager().addQuery("jiNio", 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(JINIO_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) DataReadQuery(org.eclipse.persistence.queries.DataReadQuery) Document(org.w3c.dom.Document) Test(org.junit.Test)

Aggregations

XMLContext (org.eclipse.persistence.oxm.XMLContext)170 Project (org.eclipse.persistence.sessions.Project)80 XMLMarshaller (org.eclipse.persistence.oxm.XMLMarshaller)68 Document (org.w3c.dom.Document)57 StringReader (java.io.StringReader)56 Test (org.junit.Test)41 ObjectPersistenceWorkbenchXMLProject (org.eclipse.persistence.internal.sessions.factories.ObjectPersistenceWorkbenchXMLProject)40 XMLUnmarshaller (org.eclipse.persistence.oxm.XMLUnmarshaller)39 PLSQLStoredProcedureCall (org.eclipse.persistence.platform.database.oracle.plsql.PLSQLStoredProcedureCall)36 InputStream (java.io.InputStream)30 NonJDBCTestHelper.buildTestProject (org.eclipse.persistence.testing.tests.nonJDBC.NonJDBCTestHelper.buildTestProject)30 NonJDBCTestHelper.buildWorkbenchXMLProject (org.eclipse.persistence.testing.tests.nonJDBC.NonJDBCTestHelper.buildWorkbenchXMLProject)30 DataModifyQuery (org.eclipse.persistence.queries.DataModifyQuery)21 SchemaModelProject (org.eclipse.persistence.internal.oxm.schema.SchemaModelProject)18 XMLDescriptor (org.eclipse.persistence.oxm.XMLDescriptor)17 XMLLogin (org.eclipse.persistence.oxm.XMLLogin)17 StringWriter (java.io.StringWriter)15 StreamSource (javax.xml.transform.stream.StreamSource)15 JAXBException (jakarta.xml.bind.JAXBException)14 Map (java.util.Map)14