Search in sources :

Example 1 with XmlOffshoot

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

the class XmlComponentClientTest method testOffshootJ.

public void testOffshootJ() throws Exception {
    XmlOffshoot shoot = xmlComponent.getOffshoot();
    assertNotNull(shoot);
    XmlOffshootJ shootJ = getContainerServices().getTransparentXmlWrapper(XmlOffshootJ.class, shoot, XmlOffshootOperations.class);
    assertNotNull(shootJ);
    assertNotNull(shootJ.getObsProposal());
    assertNotNull(shootJ.getSchedBlock());
    // these values are hardcoded in the m_offshoot implementation
    ObsProposal obsProposal = shootJ.getObsProposal();
    assertEquals("rtobar", obsProposal.getPI());
    assertEquals("2010.0045.34S", obsProposal.getCode());
    assertEquals("just for fun", obsProposal.getScientificJustification());
    SchedBlock sb = shootJ.getSchedBlock();
    assertEquals("holography", sb.getName());
    assertEquals("DONE", sb.getStatus());
    assertEquals(true, sb.getStandardMode());
    // deactivate the m_offshoot on the server-side
    xmlComponent.deactivateOffshoot();
    try {
        shootJ.getObsProposal();
        fail("m_offshoot should be deactivated, I shouldn't be able to use it");
    } catch (org.omg.CORBA.OBJECT_NOT_EXIST e) {
    }
}
Also used : ObsProposal(alma.xmljbind.test.obsproposal.ObsProposal) SchedBlock(alma.xmljbind.test.schedblock.SchedBlock) XmlOffshoot(alma.demo.XmlOffshoot) XmlOffshootJ(alma.demo.XmlOffshootJ)

Example 2 with XmlOffshoot

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

the class ComponentWithXmlOffshootClientTest method testOffshootJ.

public void testOffshootJ() throws Exception {
    XmlOffshoot shoot = componentWithXmlOffshoot.getOffshoot();
    assertNotNull(shoot);
    XmlOffshootJ shootJ = getContainerServices().getTransparentXmlWrapper(XmlOffshootJ.class, shoot, XmlOffshootOperations.class);
    assertNotNull(shootJ);
    assertNotNull(shootJ.getObsProposal());
    assertNotNull(shootJ.getSchedBlock());
    // these values are hardcoded in the m_offshoot implementation
    ObsProposal obsProposal = shootJ.getObsProposal();
    assertEquals("rtobar", obsProposal.getPI());
    assertEquals("2010.0045.34S", obsProposal.getCode());
    assertEquals("just for fun", obsProposal.getScientificJustification());
    SchedBlock sb = shootJ.getSchedBlock();
    assertEquals("holography", sb.getName());
    assertEquals("DONE", sb.getStatus());
    assertEquals(true, sb.getStandardMode());
    // deactivate the m_offshoot on the server-side
    componentWithXmlOffshoot.deactivateOffshoot();
    try {
        shootJ.getObsProposal();
        fail("m_offshoot should be deactivated, I shouldn't be able to use it");
    } catch (org.omg.CORBA.OBJECT_NOT_EXIST e) {
    }
}
Also used : ObsProposal(alma.xmljbind.test.obsproposal.ObsProposal) SchedBlock(alma.xmljbind.test.schedblock.SchedBlock) ComponentWithXmlOffshoot(alma.demo.ComponentWithXmlOffshoot) XmlOffshoot(alma.demo.XmlOffshoot) ComponentWithXmlOffshootJ(alma.demo.ComponentWithXmlOffshootJ) XmlOffshootJ(alma.demo.XmlOffshootJ)

Example 3 with XmlOffshoot

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

the class ComponentWithXmlOffshootClientTest method testOffshoot.

