コード例 #1
0
 @Test
 public void echoVarchar2() {
   Invocation invocation = new Invocation("echoVarchar2");
   invocation.setParameter("PINPUTVARCHAR", "this is a varchar2 test");
   Operation op = xrService.getOperation(invocation.getName());
   Object result = op.invoke(xrService, invocation);
   assertNotNull("result is null", result);
   Document doc = xmlPlatform.createDocument();
   XMLMarshaller marshaller = xrService.getXMLContext().createMarshaller();
   marshaller.marshal(result, doc);
   Document controlDoc = xmlParser.parse(new StringReader(ECHO_VARCHAR2_RESULT));
   assertTrue(
       "control document not same as instance document", comparer.isNodeEqual(controlDoc, doc));
 }
コード例 #2
0
 @Test
 public void echoClob() throws ParseException, SQLException {
   Invocation invocation = new Invocation("echoClob");
   invocation.setParameter("PINPUTCLOB", "This is a Clob test");
   Operation op = xrService.getOperation(invocation.getName());
   Object result = op.invoke(xrService, invocation);
   assertNotNull("result is null", result);
   Document doc = xmlPlatform.createDocument();
   XMLMarshaller marshaller = xrService.getXMLContext().createMarshaller();
   marshaller.marshal(result, doc);
   Document controlDoc = xmlParser.parse(new StringReader(ECHO_CLOB_RESULT));
   assertTrue(
       "control document not same as instance document", comparer.isNodeEqual(controlDoc, doc));
 }
コード例 #3
0
 @Test
 public void echoDouble() {
   Invocation invocation = new Invocation("echoDouble");
   invocation.setParameter("PDOUBLE", new Double("314.15926"));
   Operation op = xrService.getOperation(invocation.getName());
   Object result = op.invoke(xrService, invocation);
   assertNotNull("result is null", result);
   Document doc = xmlPlatform.createDocument();
   XMLMarshaller marshaller = xrService.getXMLContext().createMarshaller();
   marshaller.marshal(result, doc);
   Document controlDoc = xmlParser.parse(new StringReader(ECHO_DOUBLE_RESULT));
   assertTrue(
       "control document not same as instance document", comparer.isNodeEqual(controlDoc, doc));
 }
コード例 #4
0
 @Test
 public void echoRowId() throws ParseException {
   Invocation invocation = new Invocation("echoRowId");
   invocation.setParameter("PROWID", "'AAADL1AABAAACTEAAE'");
   Operation op = xrService.getOperation(invocation.getName());
   Object result = op.invoke(xrService, invocation);
   assertNotNull("result is null", result);
   Document doc = xmlPlatform.createDocument();
   XMLMarshaller marshaller = xrService.getXMLContext().createMarshaller();
   marshaller.marshal(((XMLRoot) result).getObject(), doc);
   Document controlDoc = xmlParser.parse(new StringReader(ECHO_ROWID_RESULT));
   assertTrue(
       "control document not same as instance document", comparer.isNodeEqual(controlDoc, doc));
 }
コード例 #5
0
 @Test
 public void echoRaw() throws ParseException {
   Invocation invocation = new Invocation("echoRaw");
   byte[] testBytes = "This is yet another test!".getBytes();
   invocation.setParameter("PRAW", testBytes);
   Operation op = xrService.getOperation(invocation.getName());
   Object result = op.invoke(xrService, invocation);
   assertNotNull("result is null", result);
   Document doc = xmlPlatform.createDocument();
   XMLMarshaller marshaller = xrService.getXMLContext().createMarshaller();
   marshaller.marshal(((XMLRoot) result).getObject(), doc);
   Document controlDoc = xmlParser.parse(new StringReader(ECHO_RAW_RESULT));
   assertTrue(
       "control document not same as instance document", comparer.isNodeEqual(controlDoc, doc));
 }
コード例 #6
0
 @Test
 public void echoTimestamp() throws ParseException {
   Invocation invocation = new Invocation("echoTimestamp");
   SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd:hhmmss.SSS");
   invocation.setParameter("PINPUTTS", format.parse("20091204:091923.123"));
   Operation op = xrService.getOperation(invocation.getName());
   Object result = op.invoke(xrService, invocation);
   assertNotNull("result is null", result);
   Document doc = xmlPlatform.createDocument();
   XMLMarshaller marshaller = xrService.getXMLContext().createMarshaller();
   marshaller.marshal(result, doc);
   Document controlDoc = xmlParser.parse(new StringReader(ECHO_TS_RESULT));
   assertTrue(
       "control document not same as instance document", comparer.isNodeEqual(controlDoc, doc));
 }
