Search in sources :

Example 21 with OrekitException

use of org.orekit.errors.OrekitException in project Orekit by CS-SI.

the class TDMParserTest method testInconsistentDataLineKeyValue.

@Test
public void testInconsistentDataLineKeyValue() {
    // Inconsistent data line in KeyValue file (3 fields after keyword instead of 2)
    final String ex = "/ccsds/TDM-data-inconsistent-line.txt";
    final InputStream inEntry = getClass().getResourceAsStream(ex);
    try {
        new TDMParser().parse(inEntry, ex);
        Assert.fail("An exception \"CCSDS_TDM_INCONSISTENT_DATA_LINE\"should have been thrown");
    } catch (OrekitException oe) {
        Assert.assertEquals(OrekitMessages.CCSDS_TDM_INCONSISTENT_DATA_LINE, oe.getSpecifier());
        Assert.assertEquals(25, oe.getParts()[0]);
        Assert.assertEquals("/ccsds/TDM-data-inconsistent-line.txt", oe.getParts()[1]);
        Assert.assertEquals("RECEIVE_FREQ_1 = 2005-159T17:41:02 -333.0551 this-should-not-be-here", oe.getParts()[2]);
    }
}
Also used : InputStream(java.io.InputStream) OrekitException(org.orekit.errors.OrekitException) Test(org.junit.Test)

Example 22 with OrekitException

use of org.orekit.errors.OrekitException in project Orekit by CS-SI.

the class SP3ParserTest method testWrongNumberOfEpochs.

@Test
public void testWrongNumberOfEpochs() throws IOException {
    try {
        final String ex = "/sp3/wrong-number-of-epochs.sp3";
        final Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2003, true);
        final SP3Parser parser = new SP3Parser(Constants.EIGEN5C_EARTH_MU, 3, s -> frame);
        final InputStream inEntry = getClass().getResourceAsStream(ex);
        parser.parse(inEntry);
        Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
        Assert.assertEquals(OrekitMessages.SP3_NUMBER_OF_EPOCH_MISMATCH, oe.getSpecifier());
        Assert.assertEquals(2, ((Integer) oe.getParts()[0]).intValue());
        Assert.assertEquals(192, ((Integer) oe.getParts()[2]).intValue());
    }
}
Also used : Frame(org.orekit.frames.Frame) FactoryManagedFrame(org.orekit.frames.FactoryManagedFrame) InputStream(java.io.InputStream) OrekitException(org.orekit.errors.OrekitException) Test(org.junit.Test)

Example 23 with OrekitException

use of org.orekit.errors.OrekitException in project Orekit by CS-SI.

the class SP3ParserTest method testTruncatedLine.

@Test
public void testTruncatedLine() throws IOException {
    try {
        final String ex = "/sp3/truncated-line.sp3";
        final Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2003, true);
        final SP3Parser parser = new SP3Parser(Constants.EIGEN5C_EARTH_MU, 3, s -> frame);
        final InputStream inEntry = getClass().getResourceAsStream(ex);
        parser.parse(inEntry);
        Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
        Assert.assertEquals(OrekitMessages.UNABLE_TO_PARSE_LINE_IN_FILE, oe.getSpecifier());
        Assert.assertEquals(27, ((Integer) oe.getParts()[0]).intValue());
    }
}
Also used : Frame(org.orekit.frames.Frame) FactoryManagedFrame(org.orekit.frames.FactoryManagedFrame) InputStream(java.io.InputStream) OrekitException(org.orekit.errors.OrekitException) Test(org.junit.Test)

Example 24 with OrekitException

use of org.orekit.errors.OrekitException in project Orekit by CS-SI.

the class SP3ParserTest method testMissingEOF.

@Test
public void testMissingEOF() throws IOException {
    try {
        final String ex = "/sp3/missing-eof.sp3";
        final Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2003, true);
        final SP3Parser parser = new SP3Parser(Constants.EIGEN5C_EARTH_MU, 3, s -> frame);
        final InputStream inEntry = getClass().getResourceAsStream(ex);
        parser.parse(inEntry);
        Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
        Assert.assertEquals(OrekitMessages.SP3_UNEXPECTED_END_OF_FILE, oe.getSpecifier());
        Assert.assertEquals(24, ((Integer) oe.getParts()[0]).intValue());
    }
}
Also used : Frame(org.orekit.frames.Frame) FactoryManagedFrame(org.orekit.frames.FactoryManagedFrame) InputStream(java.io.InputStream) OrekitException(org.orekit.errors.OrekitException) Test(org.junit.Test)

Example 25 with OrekitException

use of org.orekit.errors.OrekitException in project Orekit by CS-SI.

the class SP3ParserTest method testUnsupportedVersion.

@Test
public void testUnsupportedVersion() throws IOException {
    try {
        final String ex = "/sp3/unsupported-version.sp3";
        final Frame frame = FramesFactory.getITRF(IERSConventions.IERS_2003, true);
        final SP3Parser parser = new SP3Parser(Constants.EIGEN5C_EARTH_MU, 3, s -> frame);
        final InputStream inEntry = getClass().getResourceAsStream(ex);
        parser.parse(inEntry);
        Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
        Assert.assertEquals(OrekitMessages.SP3_UNSUPPORTED_VERSION, oe.getSpecifier());
        Assert.assertEquals('z', ((Character) oe.getParts()[0]).charValue());
    }
}
Also used : Frame(org.orekit.frames.Frame) FactoryManagedFrame(org.orekit.frames.FactoryManagedFrame) InputStream(java.io.InputStream) OrekitException(org.orekit.errors.OrekitException) 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