use of org.orekit.files.ccsds.OEMWriter.InterpolationMethod in project Orekit by CS-SI.
the class OEMWriterTest method testNullFile.
@Test
public void testNullFile() throws OrekitException, IOException {
final String ex = "/ccsds/OEMExample.txt";
final InputStream inEntry = getClass().getResourceAsStream(ex);
final OEMParser parser = new OEMParser().withMu(CelestialBodyFactory.getEarth().getGM()).withConventions(IERSConventions.IERS_2010);
final OEMFile oemFile = parser.parse(inEntry, "OEMExample.txt");
final EphemerisFile ephemerisFile = (EphemerisFile) oemFile;
String originator = oemFile.getOriginator();
String objectName = oemFile.getEphemeridesBlocks().get(0).getMetaData().getObjectName();
String objectID = oemFile.getEphemeridesBlocks().get(0).getMetaData().getObjectID();
String interpolationMethodString = oemFile.getEphemeridesBlocks().get(0).getInterpolationMethod();
InterpolationMethod interpolationMethod = Enum.valueOf(InterpolationMethod.class, interpolationMethodString);
OEMWriter writer = new OEMWriter(interpolationMethod, originator, objectID, objectName);
try {
writer.write((BufferedWriter) null, ephemerisFile);
fail("an exception should have been thrown");
} catch (OrekitIllegalArgumentException oiae) {
assertEquals(OrekitMessages.NULL_ARGUMENT, oiae.getSpecifier());
assertEquals("writer", oiae.getParts()[0]);
}
}
use of org.orekit.files.ccsds.OEMWriter.InterpolationMethod in project Orekit by CS-SI.
the class OEMWriterTest method testUnfoundSpaceId.
@Test
public void testUnfoundSpaceId() throws OrekitException, IOException {
final String ex = "/ccsds/OEMExample.txt";
final InputStream inEntry = getClass().getResourceAsStream(ex);
final OEMParser parser = new OEMParser().withMu(CelestialBodyFactory.getEarth().getGM()).withConventions(IERSConventions.IERS_2010);
final OEMFile oemFile = parser.parse(inEntry, "OEMExample.txt");
final EphemerisFile ephemerisFile = (EphemerisFile) oemFile;
String badObjectId = "12345";
String interpolationMethodString = oemFile.getEphemeridesBlocks().get(0).getInterpolationMethod();
InterpolationMethod interpolationMethod = Enum.valueOf(InterpolationMethod.class, interpolationMethodString);
String tempOEMFilePath = tempFolder.newFile("TestOEMUnfoundSpaceId.oem").toString();
OEMWriter writer = new OEMWriter(interpolationMethod, null, badObjectId, null);
try {
writer.write(tempOEMFilePath, ephemerisFile);
fail("an exception should have been thrown");
} catch (OrekitIllegalArgumentException oiae) {
assertEquals(OrekitMessages.VALUE_NOT_FOUND, oiae.getSpecifier());
assertEquals(badObjectId, oiae.getParts()[0]);
}
}
use of org.orekit.files.ccsds.OEMWriter.InterpolationMethod in project Orekit by CS-SI.
the class OEMWriterTest method testWriteOEM1.
@Test
public void testWriteOEM1() throws OrekitException, IOException {
final String ex = "/ccsds/OEMExample.txt";
final InputStream inEntry = getClass().getResourceAsStream(ex);
final OEMParser parser = new OEMParser().withMu(CelestialBodyFactory.getEarth().getGM()).withConventions(IERSConventions.IERS_2010);
final OEMFile oemFile = parser.parse(inEntry, "OEMExample.txt");
final EphemerisFile ephemerisFile = (EphemerisFile) oemFile;
String originator = oemFile.getOriginator();
String objectName = oemFile.getEphemeridesBlocks().get(0).getMetaData().getObjectName();
String objectID = oemFile.getEphemeridesBlocks().get(0).getMetaData().getObjectID();
String interpolationMethodString = oemFile.getEphemeridesBlocks().get(0).getInterpolationMethod();
InterpolationMethod interpolationMethod = Enum.valueOf(InterpolationMethod.class, interpolationMethodString);
String tempOEMFilePath = tempFolder.newFile("TestWriteOEM1.oem").toString();
OEMWriter writer = new OEMWriter(interpolationMethod, originator, objectID, objectName);
writer.write(tempOEMFilePath, ephemerisFile);
final OEMFile generatedOemFile = parser.parse(tempOEMFilePath);
compareOemFiles(oemFile, generatedOemFile);
}
Aggregations