コード例 #7
0
 @Test
 public void echoLong() throws ParseException {
   Invocation invocation = new Invocation("echoLong");
   invocation.setParameter(
       "PLONG", "This is a LONG type test.  A LONG type represents 2GB of character data.");
   Operation op = xrService.getOperation(invocation.getName());
   Object result = op.invoke(xrService, invocation);
   assertNotNull("result is null", result);
   Document doc = xmlPlatform.createDocument();
   XMLMarshaller marshaller = xrService.getXMLContext().createMarshaller();
   marshaller.marshal(((XMLRoot) result).getObject(), doc);
   Document controlDoc = xmlParser.parse(new StringReader(ECHO_LONG_RESULT));
   assertTrue(
       "Expected:\n" + documentToString(controlDoc) + "\nActual:\n" + documentToString(doc),
       comparer.isNodeEqual(controlDoc, doc));
 }
コード例 #8
0
 @SuppressWarnings({"unchecked", "rawtypes"})
 @Test
 public void findAll() {
   Invocation invocation = new Invocation("findAll_inlinebinaryType");
   Operation op = xrService.getOperation(invocation.getName());
   Object result = op.invoke(xrService, invocation);
   assertNotNull("result is null", result);
   XMLMarshaller marshaller = xrService.getXMLContext().createMarshaller();
   Document doc = xmlPlatform.createDocument();
   Element ec = doc.createElement("inlinebinary-collection");
   doc.appendChild(ec);
   for (Object r : (Vector) result) {
     marshaller.marshal(r, ec);
   }
   Document controlDoc = xmlParser.parse(new StringReader(INLINEBINARY_COLLECTION_XML));
   assertTrue(
       "control document not same as instance document", comparer.isNodeEqual(controlDoc, doc));
 }
コード例 #9
0
 @Test
 public void fEchoNchar() {
   Invocation invocation = new Invocation("fEchoNchar");
   invocation.setParameter("p_nchar", "N'q'");
   Operation op = xrService.getOperation(invocation.getName());
   Object result = op.invoke(xrService, invocation);
   assertNotNull("result is null", result);
   Document doc = xmlPlatform.createDocument();
   XMLMarshaller marshaller = xrService.getXMLContext().createMarshaller();
   marshaller.marshal(result, doc);
   Document controlDoc = xmlParser.parse(new StringReader(F_ECHO_NCHAR_RESULT));
   assertTrue(
       "control document not same as instance document.  Expected "
           + documentToString(controlDoc)
           + " but was "
           + documentToString(doc),
       comparer.isNodeEqual(controlDoc, doc));
 }
コード例 #10
0
 @Test
 public void echoNumber() {
   Invocation invocation = new Invocation("echoNumber");
   invocation.setParameter("PNUMBER", BigDecimal.valueOf(17));
   Operation op = xrService.getOperation(invocation.getName());
   Object result = op.invoke(xrService, invocation);
   assertNotNull("result is null", result);
   Document doc = xmlPlatform.createDocument();
   XMLMarshaller marshaller = xrService.getXMLContext().createMarshaller();
   marshaller.marshal(result, doc);
   Document controlDoc = xmlParser.parse(new StringReader(ECHO_NUMBER_RESULT));
   assertTrue(
       "Control document not same as instance document.\nExpected:\n"
           + documentToString(controlDoc)
           + "\nActual:\n"
           + documentToString(doc),
       comparer.isNodeEqual(controlDoc, doc));
 }
コード例 #11
0
 @Test
 public void echoBooleanFalse2() {
   Invocation invocation = new Invocation("echoBoolean2");
   invocation.setParameter("P1", 0);
   Operation op = xrService.getOperation(invocation.getName());
   Object result = op.invoke(xrService, invocation);
   assertNotNull("result is null", result);
   Document doc = xmlPlatform.createDocument();
   XMLMarshaller marshaller = xrService.getXMLContext().createMarshaller();
   marshaller.marshal(result, doc);
   Document controlDoc = xmlParser.parse(new StringReader(ECHO_BOOLEAN_RESULT2));
   assertTrue(
       "control document not same as instance document:  expected "
           + documentToString(controlDoc)
           + " but was "
           + documentToString(doc),
       comparer.isNodeEqual(controlDoc, doc));
 }
コード例 #12
0
 @Test
 public void selectXMLData() throws ParseException {
   Invocation invocation = new Invocation("selectXMLData");
   Operation op = xrService.getOperation(invocation.getName());
   Object result = null;
   try {
     result = op.invoke(xrService, invocation);
   } catch (NoClassDefFoundError ncdfex) {
     fail(
         "Test failed unexpectedly.  Please make sure that Oracle's XDB and XMLParser jars are on the test classpath.\nException:\n"
             + ncdfex);
   }
   assertNotNull("result is null", result);
   Document doc = xmlPlatform.createDocument();
   XMLMarshaller marshaller = xrService.getXMLContext().createMarshaller();
   marshaller.marshal(((XMLRoot) result).getObject(), doc);
   Document controlDoc = xmlParser.parse(new StringReader(XMLTYPE_XML_2));
   assertTrue(
       "Expected:\n" + documentToString(controlDoc) + "\nActual:\n" + documentToString(doc),
       comparer.isNodeEqual(controlDoc, doc));
 }