use of alma.xmlentity.XmlEntityStructHolder in project ACS by ACS-Community.
the class DynamicProxyFactoryTest method testCallXmlInOutMethod.
public void testCallXmlInOutMethod() throws DynWrapperException {
XmlComponentOperations serverProxy = createServerProxy();
assertNotNull(serverProxy);
XmlEntityStruct entStructObsProp = serverProxy.createObsProposal();
XmlEntityStructHolder xesh = new XmlEntityStructHolder();
// send invalid xml
entStructObsProp.xmlString = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" + "<ns1:ObsProposal xmlns:ns1=\"AlmaTest/ObsProposal\">" + " <ns1:ObsProposalEntity entityIdEncrypted=\"ljasd;ljfa;lsfd\"" + " entityId=\"uid://X0000000000000000/X00000001\" entityTypeName=\"ObsProposal\"/>" + " <ns1:ContactPerson>Otis P. Driftwood.</ns1:ContactPerson>" + "</ns1:ObsProposal>";
serverProxy.xmlInOutMethod(entStructObsProp, xesh);
assertNotNull(xesh.value);
String xml = xesh.value.xmlString;
assertNotNull(xml);
System.out.println("received out-param SchedBlock as XML: " + xml);
}
use of alma.xmlentity.XmlEntityStructHolder in project ACS by ACS-Community.
the class DynamicProxyFactoryTest method testInvalidXml.
public void testInvalidXml() throws DynWrapperException {
XmlComponentOperations serverProxy = createServerProxy();
assertNotNull(serverProxy);
XmlEntityStruct entStructObsProp = serverProxy.createObsProposal();
XmlEntityStructHolder xesh = new XmlEntityStructHolder();
// send invalid xml
entStructObsProp.xmlString = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" + // "<ns1:ObsProposal xmlns:ns1=\"AlmaTest/ObsProposal\">" +
" <ns1:ObsProposalEntity entityIdEncrypted=\"ljasd;ljfa;lsfd\"" + " entityId=\"uid://X0000000000000000/X00000001\" entityTypeName=\"ObsProposal\"/>" + " <ns1:PerformanceGoals>peak performance enduring a 24-7-365 schedule.</ns1:PerformanceGoals>" + "</ns1:ObsProposal>";
try {
serverProxy.xmlInOutMethod(entStructObsProp, xesh);
fail("invalid XML should have caused an exception");
} catch (UndeclaredThrowableException e) {
Throwable cause = e.getCause();
assertTrue(cause instanceof DynWrapperException);
Throwable cause2 = cause.getCause();
assertTrue(cause2 instanceof MarshalException);
assertTrue(((MarshalException) cause2).getCause() instanceof org.xml.sax.SAXException);
}
}
use of alma.xmlentity.XmlEntityStructHolder in project ACS by ACS-Community.
the class DynamicProxyFactoryTest method testEmptyXml.
/**
* Sends an empty (one blank) XML representation of an ObsProposal to the method
* <code>xmlInOutMethod</code>. Expects to not get an exception.
* @throws DynWrapperException
*/
public void testEmptyXml() throws DynWrapperException {
XmlComponentOperations serverProxy = createServerProxy();
assertNotNull(serverProxy);
// just to have a valid struct
XmlEntityStruct entStructObsProp = serverProxy.createObsProposal();
XmlEntityStructHolder xesh = new XmlEntityStructHolder();
// send empty xml
entStructObsProp.xmlString = " ";
serverProxy.xmlInOutMethod(entStructObsProp, xesh);
// ObsProposal in-param and thus SchedBlock out-param are null,
// so that the out-XmlEntityStruct struct must be empty.
assertEquals("", xesh.value.xmlString);
}
Aggregations