Search in sources :

Example 1 with ObsProposalRefT

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;
}
Also used : ObsUnitSetT(alma.xmljbind.test.obsproject.ObsUnitSetT) ObsUnitSetTChoice(alma.xmljbind.test.obsproject.ObsUnitSetTChoice) ObsProject(alma.xmljbind.test.obsproject.ObsProject) ObsProposalRefT(alma.xmljbind.test.obsproposal.ObsProposalRefT) ObsProjectEntityT(alma.xmljbind.test.obsproject.ObsProjectEntityT) SchedBlockRefT(alma.xmljbind.test.schedblock.SchedBlockRefT) ObsProgramT(alma.xmljbind.test.obsproject.ObsProgramT)

Example 2 with ObsProposalRefT

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);
}
Also used : StringWriter(java.io.StringWriter) ObsProject(alma.xmljbind.test.obsproject.ObsProject) StringReader(java.io.StringReader) ObsProposalRefT(alma.xmljbind.test.obsproposal.ObsProposalRefT) EntityRefT(alma.entities.commonentity.EntityRefT)

Aggregations

ObsProject (alma.xmljbind.test.obsproject.ObsProject)2 ObsProposalRefT (alma.xmljbind.test.obsproposal.ObsProposalRefT)2 EntityRefT (alma.entities.commonentity.EntityRefT)1 ObsProgramT (alma.xmljbind.test.obsproject.ObsProgramT)1 ObsProjectEntityT (alma.xmljbind.test.obsproject.ObsProjectEntityT)1 ObsUnitSetT (alma.xmljbind.test.obsproject.ObsUnitSetT)1 ObsUnitSetTChoice (alma.xmljbind.test.obsproject.ObsUnitSetTChoice)1 SchedBlockRefT (alma.xmljbind.test.schedblock.SchedBlockRefT)1 StringReader (java.io.StringReader)1 StringWriter (java.io.StringWriter)1