Search in sources :

Example 1 with SchedBlock

use of alma.xmljbind.test.schedblock.SchedBlock 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 2 with SchedBlock

use of alma.xmljbind.test.schedblock.SchedBlock in project ACS by ACS-Community.

the class XmlComponentImpl method initialize.

/////////////////////////////////////////////////////////////
// Implementation of ComponentLifecycle 
// (only the parts we don't take from the default impl in ComponentImplBase)
/////////////////////////////////////////////////////////////
/**
	 * @see alma.acs.component.ComponentLifecycle#initialize(ContainerServices)
	 */
public void initialize(ContainerServices contServices) throws ComponentLifecycleException {
    super.initialize(contServices);
    m_schedBlockList = new ArrayList<SchedBlock>();
    try {
        // create a few (incomplete) SchedBlocks
        for (int sbCount = 0; sbCount < 10; sbCount++) {
            SchedBlock sb = new SchedBlock();
            SchedBlockEntityT entity = new SchedBlockEntityT();
            m_containerServices.assignUniqueEntityId(entity);
            sb.setSchedBlockEntity(entity);
            SchedBlockControlT sbCtrl = new SchedBlockControlT();
            sb.setSchedBlockControl(sbCtrl);
            sbCtrl.setRepeatCount(sbCount % 3);
            //				sbCtrl.setEntityPartId("X00000008"); // set this on an ObsUnitSet instead...
            m_schedBlockList.add(sb);
        }
    } catch (AcsJContainerServicesEx e) {
        m_logger.log(Level.WARNING, "failed to initialize list of SchedBlocks. ", e);
        m_schedBlockList.clear();
    //			throw new ComponentLifecycleException(e); // not required
    }
}
Also used : SchedBlockEntityT(alma.xmljbind.test.schedblock.SchedBlockEntityT) SchedBlock(alma.xmljbind.test.schedblock.SchedBlock) SchedBlockControlT(alma.xmljbind.test.schedblock.SchedBlockControlT) AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx)

Example 3 with SchedBlock

use of alma.xmljbind.test.schedblock.SchedBlock 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 SchedBlock

use of alma.xmljbind.test.schedblock.SchedBlock in project ACS by ACS-Community.

the class XmlComponentImpl method getBestSchedBlock.

/**
	 * @see alma.demo.XmlComponentJ#getBestSchedBlock()
	 */
public SchedBlock getBestSchedBlock() {
    SchedBlock sb = null;
    if (m_schedBlockList.size() > 0) {
        Random random = new Random(System.currentTimeMillis());
        int sbIndex = random.nextInt(m_schedBlockList.size());
        sb = m_schedBlockList.get(sbIndex);
    }
    return sb;
}
Also used : Random(java.util.Random) SchedBlock(alma.xmljbind.test.schedblock.SchedBlock)

Example 5 with SchedBlock

use of alma.xmljbind.test.schedblock.SchedBlock in project ACS by ACS-Community.

the class XmlComponentClient method testXmlInOutMethod.

public void testXmlInOutMethod() {
    ObsProposal obsProp = m_xmlCompJ.createObsProposal();
    assertNotNull(obsProp);
    SchedBlockHolder sbh = new SchedBlockHolder();
    m_xmlCompJ.xmlInOutMethod(obsProp, sbh);
    SchedBlock schedBlock = sbh.value;
    assertNotNull(schedBlock);
    EntityT ent = schedBlock.getSchedBlockEntity();
    assertNotNull(ent);
    String id = ent.getEntityId();
    assertNotNull(id);
    System.out.println("received out-param SchedBlock with id " + id);
}
Also used : EntityT(alma.entities.commonentity.EntityT) ObsProposal(alma.xmljbind.test.obsproposal.ObsProposal) SchedBlock(alma.xmljbind.test.schedblock.SchedBlock) SchedBlockHolder(alma.demo.SchedBlockHolder)

Aggregations

SchedBlock (alma.xmljbind.test.schedblock.SchedBlock)5 ObsProposal (alma.xmljbind.test.obsproposal.ObsProposal)3 XmlOffshoot (alma.demo.XmlOffshoot)2 XmlOffshootJ (alma.demo.XmlOffshootJ)2 AcsJContainerServicesEx (alma.JavaContainerError.wrappers.AcsJContainerServicesEx)1 ComponentWithXmlOffshoot (alma.demo.ComponentWithXmlOffshoot)1 ComponentWithXmlOffshootJ (alma.demo.ComponentWithXmlOffshootJ)1 SchedBlockHolder (alma.demo.SchedBlockHolder)1 EntityT (alma.entities.commonentity.EntityT)1 SchedBlockControlT (alma.xmljbind.test.schedblock.SchedBlockControlT)1 SchedBlockEntityT (alma.xmljbind.test.schedblock.SchedBlockEntityT)1 Random (java.util.Random)1