Commit 319835be authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

Removed argument to buildTdmParser.

The range units converter may be set up in a withRangeUnitsConverter
method before creating the parser.
parent 00450dd1
......@@ -25,13 +25,14 @@ import org.orekit.files.ccsds.ndm.odm.ocm.OcmParser;
import org.orekit.files.ccsds.ndm.odm.oem.OemParser;
import org.orekit.files.ccsds.ndm.odm.omm.OmmParser;
import org.orekit.files.ccsds.ndm.odm.opm.OpmParser;
import org.orekit.files.ccsds.ndm.tdm.IdentityConverter;
import org.orekit.files.ccsds.ndm.tdm.RangeUnits;
import org.orekit.files.ccsds.ndm.tdm.RangeUnitsConverter;
import org.orekit.files.ccsds.ndm.tdm.TdmParser;
import org.orekit.time.AbsoluteDate;
import org.orekit.utils.IERSConventions;
/** Builder for all {@link NdmFile CCSDS Message} files parsers.
/** Builder for all {@link NdmConstituent CCSDS Message} files parsers.
* <p>
* This builder can be used for building all CCSDS Messages parsers types.
* It is particularly useful in multi-threaded context as parsers cannot
......@@ -58,6 +59,9 @@ public class ParserBuilder extends AbstractBuilder<ParserBuilder> {
/** Behavior adopted for units that have been parsed from a CCSDS message. */
private final ParsedUnitsBehavior parsedUnitsBehavior;
/** Converter for {@link RangeUnits#RU Range Units}. */
private final RangeUnitsConverter rangeUnitsConverter;
/**
* Simple constructor.
* <p>
......@@ -71,6 +75,7 @@ public class ParserBuilder extends AbstractBuilder<ParserBuilder> {
* <li>{@link #getDefaultMass() default mass} set to {@code Double.NaN}</li>
* <li>{@link #getDefaultInterpolationDegree() default interpolation degree} set to {@code 1}</li>
* <li>{@link #getParsedUnitsBehavior() parsed unit behavior} set to {@link ParsedUnitsBehavior#CONVERT_COMPATIBLE}</li>
* <li>{@link #getRangeUnitsConverter() converter for range units} set to {@link IdentityConverter}</li>
* </ul>
* </p>
*/
......@@ -91,13 +96,14 @@ public class ParserBuilder extends AbstractBuilder<ParserBuilder> {
* <li>{@link #getDefaultMass() default mass} set to {@code Double.NaN}</li>
* <li>{@link #getDefaultInterpolationDegree() default interpolation degree} set to {@code 1}</li>
* <li>{@link #getParsedUnitsBehavior() parsed unit behavior} set to {@link ParsedUnitsBehavior#CONVERT_COMPATIBLE}</li>
* <li>{@link #getRangeUnitsConverter() converter for range units} set to {@link IdentityConverter}</li>
* </ul>
* </p>
* @param dataContext data context used to retrieve frames, time scales, etc.
*/
public ParserBuilder(final DataContext dataContext) {
this(IERSConventions.IERS_2010, dataContext, null, null, true, Double.NaN,
Double.NaN, 1, ParsedUnitsBehavior.CONVERT_COMPATIBLE);
Double.NaN, 1, ParsedUnitsBehavior.CONVERT_COMPATIBLE, new IdentityConverter());
}
/** Complete constructor.
......@@ -110,18 +116,21 @@ public class ParserBuilder extends AbstractBuilder<ParserBuilder> {
* @param defaultMass default mass
* @param defaultInterpolationDegree default interpolation degree
* @param parsedUnitsBehavior behavior to adopt for handling parsed units
* @param rangeUnitsConverter converter for {@link RangeUnits#RU Range Units}
*/
private ParserBuilder(final IERSConventions conventions, final DataContext dataContext,
final AbsoluteDate missionReferenceDate, final Vector3D spinAxis,
final boolean simpleEOP, final double mu, final double defaultMass,
final int defaultInterpolationDegree,
final ParsedUnitsBehavior parsedUnitsBehavior) {
final ParsedUnitsBehavior parsedUnitsBehavior,
final RangeUnitsConverter rangeUnitsConverter) {
super(conventions, dataContext, missionReferenceDate, spinAxis);
this.simpleEOP = simpleEOP;
this.mu = mu;
this.defaultMass = defaultMass;
this.defaultInterpolationDegree = defaultInterpolationDegree;
this.parsedUnitsBehavior = parsedUnitsBehavior;
this.rangeUnitsConverter = rangeUnitsConverter;
}
/** {@inheritDoc} */
......@@ -130,7 +139,7 @@ public class ParserBuilder extends AbstractBuilder<ParserBuilder> {
final AbsoluteDate newMissionReferenceDate, final Vector3D spinAxis) {
return new ParserBuilder(newConventions, newDataContext, newMissionReferenceDate, spinAxis,
simpleEOP, mu, defaultMass, defaultInterpolationDegree,
parsedUnitsBehavior);
parsedUnitsBehavior, rangeUnitsConverter);
}
/** Set up flag for ignoring tidal effects when interpolating EOP.
......@@ -141,7 +150,8 @@ public class ParserBuilder extends AbstractBuilder<ParserBuilder> {
return new ParserBuilder(getConventions(), getDataContext(),
getMissionReferenceDate(), getSpinAxis(),
newSimpleEOP, getMu(), getDefaultMass(),
getDefaultInterpolationDegree(), getParsedUnitsBehavior());
getDefaultInterpolationDegree(), getParsedUnitsBehavior(),
getRangeUnitsConverter());
}
/** Check if tidal effects are ignored when interpolating EOP.
......@@ -159,7 +169,8 @@ public class ParserBuilder extends AbstractBuilder<ParserBuilder> {
return new ParserBuilder(getConventions(), getDataContext(),
getMissionReferenceDate(), getSpinAxis(),
isSimpleEOP(), newMu, getDefaultMass(),
getDefaultInterpolationDegree(), getParsedUnitsBehavior());
getDefaultInterpolationDegree(), getParsedUnitsBehavior(),
getRangeUnitsConverter());
}
/** Get the gravitational coefficient.
......@@ -180,7 +191,8 @@ public class ParserBuilder extends AbstractBuilder<ParserBuilder> {
return new ParserBuilder(getConventions(), getDataContext(),
getMissionReferenceDate(), getSpinAxis(),
isSimpleEOP(), getMu(), newDefaultMass,
getDefaultInterpolationDegree(), getParsedUnitsBehavior());
getDefaultInterpolationDegree(), getParsedUnitsBehavior(),
getRangeUnitsConverter());
}
/** Get the default mass.
......@@ -202,7 +214,8 @@ public class ParserBuilder extends AbstractBuilder<ParserBuilder> {
return new ParserBuilder(getConventions(), getDataContext(),
getMissionReferenceDate(), getSpinAxis(),
isSimpleEOP(), getMu(), getDefaultMass(),
newDefaultInterpolationDegree, getParsedUnitsBehavior());
newDefaultInterpolationDegree, getParsedUnitsBehavior(),
getRangeUnitsConverter());
}
/** Get the default interpolation degree.
......@@ -220,7 +233,8 @@ public class ParserBuilder extends AbstractBuilder<ParserBuilder> {
return new ParserBuilder(getConventions(), getDataContext(),
getMissionReferenceDate(), getSpinAxis(),
isSimpleEOP(), getMu(), getDefaultMass(),
getDefaultInterpolationDegree(), newParsedUnitsBehavior);
getDefaultInterpolationDegree(), newParsedUnitsBehavior,
getRangeUnitsConverter());
}
/** Get the behavior to adopt for handling parsed units.
......@@ -230,6 +244,25 @@ public class ParserBuilder extends AbstractBuilder<ParserBuilder> {
return parsedUnitsBehavior;
}
/** Set up the converter for {@link RangeUnits#RU Range Units}.
* @param newRangeUnitsConverter converter for {@link RangeUnits#RU Range Units}
* @return a new builder with updated configuration (the instance is not changed)
*/
public ParserBuilder withRangeUnitsConverter(final RangeUnitsConverter newRangeUnitsConverter) {
return new ParserBuilder(getConventions(), getDataContext(),
getMissionReferenceDate(), getSpinAxis(),
isSimpleEOP(), getMu(), getDefaultMass(),
getDefaultInterpolationDegree(), getParsedUnitsBehavior(),
newRangeUnitsConverter);
}
/** Get the converter for {@link RangeUnits#RU Range Units}.
* @return converter for {@link RangeUnits#RU Range Units}
*/
public RangeUnitsConverter getRangeUnitsConverter() {
return rangeUnitsConverter;
}
/** Build a parser for {@link org.orekit.files.ccsds.ndm.odm.opm.OpmFile Orbit Parameters Messages}.
* @return a new parser
*/
......@@ -278,12 +311,11 @@ public class ParserBuilder extends AbstractBuilder<ParserBuilder> {
}
/** Build a parser for {@link org.orekit.files.ccsds.ndm.tdm.TdmFile Tracking Data Messages}.
* @param converter converter for {@link RangeUnits#RU Range Units} (may be null if there
* are no range observations in {@link RangeUnits#RU Range Units})
* @return a new parser
*/
public TdmParser buildTdmParser(final RangeUnitsConverter converter) {
return new TdmParser(getConventions(), isSimpleEOP(), getDataContext(), getParsedUnitsBehavior(), converter);
public TdmParser buildTdmParser() {
return new TdmParser(getConventions(), isSimpleEOP(), getDataContext(),
getParsedUnitsBehavior(), getRangeUnitsConverter());
}
}
......@@ -69,7 +69,7 @@ public class TdmParserTest {
try {
// action
new ParserBuilder().buildTdmParser(null).parseMessage(source);
new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
// verify
Assert.fail("Expected Exception");
......@@ -88,7 +88,7 @@ public class TdmParserTest {
// Data lines number was cut down to 7
final String name = "/ccsds/tdm/kvn/TDMExample2.txt";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
final TdmFile file = new ParserBuilder().buildTdmParser(null).parseMessage(source);
final TdmFile file = new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
validateTDMExample2(file);
}
......@@ -100,7 +100,7 @@ public class TdmParserTest {
// Data lines number was cut down to 20
final String name = "/ccsds/tdm/kvn/TDMExample4.txt";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
final TdmFile file = new ParserBuilder().buildTdmParser(new IdentityConverter()).parseMessage(source);
final TdmFile file = new ParserBuilder().buildTdmParser().parseMessage(source);
validateTDMExample4(file);
}
......@@ -112,7 +112,7 @@ public class TdmParserTest {
// Data lines number was cut down to 16
final String name = "/ccsds/tdm/kvn/TDMExample6.txt";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
final TdmFile file = new ParserBuilder().buildTdmParser(null).parseMessage(source);
final TdmFile file = new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
validateTDMExample6(file);
}
......@@ -124,7 +124,7 @@ public class TdmParserTest {
// Data lines number was cut down to 18
final String name = "/ccsds/tdm/kvn/TDMExample8.txt";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
final TdmFile file = new ParserBuilder().buildTdmParser(new IdentityConverter()).parseMessage(source);
final TdmFile file = new ParserBuilder().buildTdmParser().parseMessage(source);
validateTDMExample8(file);
}
......@@ -135,7 +135,7 @@ public class TdmParserTest {
// See Figure D-15: TDM Example: Clock Bias/Drift Only
final String name = "/ccsds/tdm/kvn/TDMExample15.txt";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
final TdmFile file = new ParserBuilder().buildTdmParser(null).parseMessage(source);
final TdmFile file = new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
validateTDMExample15(file);
}
......@@ -145,7 +145,7 @@ public class TdmParserTest {
// Testing all TDM keywords
final String name = "/ccsds/tdm/kvn/TDMExampleAllKeywordsSequential.txt";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
final TdmFile file = new ParserBuilder().buildTdmParser(new IdentityConverter()).parseMessage(source);
final TdmFile file = new ParserBuilder().buildTdmParser().parseMessage(source);
validateTDMExampleAllKeywordsSequential(file);
}
......@@ -155,7 +155,7 @@ public class TdmParserTest {
// Testing all TDM keywords
final String name = "/ccsds/tdm/kvn/TDMExampleAllKeywordsSingleDiff.txt";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
final TdmFile file = new ParserBuilder().buildTdmParser(new IdentityConverter()).parseMessage(source);
final TdmFile file = new ParserBuilder().buildTdmParser().parseMessage(source);
validateTDMExampleAllKeywordsSingleDiff(file);
}
......@@ -167,7 +167,7 @@ public class TdmParserTest {
// Data lines number was cut down to 7
final String name = "/ccsds/tdm/xml/TDMExample2.xml";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
final TdmFile file = new ParserBuilder().buildTdmParser(null).parseMessage(source);
final TdmFile file = new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
validateTDMExample2(file);
}
......@@ -179,7 +179,7 @@ public class TdmParserTest {
// Data lines number was cut down to 7
final String name = "/ccsds/tdm/xml/TDMExample2.xml";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
final TdmFile original = new ParserBuilder().buildTdmParser(null).parseMessage(source);
final TdmFile original = new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
// write the parsed file back to a characters array
final CharArrayWriter caw = new CharArrayWriter();
......@@ -189,7 +189,7 @@ public class TdmParserTest {
// reparse the written file
final byte[] bytes = caw.toString().getBytes(StandardCharsets.UTF_8);
final DataSource source2 = new DataSource(name, () -> new ByteArrayInputStream(bytes));
final TdmFile rebuilt = new ParserBuilder().buildTdmParser(null).parseMessage(source2);
final TdmFile rebuilt = new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source2);
validateTDMExample2(rebuilt);
}
......@@ -202,7 +202,7 @@ public class TdmParserTest {
// Data lines number was cut down to 20
final String name = "/ccsds/tdm/xml/TDMExample4.xml";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
final TdmFile file = new ParserBuilder().buildTdmParser(new IdentityConverter()).parseMessage(source);
final TdmFile file = new ParserBuilder().buildTdmParser().parseMessage(source);
validateTDMExample4(file);
}
......@@ -214,7 +214,7 @@ public class TdmParserTest {
// Data lines number was cut down to 16
final String name = "/ccsds/tdm/xml/TDMExample6.xml";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
final TdmFile file = new ParserBuilder().buildTdmParser(null).parseMessage(source);
final TdmFile file = new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
validateTDMExample6(file);
}
......@@ -226,7 +226,7 @@ public class TdmParserTest {
// Data lines number was cut down to 18
final String name = "/ccsds/tdm/xml/TDMExample8.xml";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
final TdmFile file = new ParserBuilder().buildTdmParser(new IdentityConverter()).parseMessage(source);
final TdmFile file = new ParserBuilder().buildTdmParser().parseMessage(source);
validateTDMExample8(file);
}
......@@ -237,7 +237,7 @@ public class TdmParserTest {
// See Figure D-15: TDM Example: Clock Bias/Drift Only
final String name = "/ccsds/tdm/xml/TDMExample15.xml";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
final TdmFile file = new ParserBuilder().buildTdmParser(null).parseMessage(source);
final TdmFile file = new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
validateTDMExample15(file);
}
......@@ -247,7 +247,7 @@ public class TdmParserTest {
// Testing all TDM keywords
final String name = "/ccsds/tdm/xml/TDMExampleAllKeywordsSequential.xml";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
final TdmFile file = new ParserBuilder().buildTdmParser(new IdentityConverter()).parseMessage(source);
final TdmFile file = new ParserBuilder().buildTdmParser().parseMessage(source);
validateTDMExampleAllKeywordsSequential(file);
}
......@@ -257,7 +257,7 @@ public class TdmParserTest {
// Testing all TDM keywords
final String name = "/ccsds/tdm/xml/TDMExampleAllKeywordsSingleDiff.xml";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
final TdmFile file = new ParserBuilder().buildTdmParser(new IdentityConverter()).parseMessage(source);
final TdmFile file = new ParserBuilder().buildTdmParser().parseMessage(source);
validateTDMExampleAllKeywordsSingleDiff(file);
}
......@@ -267,7 +267,7 @@ public class TdmParserTest {
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
try {
// Number format exception in data part
new ParserBuilder().buildTdmParser(null).parseMessage(source);
new ParserBuilder().buildTdmParser().parseMessage(source);
Assert.fail("An exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNABLE_TO_PARSE_ELEMENT_IN_FILE, oe.getSpecifier());
......@@ -283,7 +283,7 @@ public class TdmParserTest {
// Number format exception in data part
final String name = "/ccsds/tdm/xml/TDM-data-number-format-error.xml";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
new ParserBuilder().buildTdmParser(null).parseMessage(source);
new ParserBuilder().buildTdmParser().parseMessage(source);
Assert.fail("An exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNABLE_TO_PARSE_ELEMENT_IN_FILE, oe.getSpecifier());
......@@ -299,7 +299,7 @@ public class TdmParserTest {
// Number format exception in metadata part
final String name = "/ccsds/tdm/kvn/TDM-metadata-number-format-error.txt";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
new ParserBuilder().buildTdmParser(null).parseMessage(source);
new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
Assert.fail("An Orekit Exception \"UNABLE_TO_PARSE_LINE_IN_FILE\" should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNABLE_TO_PARSE_ELEMENT_IN_FILE, oe.getSpecifier());
......@@ -315,7 +315,7 @@ public class TdmParserTest {
// Number format exception in metadata part
final String name = "/ccsds/tdm/xml/TDM-metadata-number-format-error.xml";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
new ParserBuilder().buildTdmParser(null).parseMessage(source);
new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
Assert.fail("An exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNABLE_TO_PARSE_ELEMENT_IN_FILE, oe.getSpecifier());
......@@ -332,7 +332,7 @@ public class TdmParserTest {
final String wrongName = realName + "xxxxx";
final DataSource source = new DataSource(wrongName, () -> TdmParserTest.class.getResourceAsStream(wrongName));
try {
new ParserBuilder().buildTdmParser(null).parseMessage(source);
new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
Assert.fail("An exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNABLE_TO_FIND_FILE, oe.getSpecifier());
......@@ -345,7 +345,7 @@ public class TdmParserTest {
// Inconsistent time systems between two sets of data
final String name = "/ccsds/tdm/kvn/TDM-inconsistent-time-systems.txt";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
TdmFile file = new ParserBuilder().buildTdmParser(null).parseMessage(source);
TdmFile file = new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
Assert.assertEquals(3, file.getSegments().size());
Assert.assertEquals(TimeSystem.UTC, file.getSegments().get(0).getMetadata().getTimeSystem());
Assert.assertEquals(TimeSystem.TCG, file.getSegments().get(1).getMetadata().getTimeSystem());
......@@ -357,7 +357,7 @@ public class TdmParserTest {
// Inconsistent time systems between two sets of data
final String name = "/ccsds/tdm/xml/TDM-inconsistent-time-systems.xml";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
TdmFile file = new ParserBuilder().buildTdmParser(null).parseMessage(source);
TdmFile file = new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
Assert.assertEquals(3, file.getSegments().size());
Assert.assertEquals(TimeSystem.UTC, file.getSegments().get(0).getMetadata().getTimeSystem());
Assert.assertEquals(TimeSystem.TCG, file.getSegments().get(1).getMetadata().getTimeSystem());
......@@ -370,7 +370,7 @@ public class TdmParserTest {
final String name = "/ccsds/tdm/kvn/TDM-data-wrong-keyword.txt";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
try {
new ParserBuilder().buildTdmParser(null).parseMessage(source);
new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
Assert.fail("An exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.CCSDS_UNEXPECTED_KEYWORD, oe.getSpecifier());
......@@ -386,7 +386,7 @@ public class TdmParserTest {
final String name = "/ccsds/tdm/xml/TDM-data-wrong-keyword.xml";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
try {
new ParserBuilder().buildTdmParser(null).parseMessage(source);
new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
Assert.fail("An exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.CCSDS_UNEXPECTED_KEYWORD, oe.getSpecifier());
......@@ -402,7 +402,7 @@ public class TdmParserTest {
final String name = "/ccsds/tdm/kvn/TDM-metadata-wrong-keyword.txt";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
try {
new ParserBuilder().buildTdmParser(null).parseMessage(source);
new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
Assert.fail("An exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.CCSDS_UNEXPECTED_KEYWORD, oe.getSpecifier());
......@@ -418,7 +418,7 @@ public class TdmParserTest {
final String name = "/ccsds/tdm/xml/TDM-metadata-wrong-keyword.xml";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
try {
new ParserBuilder().buildTdmParser(null).parseMessage(source);
new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
Assert.fail("An exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.CCSDS_UNEXPECTED_KEYWORD, oe.getSpecifier());
......@@ -434,7 +434,7 @@ public class TdmParserTest {
final String name = "/ccsds/tdm/kvn/TDM-metadata-timesystem-not-implemented.txt";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
try {
new ParserBuilder().buildTdmParser(null).parseMessage(source);
new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
Assert.fail("An exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.CCSDS_TIME_SYSTEM_NOT_IMPLEMENTED, oe.getSpecifier());
......@@ -448,7 +448,7 @@ public class TdmParserTest {
final String name = "/ccsds/tdm/xml/TDM-metadata-timesystem-not-implemented.xml";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
try {
new ParserBuilder().buildTdmParser(null).parseMessage(source);
new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
Assert.fail("An exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.CCSDS_TIME_SYSTEM_NOT_IMPLEMENTED, oe.getSpecifier());
......@@ -462,7 +462,7 @@ public class TdmParserTest {
final String name = "/ccsds/tdm/xml/TDM-missing-timesystem.xml";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
try {
new ParserBuilder().buildTdmParser(null).parseMessage(source);
new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
Assert.fail("An exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.CCSDS_TIME_SYSTEM_NOT_READ_YET, oe.getSpecifier());
......@@ -476,7 +476,7 @@ public class TdmParserTest {
final String name = "/ccsds/tdm/kvn/TDM-data-inconsistent-line.txt";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
try {
new ParserBuilder().buildTdmParser(null).parseMessage(source);
new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
Assert.fail("An exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNABLE_TO_PARSE_ELEMENT_IN_FILE, oe.getSpecifier());
......@@ -492,7 +492,7 @@ public class TdmParserTest {
final String name = "/ccsds/tdm/xml/TDM-data-inconsistent-block.xml";
final DataSource source = new DataSource(name, () -> TdmParserTest.class.getResourceAsStream(name));
try {
new ParserBuilder().buildTdmParser(null).parseMessage(source);
new ParserBuilder().withRangeUnitsConverter(null).buildTdmParser().parseMessage(source);
Assert.fail("An exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNABLE_TO_PARSE_ELEMENT_IN_FILE, oe.getSpecifier());
......
......@@ -29,7 +29,7 @@ public class TdmWriterTest extends AbstractNdmWriterTest<Header, Segment<TdmMeta
protected TdmParser getParser() {
return new ParserBuilder().
withParsedUnitsBehavior(ParsedUnitsBehavior.STRICT_COMPLIANCE).
buildTdmParser(new IdentityConverter());
buildTdmParser();
}
protected TdmWriter getWriter() {
......
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