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) {
}
}
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
}
}
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) {
}
}
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;
}
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);
}
Aggregations