Commit eed72fcc authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

Finalized writing of NDM composite files.

parent 88b1dca4
......@@ -21,6 +21,9 @@
</properties>
<body>
<release version="11.0" date="TBD" description="TBD">
<action dev="luc" type="add">
Added support for reading and writing CCSDS NDM composite messages.
</action>
<action dev="luc" type="fix" issue="776">
Fixed associativity in units parsing.
</action>
......
......@@ -79,24 +79,7 @@ public class NdmWriter {
// write the constituents
for (final NdmConstituent<?, ?> constituent : message.getConstituents()) {
if (constituent instanceof TdmFile) {
writeTdmConstituent(generator, (TdmFile) constituent);
} else if (constituent instanceof OpmFile) {
writeOpmConstituent(generator, (OpmFile) constituent);
} else if (constituent instanceof OmmFile) {
writeOmmConstituent(generator, (OmmFile) constituent);
} else if (constituent instanceof OemFile) {
writeOemConstituent(generator, (OemFile) constituent);
} else if (constituent instanceof OcmFile) {
writeOcmConstituent(generator, (OcmFile) constituent);
} else if (constituent instanceof ApmFile) {
writeApmConstituent(generator, (ApmFile) constituent);
} else if (constituent instanceof AemFile) {
writeAemConstituent(generator, (AemFile) constituent);
} else {
// this should never happen
throw new OrekitInternalError(null);
}
writeConstituent(generator, constituent);
}
}
......@@ -135,75 +118,56 @@ public class NdmWriter {
}
/** Write a TDM constituent.
* @param generator generator to use for producing output
* @param tdmConstituent TDM constituent
*/
public void writeTdmConstituent(final Generator generator, final TdmFile tdmConstituent) throws IOException {
writeConstituent(generator, builder.buildTdmWriter(), tdmConstituent);
}
/** Write an OPM constituent.
* @param generator generator to use for producing output
* @param opmConstituent OPM constituent
*/
public void writeOpmConstituent(final Generator generator, final OpmFile opmConstituent) throws IOException {
writeConstituent(generator, builder.buildOpmWriter(), opmConstituent);
}
/** Write an OMM constituent.
/** Write a constituent.
* @param generator generator to use for producing output
* @param ommConstituent OMM constituent
* @param constituent constituent
* @param <H> type of the header
* @param <S> type of the segments
* @param <F> type of the file
*/
public void writeOmmConstituent(final Generator generator, final OmmFile ommConstituent) throws IOException {
writeConstituent(generator, builder.buildOmmWriter(), ommConstituent);
}
public <H extends Header, S extends Segment<?, ?>, F extends NdmConstituent<H, S>>
void writeConstituent(final Generator generator, final F constituent) throws IOException {
/** Write an OEM constituent.
* @param generator generator to use for producing output
* @param oemConstituent TDM constituent
*/
public void writeOemConstituent(final Generator generator, final OemFile oemConstituent) throws IOException {
writeConstituent(generator, builder.buildOemWriter(), oemConstituent);
}
// write the root element if needed
startMessageIfNeeded(generator);
/** Write an OCM constituent.
* @param generator generator to use for producing output
* @param ocmConstituent OCM constituent
*/
public void writeOcmConstituent(final Generator generator, final OcmFile ocmConstituent) throws IOException {
writeConstituent(generator, builder.buildOcmWriter(), ocmConstituent);
}
// write the constituent
final MessageWriter<H, S, F> writer = buildWriter(constituent);
writer.writeMessage(generator, constituent);
/** Write an APM constituent.
* @param generator generator to use for producing output
* @param apmConstituent APM constituent
*/
public void writeApmConstituent(final Generator generator, final ApmFile apmConstituent) throws IOException {
writeConstituent(generator, builder.buildApmWriter(), apmConstituent);
}
// update count
++count;
/** Write an AEM constituent.
* @param generator generator to use for producing output
* @param aemConstituent AEM constituent
*/
public void writeAemConstituent(final Generator generator, final AemFile aemConstituent) throws IOException {
writeConstituent(generator, builder.buildAemWriter(), aemConstituent);
}
/** Write a constituent.
* @param generator generator to use for producing output
* @param writer writer for the constituent
/** Build writer for a constituent.
* @param constituent constituent
* @param <H> type of the header
* @param <S> type of the segments
* @param <F> type of the file
* @return writer suited for the constituent
*/
@SuppressWarnings("unchecked")
private <H extends Header, S extends Segment<?, ?>, F extends NdmConstituent<H, S>>
void writeConstituent(final Generator generator, final MessageWriter<H, S, F> writer,
final F constituent) throws IOException {
startMessageIfNeeded(generator);
writer.writeMessage(generator, constituent);
MessageWriter<H, S, F> buildWriter(final F constituent) throws IOException {
if (constituent instanceof TdmFile) {
return (MessageWriter<H, S, F>) builder.buildTdmWriter();
} else if (constituent instanceof OpmFile) {
return (MessageWriter<H, S, F>) builder.buildOpmWriter();
} else if (constituent instanceof OmmFile) {
return (MessageWriter<H, S, F>) builder.buildOmmWriter();
} else if (constituent instanceof OemFile) {
return (MessageWriter<H, S, F>) builder.buildOemWriter();
} else if (constituent instanceof OcmFile) {
return (MessageWriter<H, S, F>) builder.buildOcmWriter();
} else if (constituent instanceof ApmFile) {
return (MessageWriter<H, S, F>) builder.buildApmWriter();
} else if (constituent instanceof AemFile) {
return (MessageWriter<H, S, F>) builder.buildAemWriter();
} else {
// this should never happen
throw new OrekitInternalError(null);
}
}
}
......@@ -192,7 +192,7 @@ discrete events. Here is a short list of the features offered by the library:</p
GLONASS, GALILEO, BEIDOU (GEO, IGSO, MEO)</li>
</ul>
</li>
<li>loading of CCSDS Attitude Data Messages (both AEM, and APM types are supported)</li>
<li>loading and writing of CCSDS Attitude Data Messages (both AEM, and APM types are supported, in both KVN and XML formats, standalone or in combined NDM)</li>
</ul>
</li>
<li>Orbit determination
......@@ -241,6 +241,7 @@ discrete events. Here is a short list of the features offered by the library:</p
</li>
<li>possibility to add custom measurements</li>
<li>loading of ILRS CRD laser ranging measurements file</li>
<li>loading and writing of CCSDS Tracking Data Messages (in both KVN and XML formats, standalone or in combined NDM)</li>
<li>several predefined modifiers
<ul>
<li>tropospheric effects</li>
......@@ -288,7 +289,7 @@ discrete events. Here is a short list of the features offered by the library:</p
<li>Orbit file handling
<ul>
<li>loading of SP3 orbit files (from versions a to d)</li>
<li>loading of CCSDS Orbit Data Messages (both OPM, OEM, and OMM types are supported)</li>
<li>loading and writing of CCSDS Orbit Data Messages (both OPM, OEM, OMM, OCM types are supported, in both KVN and XML formats, standalone or in combined NDM)</li>
<li>loading of SEM and YUMA files for GPS constellation</li>
<li>exporting of ephemeris in CCSDS OEM file format</li>
<li>loading of ILRS CPF orbit files</li>
......
......@@ -165,7 +165,7 @@
* space referenced attitudes (inertial, celestial body-pointed, spin-stabilized)
* tabulated attitudes, either respective to inertial frame or respective to Local Orbital Frames
* specific law for GNSS satellites: GPS (block IIA, block IIF, block IIF), GLONASS, GALILEO, BEIDOU (GEO, IGSO, MEO)
* loading of CCSDS Attitude Data Messages (both AEM, and APM types are supported)
* loading and writing of CCSDS Attitude Data Messages (both AEM, and APM types are supported, in both KVN and XML formats, standalone or in combined NDM)
* Orbit determination
......@@ -203,6 +203,7 @@
* multiplexed
* possibility to add custom measurements
* loading of ILRS CRD laser ranging measurements file
* loading and writing of CCSDS Tracking Data Messages (in both KVN and XML formats, standalone or in combined NDM)
* several predefined modifiers
* tropospheric effects
* ionospheric effects
......@@ -241,7 +242,7 @@
* Orbit file handling
* loading of SP3 orbit files (from version a to d)
* loading of CCSDS Orbit Data Messages (both OPM, OEM, and OMM types are supported)
* loading and writing of CCSDS Orbit Data Messages (both OPM, OEM, OMM and OCM types are supported, in both KVN and XML formats, standalone or in combined NDM)
* loading of SEM and YUMA files for GPS constellation
* exporting of ephemeris in CCSDS OEM file format
* loading of ILRS CPF orbit files
......
......@@ -57,11 +57,12 @@ public abstract class AbstractWriterTest<H extends Header, S extends Segment<?,
final F original = getParser().parseMessage(source1);
// write the parsed file back to a characters array
final CharArrayWriter caw = new CharArrayWriter();
final Generator generator = format == FileFormat.KVN ?
new KvnGenerator(caw, 25, "dummy.kvn", unitsColumn) :
new XmlGenerator(caw, XmlGenerator.DEFAULT_INDENT, "dummy.xml", unitsColumn > 0);
getWriter().writeMessage(generator, original);
final CharArrayWriter caw = new CharArrayWriter();
try (Generator generator = format == FileFormat.KVN ?
new KvnGenerator(caw, 25, "dummy.kvn", unitsColumn) :
new XmlGenerator(caw, XmlGenerator.DEFAULT_INDENT, "dummy.xml", unitsColumn > 0)) {
getWriter().writeMessage(generator, original);
}
// reparse the written file
final byte[] bytes = caw.toString().getBytes(StandardCharsets.UTF_8);
......
......@@ -29,6 +29,7 @@ import org.hipparchus.linear.RealMatrix;
import org.hipparchus.util.FastMath;
import org.hipparchus.util.Precision;
import org.junit.Assert;
import org.orekit.data.DataContext;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
import org.orekit.files.ccsds.definitions.BodyFacade;
......@@ -36,15 +37,20 @@ import org.orekit.files.ccsds.definitions.FrameFacade;
import org.orekit.files.ccsds.definitions.OdMethodFacade;
import org.orekit.files.ccsds.definitions.SpacecraftBodyFrame;
import org.orekit.files.ccsds.ndm.adm.AttitudeEndoints;
import org.orekit.files.ccsds.ndm.adm.aem.AemSatelliteEphemeris;
import org.orekit.files.ccsds.ndm.adm.apm.ApmQuaternion;
import org.orekit.files.ccsds.ndm.odm.ocm.Covariance;
import org.orekit.files.ccsds.ndm.odm.ocm.CovarianceHistory;
import org.orekit.files.ccsds.ndm.odm.ocm.Maneuver;
import org.orekit.files.ccsds.ndm.odm.ocm.ManeuverHistory;
import org.orekit.files.ccsds.ndm.odm.ocm.OcmSatelliteEphemeris;
import org.orekit.files.ccsds.ndm.odm.ocm.OrbitState;
import org.orekit.files.ccsds.ndm.odm.ocm.OrbitStateHistory;
import org.orekit.files.ccsds.ndm.odm.oem.OemSatelliteEphemeris;
import org.orekit.files.ccsds.ndm.tdm.Observation;
import org.orekit.files.ccsds.section.CommentsContainer;
import org.orekit.files.ccsds.section.Section;
import org.orekit.files.ccsds.section.Segment;
import org.orekit.frames.Frame;
import org.orekit.time.AbsoluteDate;
import org.orekit.utils.AngularCoordinates;
......@@ -89,17 +95,23 @@ public class NdmTestUtils {
} else if (original instanceof Map) {
checkMap((Map<?, ?>) original, (Map<?, ?>) rebuilt);
return true;
} else if (original instanceof CommentsContainer ||
original instanceof ApmQuaternion ||
original instanceof AttitudeEndoints ||
original instanceof CovarianceHistory ||
original instanceof ManeuverHistory ||
original instanceof OrbitState ||
original instanceof Covariance ||
original instanceof Maneuver ||
original instanceof Observation ||
original instanceof SpacecraftBodyFrame ||
original instanceof PVCoordinates ||
} else if (original instanceof NdmConstituent ||
original instanceof Segment ||
original instanceof Section ||
original instanceof CommentsContainer ||
original instanceof ApmQuaternion ||
original instanceof AttitudeEndoints ||
original instanceof OcmSatelliteEphemeris ||
original instanceof OemSatelliteEphemeris ||
original instanceof AemSatelliteEphemeris ||
original instanceof CovarianceHistory ||
original instanceof ManeuverHistory ||
original instanceof OrbitState ||
original instanceof Covariance ||
original instanceof Maneuver ||
original instanceof Observation ||
original instanceof SpacecraftBodyFrame ||
original instanceof PVCoordinates ||
original instanceof AngularCoordinates) {
checkContainer(original, rebuilt);
return true;
......@@ -115,6 +127,8 @@ public class NdmTestUtils {
} else if (original instanceof OrbitStateHistory) {
checkOrbitStateHistory((OrbitStateHistory) original, (OrbitStateHistory) rebuilt);
return true;
} else if (original instanceof DataContext) {
return true;
} else if (original instanceof Frame) {
checkFrame((Frame) original, (Frame) rebuilt);
return true;
......@@ -146,21 +160,24 @@ public class NdmTestUtils {
Assert.assertEquals(original.getClass(), rebuilt.getClass());
final Class<?> cls = original.getClass();
Stream.of(cls.getMethods()).
filter(m -> m.getName().startsWith("get") &&
!m.getName().equals("getClass") &&
!m.getName().equals("getPropagator") &&
!m.getName().equals("getLaunchYear") &&
!m.getName().equals("getLaunchNumber") &&
!m.getName().equals("getLaunchPiece") &&
filter(m -> m.getName().startsWith("get") &&
!m.getName().equals("getClass") &&
!m.getName().equals("getPropagator") &&
!m.getName().equals("getLaunchYear") &&
!m.getName().equals("getLaunchNumber") &&
!m.getName().equals("getLaunchPiece") &&
!m.getName().equals("getAttitudeProvider") &&
m.getParameterCount() == 0).
forEach(getter -> {
try {
Assert.assertTrue(recurseCheck(getter.invoke(original), getter.invoke(rebuilt)));
} catch (InvocationTargetException e) {
if (!(getter.getName().equals("getFrame") &&
if (!((getter.getName().equals("getFrame") ||
getter.getName().equals("getReferenceFrame") ||
getter.getName().equals("getInertialFrame")) &&
e.getCause() instanceof OrekitException &&
((OrekitException) e.getCause()).getSpecifier() ==
OrekitMessages.NO_DATA_LOADED_FOR_CELESTIAL_BODY)) {
(((OrekitException) e.getCause()).getSpecifier() == OrekitMessages.NO_DATA_LOADED_FOR_CELESTIAL_BODY ||
((OrekitException) e.getCause()).getSpecifier() == OrekitMessages.CCSDS_INVALID_FRAME))) {
Assert.fail(e.getCause().getLocalizedMessage());
}
} catch (IllegalAccessException | IllegalArgumentException e) {
......
......@@ -20,7 +20,13 @@ import java.io.ByteArrayInputStream;
import java.io.CharArrayWriter;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.hipparchus.geometry.euclidean.threed.Vector3D;
import org.hipparchus.random.RandomGenerator;
import org.hipparchus.random.Well19937a;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
......@@ -28,13 +34,11 @@ import org.orekit.Utils;
import org.orekit.data.DataSource;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
import org.orekit.files.ccsds.ndm.adm.apm.ApmFile;
import org.orekit.files.ccsds.ndm.odm.ocm.OcmFile;
import org.orekit.files.ccsds.ndm.odm.opm.OpmFile;
import org.orekit.files.ccsds.utils.FileFormat;
import org.orekit.files.ccsds.utils.generation.Generator;
import org.orekit.files.ccsds.utils.generation.KvnGenerator;
import org.orekit.files.ccsds.utils.generation.XmlGenerator;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeScalesFactory;
import org.orekit.utils.Constants;
/**
* Test class for CCSDS Navigation Data Message writing.<p>
......@@ -52,11 +56,11 @@ public class NdmWriterTest {
final String name = "/ccsds/ndm/NDM-opm.xml";
final DataSource source = new DataSource(name, () -> NdmWriterTest.class.getResourceAsStream(name));
final NdmFile ndm = new ParserBuilder().buildNdmParser().parseMessage(source);
final NdmWriter writer = new WriterBuilder().buildNdmWriter();
final CharArrayWriter caw = new CharArrayWriter();
try (Generator generator = new XmlGenerator(caw, XmlGenerator.DEFAULT_INDENT, "dummy.xml", true)) {
new WriterBuilder().buildNdmWriter().writeMessage(generator, ndm);
writer.writeMessage(generator, ndm);
}
System.out.println(caw.toString());
final byte[] bytes = caw.toString().getBytes(StandardCharsets.UTF_8);
final DataSource source2 = new DataSource(name, () -> new ByteArrayInputStream(bytes));
NdmTestUtils.checkContainer(ndm, new ParserBuilder().buildNdmParser().parseMessage(source2));
......@@ -67,13 +71,164 @@ public class NdmWriterTest {
final String name = "/ccsds/ndm/NDM-ocm-apm.xml";
final DataSource source = new DataSource(name, () -> NdmWriterTest.class.getResourceAsStream(name));
final NdmFile ndm = new ParserBuilder().buildNdmParser().parseMessage(source);
final NdmWriter writer = new WriterBuilder().buildNdmWriter();
final CharArrayWriter caw = new CharArrayWriter();
try (final Generator generator = new XmlGenerator(caw, XmlGenerator.DEFAULT_INDENT, "dummy.xml", true)) {
new WriterBuilder().buildNdmWriter().writeMessage(generator, ndm);
writer.writeMessage(generator, ndm);
}
final byte[] bytes = caw.toString().getBytes(StandardCharsets.UTF_8);
final DataSource source2 = new DataSource(name, () -> new ByteArrayInputStream(bytes));
NdmTestUtils.checkContainer(ndm, new ParserBuilder().buildNdmParser().parseMessage(source2));
}
@Test
public void testMisplacedComments() throws IOException {
final String name = "/ccsds/ndm/NDM-opm.xml";
final DataSource source = new DataSource(name, () -> NdmWriterTest.class.getResourceAsStream(name));
final NdmFile ndm = new ParserBuilder().buildNdmParser().parseMessage(source);
final NdmWriter writer = new WriterBuilder().buildNdmWriter();
final CharArrayWriter caw = new CharArrayWriter();
try (final Generator generator = new XmlGenerator(caw, XmlGenerator.DEFAULT_INDENT, "dummy.xml", true)) {
for (final String comment : ndm.getComments()) {
writer.writeComment(generator, comment);
}
for (final NdmConstituent<?, ?> constituent : ndm.getConstituents()) {
writer.writeConstituent(generator, constituent);
}
try {
writer.writeComment(generator, "we are not allowed to put comments after constituents");
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.ATTEMPT_TO_GENERATE_MALFORMED_FILE, oe.getSpecifier());
Assert.assertEquals("dummy.xml", oe.getParts()[0]);
}
}
}
@Test
public void testRandomizedNdm() throws IOException {
final ParserBuilder pb = new ParserBuilder().
withParsedUnitsBehavior(ParsedUnitsBehavior.STRICT_COMPLIANCE).
withSpinAxis(Vector3D.PLUS_I).
withMu(Constants.EIGEN5C_EARTH_MU).
withMissionReferenceDate(new AbsoluteDate("1996-12-17T00:00:00.000", TimeScalesFactory.getUTC()));
final WriterBuilder wb = new WriterBuilder().
withSpinAxis(pb.getSpinAxis()).
withMissionReferenceDate(pb.getMissionReferenceDate());
// pool of constituents
List<NdmConstituent<?, ?>> pool = buildPool(pb);
RandomGenerator random = new Well19937a(0x4a21ffc6d5b7dbe6l);
for (int i = 0; i < 10; ++i) {
final String[] comments = new String[random.nextInt(3)];
for (int k = 0; k < comments.length; ++k) {
comments[k] = Integer.toString(random.nextInt());
}
final NdmConstituent<?, ?>[] constituents = new NdmConstituent<?,?>[1 + random.nextInt(20)];
for (int k = 0; k < constituents.length; ++k) {
constituents[k] = pool.get(random.nextInt(pool.size()));
}
// create randomized NDM
final NdmFile original = new NdmFile(Arrays.asList(comments), Arrays.asList(constituents));
// write it
final CharArrayWriter caw = new CharArrayWriter();
try (final Generator generator = new XmlGenerator(caw, XmlGenerator.DEFAULT_INDENT, "dummy.xml", true)) {
wb.buildNdmWriter().writeMessage(generator, original);
}
// parse the written message back
final byte[] bytes = caw.toString().getBytes(StandardCharsets.UTF_8);
final DataSource source2 = new DataSource("dummy.xml", () -> new ByteArrayInputStream(bytes));
final NdmFile rebuilt = pb.buildNdmParser().parseMessage(source2);
// check we recovered the message properly
NdmTestUtils.checkContainer(original, rebuilt);
}
}
/** build a pool of NdmConstituent.
* @param builder builder for constituents parsers
* @return pool of NdmConstituen
*/
private List<NdmConstituent<?, ?>> buildPool(final ParserBuilder builder) {
final List<NdmConstituent<?, ?>> pool = new ArrayList<>();
// AEM files
for (final String name :
Arrays.asList("/ccsds/adm/aem/AEMExample01.txt", "/ccsds/adm/aem/AEMExample02.txt", "/ccsds/adm/aem/AEMExample03.txt",
"/ccsds/adm/aem/AEMExample03.xml", "/ccsds/adm/aem/AEMExample04.txt", "/ccsds/adm/aem/AEMExample05.txt",
"/ccsds/adm/aem/AEMExample07.txt", "/ccsds/adm/aem/AEMExample08.txt", "/ccsds/adm/aem/AEMExample09.txt",
"/ccsds/adm/aem/AEMExample10.txt", "/ccsds/adm/aem/AEMExample11.xml", "/ccsds/adm/aem/AEMExample12.txt",
"/ccsds/adm/aem/AEMExample13.xml")) {
final DataSource source = new DataSource(name, () -> NdmWriterTest.class.getResourceAsStream(name));
pool.add(builder.buildAemParser().parseMessage(source));
}
// APM files
for (final String name :
Arrays.asList("/ccsds/adm/apm/APMExample1.txt", "/ccsds/adm/apm/APMExample2.txt", "/ccsds/adm/apm/APMExample2.xml",
"/ccsds/adm/apm/APMExample3.txt", "/ccsds/adm/apm/APMExample4.txt", "/ccsds/adm/apm/APMExample5.txt",
"/ccsds/adm/apm/APMExample6.txt")) {
final DataSource source = new DataSource(name, () -> NdmWriterTest.class.getResourceAsStream(name));
pool.add(builder.buildApmParser().parseMessage(source));
}
// OCM files
for (final String name :
Arrays.asList("/ccsds/odm/ocm/OCMExample1.txt", "/ccsds/odm/ocm/OCMExample2.txt", "/ccsds/odm/ocm/OCMExample2.xml",
"/ccsds/odm/ocm/OCMExample3.txt", "/ccsds/odm/ocm/OCMExample4.txt")) {
final DataSource source = new DataSource(name, () -> NdmWriterTest.class.getResourceAsStream(name));
pool.add(builder.buildOcmParser().parseMessage(source));
}
// OEM files
for (final String name :
Arrays.asList("/ccsds/odm/oem/OEMExample1.txt", "/ccsds/odm/oem/OEMExample2.txt", "/ccsds/odm/oem/OEMExample3.txt",
"/ccsds/odm/oem/OEMExample3.xml", "/ccsds/odm/oem/OEMExample4.txt", "/ccsds/odm/oem/OEMExample5.txt",
"/ccsds/odm/oem/OEMExample6.txt", "/ccsds/odm/oem/OEMExample8.txt")) {
final DataSource source = new DataSource(name, () -> NdmWriterTest.class.getResourceAsStream(name));
pool.add(builder.buildOemParser().parseMessage(source));
}
// OMM files
for (final String name :
Arrays.asList("/ccsds/odm/omm/OMMExample1.txt", "/ccsds/odm/omm/OMMExample2.txt", "/ccsds/odm/omm/OMMExample2.xml",
"/ccsds/odm/omm/OMMExample3.txt", "/ccsds/odm/omm/OMMExample4.txt", "/ccsds/odm/omm/OMMExample4.xml")) {
final DataSource source = new DataSource(name, () -> NdmWriterTest.class.getResourceAsStream(name));
pool.add(builder.buildOmmParser().parseMessage(source));
}
// OPM files
for (final String name :
Arrays.asList("/ccsds/odm/opm/OPMExample1.txt", "/ccsds/odm/opm/OPMExample2.txt", "/ccsds/odm/opm/OPMExample3.txt",
"/ccsds/odm/opm/OPMExample3.xml", "/ccsds/odm/opm/OPMExample4.txt", "/ccsds/odm/opm/OPMExample5.txt",
"/ccsds/odm/opm/OPMExample6.txt", "/ccsds/odm/opm/OPMExample6.txt", "/ccsds/odm/opm/OPMExample8.txt")) {
final DataSource source = new DataSource(name, () -> NdmWriterTest.class.getResourceAsStream(name));
pool.add(builder.buildOpmParser().parseMessage(source));
}
// TDM files
for (final String name :
Arrays.asList("/ccsds/tdm/kvn/TDMExample15.txt", "/ccsds/tdm/kvn/TDMExample2.txt", "/ccsds/tdm/kvn/TDMExample4.txt",
"/ccsds/tdm/kvn/TDMExample6.txt", "/ccsds/tdm/kvn/TDMExample8.txt",
"/ccsds/tdm/xml/TDMExample15.xml", "/ccsds/tdm/xml/TDMExample2.xml", "/ccsds/tdm/xml/TDMExample4.xml",
"/ccsds/tdm/xml/TDMExample6.xml", "/ccsds/tdm/xml/TDMExample8.xml")) {
final DataSource source = new DataSource(name, () -> NdmWriterTest.class.getResourceAsStream(name));
pool.add(builder.buildTdmParser().parseMessage(source));
}
return pool;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment