use of org.orekit.errors.OrekitException in project Orekit by CS-SI.
the class RapidDataAndPredictionXMLLoaderTest method testExternalResourcesAreIgnoredIssue368.
@Test
public void testExternalResourcesAreIgnoredIssue368() throws OrekitException {
// setup
setRoot("external-resources");
IERSConventions.NutationCorrectionConverter converter = IERSConventions.IERS_1996.getNutationCorrectionConverter();
SortedSet<EOPEntry> history = new TreeSet<>(new ChronologicalComparator());
RapidDataAndPredictionXMLLoader loader = new RapidDataAndPredictionXMLLoader("^finals2000A\\..*\\.xml$");
// action
try {
loader.fillHistory(converter, history);
// verify
Assert.fail("Expected Exception");
} catch (OrekitException e) {
// Malformed URL exception indicates external resource was disabled
// file not found exception indicates parser tried to load the resource
Assert.assertThat(e.getCause(), CoreMatchers.instanceOf(MalformedURLException.class));
}
// problem if any EOP data is loaded
Assert.assertEquals(0, history.size());
}
use of org.orekit.errors.OrekitException in project Orekit by CS-SI.
the class YUMAParserTest method testWrongFile.
@Test
public void testWrongFile() throws IOException, ParseException {
// the parser for reading Yuma files with a pattern
YUMAParser reader = new YUMAParser(".*\\.yum$");
// the SEM file to read
final String fileName = "/gnss/wrong_yuma.txt";
final InputStream in = getClass().getResourceAsStream(fileName);
// Reads the YUMA file, should throw an exception
try {
reader.loadData(in, fileName);
} catch (OrekitException oe) {
Assert.assertEquals("le fichier /gnss/wrong_yuma.txt n'est pas un fichier d'almanach Yuma supporté", oe.getMessage(Locale.FRANCE));
}
}
use of org.orekit.errors.OrekitException in project Orekit by CS-SI.
the class BulletinAFilesLoaderTest method checkTruncated.
private void checkTruncated(String name, OrekitMessages expected) {
SortedSet<EOPEntry> history = new TreeSet<EOPEntry>(new ChronologicalComparator());
try {
new BulletinAFilesLoader(name).fillHistory(null, history);
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(expected, oe.getSpecifier());
Assert.assertTrue(((String) oe.getParts()[0]).endsWith(name));
}
}
use of org.orekit.errors.OrekitException in project Orekit by CS-SI.
the class BulletinBFilesLoaderTest method testNewFormatInconsistentDate.
@Test
public void testNewFormatInconsistentDate() throws OrekitException {
setRoot("new-bulletinB");
IERSConventions.NutationCorrectionConverter converter = IERSConventions.IERS_2010.getNutationCorrectionConverter();
SortedSet<EOPEntry> history = new TreeSet<EOPEntry>(new ChronologicalComparator());
try {
new BulletinBFilesLoader("bulletinb-inconsistent-date.270").fillHistory(converter, history);
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.INCONSISTENT_DATES_IN_IERS_FILE, oe.getSpecifier());
}
}
use of org.orekit.errors.OrekitException in project Orekit by CS-SI.
the class EOPHistoryTest method testContinuityThreshold.
@Test
public void testContinuityThreshold() {
try {
FramesFactory.setEOPContinuityThreshold(0.5 * Constants.JULIAN_DAY);
AbsoluteDate date = new AbsoluteDate(2004, 1, 4, TimeScalesFactory.getUTC());
FramesFactory.getEOPHistory(IERSConventions.IERS_2010, true).getUT1MinusUTC(date);
Assert.fail("an exception should have been thrown");
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.MISSING_EARTH_ORIENTATION_PARAMETERS_BETWEEN_DATES, oe.getSpecifier());
}
}
Aggregations