Search in sources :

Example 1 with ObsProposal

use of alma.xmljbind.test.obsproposal.ObsProposal in project ACS by ACS-Community.

the class XmlComponentClient method testCreateObsProposal.

/**
	 * Makes sure the obs proposal exists and checks its entity id.
	 */
public void testCreateObsProposal() {
    ObsProposal obsProp = m_xmlCompJ.createObsProposal();
    assertNotNull(obsProp);
    EntityT ent = obsProp.getObsProposalEntity();
    assertNotNull(ent);
    String id = ent.getEntityId();
    assertNotNull(id);
    System.out.println("received ObsProposal with id " + id);
}
Also used : EntityT(alma.entities.commonentity.EntityT) ObsProposal(alma.xmljbind.test.obsproposal.ObsProposal)

Example 2 with ObsProposal

use of alma.xmljbind.test.obsproposal.ObsProposal in project ACS by ACS-Community.

the class XmlComponentImpl method createObsProposal.

/**
	 * from IDL: <code>ObsProposal createObsProposal();</code>
	 * 
	 * @see alma.demo.XmlComponentJ#createObsProposal()
	 */
public ObsProposal createObsProposal() {
    ObsProposal obsProp = new ObsProposal();
    try {
        ObsProposalEntityT entity = new ObsProposalEntityT();
        m_containerServices.assignUniqueEntityId(entity);
        obsProp.setObsProposalEntity(entity);
        obsProp.setScientificJustification("peak performance enduring a 24-7-365 schedule.");
    } catch (AcsJContainerServicesEx e) {
        m_logger.log(Level.SEVERE, "failed to create ObsProposal. ", e);
    }
    return obsProp;
}
Also used : ObsProposalEntityT(alma.xmljbind.test.obsproposal.ObsProposalEntityT) ObsProposal(alma.xmljbind.test.obsproposal.ObsProposal) AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx)

Example 3 with ObsProposal

use of alma.xmljbind.test.obsproposal.ObsProposal 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 4 with ObsProposal

use of alma.xmljbind.test.obsproposal.ObsProposal in project ACS by ACS-Community.

the class UnmarshalTest method testUnmarshalObsProposal.

public void testUnmarshalObsProposal() throws Exception {
    ObsProposal oprop = unm.unmarshalObsProposal("ObsProposal1.xml");
    oprop.validate();
    assertEquals("uid://x0/x1/x2", oprop.getObsProposalEntity().getEntityId());
    assertEquals("Pretty damn stable", oprop.getObsPlan().getPreconditions().getWeatherConstraints().getPhaseStability());
    oprop.getDateReceived();
}
Also used : ObsProposal(alma.xmljbind.test.obsproposal.ObsProposal)

Example 5 with ObsProposal

use of alma.xmljbind.test.obsproposal.ObsProposal in project ACS by ACS-Community.

the class XmlInOut method unmarshalObsProposal.

public ObsProposal unmarshalObsProposal(String xmlFileName) throws FileNotFoundException, MarshalException, ValidationException {
    File xmlFile = new File(module_dir, pathToXmlSamples + xmlFileName);
    Reader xmlReader = new FileReader(xmlFile);
    Unmarshaller unm = new Unmarshaller(ObsProposal.class);
    unm.setValidation(false);
    ObsProposal oprop = (ObsProposal) unm.unmarshal(xmlReader);
    return oprop;
}
Also used : FileReader(java.io.FileReader) Reader(java.io.Reader) ObsProposal(alma.xmljbind.test.obsproposal.ObsProposal) FileReader(java.io.FileReader) Unmarshaller(org.exolab.castor.xml.Unmarshaller) File(java.io.File)

Aggregations

ObsProposal (alma.xmljbind.test.obsproposal.ObsProposal)11 SchedBlock (alma.xmljbind.test.schedblock.SchedBlock)3 XmlOffshoot (alma.demo.XmlOffshoot)2 XmlOffshootJ (alma.demo.XmlOffshootJ)2 EntityT (alma.entities.commonentity.EntityT)2 ObsProposalEntityT (alma.xmljbind.test.obsproposal.ObsProposalEntityT)2 AcsJContainerServicesEx (alma.JavaContainerError.wrappers.AcsJContainerServicesEx)1 ComponentWithXmlOffshoot (alma.demo.ComponentWithXmlOffshoot)1 ComponentWithXmlOffshootJ (alma.demo.ComponentWithXmlOffshootJ)1 SchedBlockHolder (alma.demo.SchedBlockHolder)1 EntityRefT (alma.entities.commonentity.EntityRefT)1 ObsProjectRefT (alma.xmljbind.test.obsproject.ObsProjectRefT)1 File (java.io.File)1 FileReader (java.io.FileReader)1 Reader (java.io.Reader)1 Unmarshaller (org.exolab.castor.xml.Unmarshaller)1