Search in sources :

Example 91 with OrekitException

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());
}
Also used : TreeSet(java.util.TreeSet) IERSConventions(org.orekit.utils.IERSConventions) OrekitException(org.orekit.errors.OrekitException) ChronologicalComparator(org.orekit.time.ChronologicalComparator) Test(org.junit.Test) AbstractFilesLoaderTest(org.orekit.data.AbstractFilesLoaderTest)

Example 92 with OrekitException

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));
    }
}
Also used : InputStream(java.io.InputStream) OrekitException(org.orekit.errors.OrekitException) Test(org.junit.Test)

Example 93 with OrekitException

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));
    }
}
Also used : TreeSet(java.util.TreeSet) OrekitException(org.orekit.errors.OrekitException) ChronologicalComparator(org.orekit.time.ChronologicalComparator)

Example 94 with OrekitException

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());
    }
}
Also used : TreeSet(java.util.TreeSet) IERSConventions(org.orekit.utils.IERSConventions) OrekitException(org.orekit.errors.OrekitException) ChronologicalComparator(org.orekit.time.ChronologicalComparator) AbstractFilesLoaderTest(org.orekit.data.AbstractFilesLoaderTest) Test(org.junit.Test)

Example 95 with OrekitException

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());
    }
}
Also used : OrekitException(org.orekit.errors.OrekitException) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Aggregations

OrekitException (org.orekit.errors.OrekitException)332 AbsoluteDate (org.orekit.time.AbsoluteDate)150 Test (org.junit.Test)135 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)91 SpacecraftState (org.orekit.propagation.SpacecraftState)75 Frame (org.orekit.frames.Frame)62 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)59 ArrayList (java.util.ArrayList)48 Before (org.junit.Before)48 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)42 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)42 DateComponents (org.orekit.time.DateComponents)42 GeodeticPoint (org.orekit.bodies.GeodeticPoint)41 Orbit (org.orekit.orbits.Orbit)40 PVCoordinates (org.orekit.utils.PVCoordinates)37 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)36 IOException (java.io.IOException)32 InputStream (java.io.InputStream)31 Propagator (org.orekit.propagation.Propagator)30 UnivariateFunction (org.hipparchus.analysis.UnivariateFunction)28