use of alma.xmljbind.test.obsproposal.ObsProposalRefT in project ACS by ACS-Community.
the class TestEntityFactory method getObsProject.
ObsProject getObsProject() {
ObsProject proj = null;
proj = new ObsProject();
ObsProjectEntityT entity = new ObsProjectEntityT();
proj.setObsProjectEntity(entity);
entity.setEntityId("uid://X1230000000000000/X00000001");
entity.setSchemaVersion("1.0");
ObsProposalRefT ref = new ObsProposalRefT();
proj.setObsProposalRef(ref);
ref.setEntityId("uid://X1230000000000000/X00000002");
ObsProgramT prog = new ObsProgramT();
proj.setObsProgram(prog);
ObsUnitSetT obsPlan = new ObsUnitSetT();
prog.setObsPlan(obsPlan);
ObsUnitSetTChoice choice = new ObsUnitSetTChoice();
obsPlan.setObsUnitSetTChoice(choice);
SchedBlockRefT schedBlockRef1 = new SchedBlockRefT();
choice.addSchedBlockRef(schedBlockRef1);
schedBlockRef1.setEntityId("uid://X1230000000000000/X00000003");
return proj;
}
use of alma.xmljbind.test.obsproposal.ObsProposalRefT in project ACS by ACS-Community.
the class EntityRefFinderTest method testObsProject.
public void testObsProject() throws Throwable {
ObsProject proj = m_entityFactory.getObsProject();
EntityRefT[] refs = m_entityRefFinder.findEntityReferences(proj);
assertNotNull(refs);
EntityRefT[] knownRefs = m_entityFactory.getReferencesInObsProject(proj);
assertTrue("correct number of entity references", (refs.length == knownRefs.length));
for (int i = 0; i < refs.length; i++) {
assertNotNull("ref not null", refs[i]);
assertTrue(refs[i] == knownRefs[i]);
}
// for manual inspection of output
if (refs.length > 0 && (refs[0] instanceof ObsProposalRefT)) {
StringWriter writer = new StringWriter();
refs[0].marshal(writer);
String serializedObsProposalRef = writer.toString();
System.out.println("serialized ObsProposalRefT object:");
System.out.println(serializedObsProposalRef);
ObsProposalRefT recreatedRef = ObsProposalRefT.unmarshalObsProposalRefT(new StringReader(serializedObsProposalRef));
writer = new StringWriter();
System.out.println("recreated and reserialized ObsProposalRefT:");
recreatedRef.marshal(writer);
String reserializedObsProposalRef = writer.toString();
System.out.println(reserializedObsProposalRef);
}
// assertTrue("reference to ObsProject", refs[0] instanceof ObsProjectRefT);
// String projId = ((ObsProjectRefT) refs[0]).getEntityId();
// assertEquals("correct id", "dummyObsProjectId", projId);
}
Aggregations