Search in sources :

Example 1 with XmlComponentOperations

use of alma.demo.XmlComponentOperations in project ACS by ACS-Community.

the class XmlComponentHelper method _getInterfaceTranslator.

/**
     * @see alma.acs.container.ComponentHelper#_getInterfaceTranslator(java.lang.Object)
     */
protected Object _getInterfaceTranslator(Object defaultInterfaceTranslator) throws AcsJJavaComponentHelperEx {
    XmlComponentJ impl = null;
    XmlComponentOperations opDelegate = null;
    try {
        impl = (XmlComponentJ) getComponentImpl();
    } catch (AcsJComponentCreationEx e) {
        throw new AcsJJavaComponentHelperEx(e);
    }
    opDelegate = (XmlComponentOperations) defaultInterfaceTranslator;
    return new IFTranslator(impl, opDelegate, getComponentLogger());
}
Also used : AcsJComponentCreationEx(alma.maciErrType.wrappers.AcsJComponentCreationEx) XmlComponentOperations(alma.demo.XmlComponentOperations) XmlComponentJ(alma.demo.XmlComponentJ) AcsJJavaComponentHelperEx(alma.JavaContainerError.wrappers.AcsJJavaComponentHelperEx)

Example 2 with XmlComponentOperations

use of alma.demo.XmlComponentOperations 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);
}
Also used : XmlEntityStructHolder(alma.xmlentity.XmlEntityStructHolder) XmlComponentOperations(alma.demo.XmlComponentOperations) XmlEntityStruct(alma.xmlentity.XmlEntityStruct)

Example 3 with XmlComponentOperations

use of alma.demo.XmlComponentOperations 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);
    }
}
Also used : XmlEntityStructHolder(alma.xmlentity.XmlEntityStructHolder) MarshalException(org.exolab.castor.xml.MarshalException) XmlComponentOperations(alma.demo.XmlComponentOperations) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) XmlEntityStruct(alma.xmlentity.XmlEntityStruct)

Example 4 with XmlComponentOperations

use of alma.demo.XmlComponentOperations in project ACS by ACS-Community.

the class DynamicProxyFactoryTest method testCreateServerProxy.

public void testCreateServerProxy() throws DynWrapperException {
    assertNotNull(corbaIF);
    assertNotNull(compImpl);
    assertNotNull(compIF);
    XmlComponentOperations serverProxy = createServerProxy();
    assertNotNull(serverProxy);
}
Also used : XmlComponentOperations(alma.demo.XmlComponentOperations)

Example 5 with XmlComponentOperations

use of alma.demo.XmlComponentOperations 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);
}
Also used : XmlEntityStructHolder(alma.xmlentity.XmlEntityStructHolder) XmlComponentOperations(alma.demo.XmlComponentOperations) XmlEntityStruct(alma.xmlentity.XmlEntityStruct)

Aggregations

XmlComponentOperations (alma.demo.XmlComponentOperations)9 XmlEntityStruct (alma.xmlentity.XmlEntityStruct)6 XmlEntityStructHolder (alma.xmlentity.XmlEntityStructHolder)3 AcsJJavaComponentHelperEx (alma.JavaContainerError.wrappers.AcsJJavaComponentHelperEx)1 ObsProjectTree (alma.demo.ObsProjectTree)1 XmlComponentJ (alma.demo.XmlComponentJ)1 AcsJComponentCreationEx (alma.maciErrType.wrappers.AcsJComponentCreationEx)1 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)1 MarshalException (org.exolab.castor.xml.MarshalException)1