pa-media-group / xquery-unit

Automatically exported from code.google.com/p/xquery-unit
0 stars 0 forks source link

Unable to pass a binary file in a map in xquery-unit #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Sample Code:

InputStream stream = 
binaryTest.class.getResourceAsStream("/org/xqrails/data/sample.jpg");

        map = new XdmValue[] { ValueFactory.newXSString("map"), ValueFactory.newXSString("ivasset:title"),  ValueFactory.newXSString("UnitTestItem"),
                  ValueFactory.newXSString("type"),  ValueFactory.newXSString("image"),
                  ValueFactory.newXSString("ivasset:fileSize"),  ValueFactory.newXSString("4124"),
                  ValueFactory.newXSString("ivdocument:fileName"),  ValueFactory.newXSString("sample.jpg"),
                  ValueFactory.newXSString("document"),  ValueFactory.newBinaryNode(stream)};
        params = new XdmValue[] { 
                ValueFactory.newElement(w3cDoc.getDocumentElement()),
                ValueFactory.newSequence(map)
        };
        ResultSequence rs = executeLibraryModule(modulePath, moduleNamespace, "save", params);

        org.junit.Assert.assertNotNull(rs);

What is the expected output? What do you see instead?
Be able to pass a Binary Object from JAVA to XQuery

What version of the product are you using? On what operating system?
xquery-unit0.3.4.jar

Please provide any additional information below.

Stack Trace
com.marklogic.xcc.exceptions.XQueryException: XDMP-QRYXMLCHAR: Invalid XML 
character -- query contains non-XML character
on line 10
expr:  
    at com.marklogic.xcc.impl.handlers.ServerExceptionHandler.handleResponse(ServerExceptionHandler.java:31)
    at com.marklogic.xcc.impl.handlers.EvalRequestController.serverDialog(EvalRequestController.java:68)
    at com.marklogic.xcc.impl.handlers.AbstractRequestController.runRequest(AbstractRequestController.java:72)
    at com.marklogic.xcc.impl.SessionImpl.submitRequest(SessionImpl.java:280)
    at com.marklogic.ps.util.Xcc.invokeModuleFunction(Xcc.java:137)
    at com.marklogic.ps.test.XQueryTestCase.executeLibraryModule(XQueryTestCase.java:334)
    at org.xqrails.models.binaryTest.save(binaryTest.java:75)
    at org.xqrails.models.binaryTest.binary_setUp(binaryTest.java:31)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Original issue reported on code.google.com by monteiro...@gmail.com on 8 Feb 2012 at 4:46

GoogleCodeExporter commented 9 years ago
The map is "XdmValue[] map = "

Original comment by monteiro...@gmail.com on 8 Feb 2012 at 4:48

Attachments: