Search in sources :

Example 11 with XmlEntityStruct

use of alma.xmlentity.XmlEntityStruct in project ACS by ACS-Community.

the class DynamicProxyFactoryTest method testNullXmlEntityReturned.

/**
	 * When the inner interface returns a <code>null</code> for an XML entity,
	 * we must still return a non-null XmlEntityStruct, or else 
	 * we'd get a NullPointerException in XmlEntityStructHelper#write
	 * See http://jira.alma.cl/browse/COMP-1336
	 */
public void testNullXmlEntityReturned() throws Exception {
    XmlTestComponent compImplWithNullReturn = new DynamicProxyFactoryTest.XmlTestComponent() {

        @Override
        public SchedBlock getBestSchedBlock() {
            // here we return a null instead of a SchedBlock xml binding object
            return null;
        }
    };
    XmlComponentOperations serverProxy = (XmlComponentOperations) DynamicProxyFactory.getDynamicProxyFactory(m_logger).createServerProxy(corbaIF, compImplWithNullReturn, compIF);
    assertNotNull(serverProxy);
    XmlEntityStruct entStruct = serverProxy.getBestSchedBlock();
    assertNotNull(entStruct);
    assertTrue(entStruct.xmlString.isEmpty());
    System.out.println("A null from getBestSchedBlock() was translated to an empty XmlEntityStruct.");
}
Also used : XmlComponentOperations(alma.demo.XmlComponentOperations) XmlEntityStruct(alma.xmlentity.XmlEntityStruct)

Example 12 with XmlEntityStruct

use of alma.xmlentity.XmlEntityStruct in project ACS by ACS-Community.

the class DynamicProxyFactoryTest method testCallGetAllSchedBlocks.

public void testCallGetAllSchedBlocks() throws DynWrapperException {
    XmlComponentOperations serverProxy = createServerProxy();
    assertNotNull(serverProxy);
    XmlEntityStruct[] entStructSchedBlocks = serverProxy.getAllSchedBlocks();
    assertNotNull(entStructSchedBlocks);
    System.out.println("received SchedBlocks as XML: ");
    for (int i = 0; i < entStructSchedBlocks.length; i++) {
        XmlEntityStruct structSB = entStructSchedBlocks[i];
        assertNotNull(structSB);
        assertNotNull(structSB.xmlString);
        System.out.println(structSB.xmlString);
    }
}
Also used : XmlComponentOperations(alma.demo.XmlComponentOperations) XmlEntityStruct(alma.xmlentity.XmlEntityStruct)

Example 13 with XmlEntityStruct

use of alma.xmlentity.XmlEntityStruct in project ACS by ACS-Community.

the class DynamicProxyFactoryTest method testCallCreateObsProposal.

public void testCallCreateObsProposal() throws DynWrapperException {
    XmlComponentOperations serverProxy = createServerProxy();
    assertNotNull(serverProxy);
    XmlEntityStruct entStruct = serverProxy.createObsProposal();
    assertNotNull(entStruct);
    assertNotNull(entStruct.xmlString);
    System.out.println("received ObsProposal as XML: " + entStruct.xmlString);
}
Also used : XmlComponentOperations(alma.demo.XmlComponentOperations) XmlEntityStruct(alma.xmlentity.XmlEntityStruct)

Aggregations

XmlEntityStruct (alma.xmlentity.XmlEntityStruct)13 XmlComponentOperations (alma.demo.XmlComponentOperations)6 XmlEntityStructHolder (alma.xmlentity.XmlEntityStructHolder)3 XmlOffshoot (alma.demo.XmlOffshoot)2 EntityT (alma.entities.commonentity.EntityT)2 CharArrayReader (java.io.CharArrayReader)2 DocumentBuilder (javax.xml.parsers.DocumentBuilder)2 Document (org.w3c.dom.Document)2 InputSource (org.xml.sax.InputSource)2 EntityException (alma.acs.entityutil.EntityException)1 ComponentWithXmlOffshoot (alma.demo.ComponentWithXmlOffshoot)1 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1 StringWriter (java.io.StringWriter)1 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)1 MarshalException (org.exolab.castor.xml.MarshalException)1 Marshaller (org.exolab.castor.xml.Marshaller)1 Unmarshaller (org.exolab.castor.xml.Unmarshaller)1