public void testOffshoot() throws Exception {
    DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    XmlOffshoot shoot = componentWithXmlOffshoot.getOffshoot();
    assertNotNull(shoot.getObsProposal());
    assertNotNull(shoot.getSchedBlock());
    // these values are hardcoded in the m_offshoot implementation
    XmlEntityStruct struct = shoot.getObsProposal();
    Document d = db.parse(new InputSource(new CharArrayReader(struct.xmlString.toCharArray())));
    assertEquals("rtobar", d.getElementsByTagName("PI").item(0).getTextContent());
    assertEquals("2010.0045.34S", d.getElementsByTagName("code").item(0).getTextContent());
    assertEquals("just for fun", d.getElementsByTagName("ScientificJustification").item(0).getTextContent());
    struct = shoot.getSchedBlock();
    d = db.parse(new InputSource(new CharArrayReader(struct.xmlString.toCharArray())));
    assertEquals("holography", d.getElementsByTagName("ns2:name").item(0).getTextContent());
    assertEquals("DONE", d.getElementsByTagName("ns1:status").item(0).getTextContent());
    assertEquals("true", d.getElementsByTagName("StandardMode").item(0).getTextContent());
    // just to check the setters
    shoot.setObsProposal(new XmlEntityStruct());
    shoot.setSchedBlock(new XmlEntityStruct());
    // deactivate the m_offshoot on the server-side
    componentWithXmlOffshoot.deactivateOffshoot();
    try {
        shoot.getObsProposal();
        fail("m_offshoot should be deactivated, I shouldn't be able to use it");
    } catch (org.omg.CORBA.OBJECT_NOT_EXIST e) {
    }
}
Also used : InputSource(org.xml.sax.InputSource) CharArrayReader(java.io.CharArrayReader) DocumentBuilder(javax.xml.parsers.DocumentBuilder) XmlEntityStruct(alma.xmlentity.XmlEntityStruct) ComponentWithXmlOffshoot(alma.demo.ComponentWithXmlOffshoot) XmlOffshoot(alma.demo.XmlOffshoot) Document(org.w3c.dom.Document)

Example 4 with XmlOffshoot

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

the class XmlComponentClientTest method testOffshoot.

public void testOffshoot() throws Exception {
    DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    XmlOffshoot shoot = xmlComponent.getOffshoot();
    assertNotNull(shoot.getObsProposal());
    assertNotNull(shoot.getSchedBlock());
    // these values are hardcoded in the m_offshoot implementation
    XmlEntityStruct struct = shoot.getObsProposal();
    Document d = db.parse(new InputSource(new CharArrayReader(struct.xmlString.toCharArray())));
    assertEquals("rtobar", d.getElementsByTagName("PI").item(0).getTextContent());
    assertEquals("2010.0045.34S", d.getElementsByTagName("code").item(0).getTextContent());
    assertEquals("just for fun", d.getElementsByTagName("ScientificJustification").item(0).getTextContent());
    struct = shoot.getSchedBlock();
    d = db.parse(new InputSource(new CharArrayReader(struct.xmlString.toCharArray())));
    assertEquals("holography", d.getElementsByTagName("ns2:name").item(0).getTextContent());
    assertEquals("DONE", d.getElementsByTagName("ns1:status").item(0).getTextContent());
    assertEquals("true", d.getElementsByTagName("StandardMode").item(0).getTextContent());
    // just to check the setters
    shoot.setObsProposal(new XmlEntityStruct());
    shoot.setSchedBlock(new XmlEntityStruct());
    // deactivate the m_offshoot on the server-side
    xmlComponent.deactivateOffshoot();
    try {
        shoot.getObsProposal();
        fail("m_offshoot should be deactivated, I shouldn't be able to use it");
    } catch (org.omg.CORBA.OBJECT_NOT_EXIST e) {
    }
}
Also used : InputSource(org.xml.sax.InputSource) CharArrayReader(java.io.CharArrayReader) DocumentBuilder(javax.xml.parsers.DocumentBuilder) XmlEntityStruct(alma.xmlentity.XmlEntityStruct) XmlOffshoot(alma.demo.XmlOffshoot) Document(org.w3c.dom.Document)

Aggregations

XmlOffshoot (alma.demo.XmlOffshoot)4 ComponentWithXmlOffshoot (alma.demo.ComponentWithXmlOffshoot)2 XmlOffshootJ (alma.demo.XmlOffshootJ)2 XmlEntityStruct (alma.xmlentity.XmlEntityStruct)2 ObsProposal (alma.xmljbind.test.obsproposal.ObsProposal)2 SchedBlock (alma.xmljbind.test.schedblock.SchedBlock)2 CharArrayReader (java.io.CharArrayReader)2 DocumentBuilder (javax.xml.parsers.DocumentBuilder)2 Document (org.w3c.dom.Document)2 InputSource (org.xml.sax.InputSource)2 ComponentWithXmlOffshootJ (alma.demo.ComponentWithXmlOffshootJ)1