Search in sources :

Example 1 with TcgXmlReader

use of com.rockwellcollins.atc.tcg.readers.TcgXmlReader in project AGREE by loonwerks.

the class OpenHandler method loadTests.

private TestSuite loadTests() throws TcgException {
    try {
        Shell activeShell = getWindow().getShell();
        syncExec(() -> {
            location = TcgPreferenceUtils.getTestCaseOpenFileDialog(activeShell, null);
        });
        if (location != null) {
            InputStream targetStream = new FileInputStream(location);
            TestSuite ts = new TestSuite();
            TcgXmlReader reader = new TcgXmlReader(targetStream);
            reader.readSuite(ts);
            ts.setState(TestSuite.State.LOADED);
            return ts;
        } else {
            return null;
        }
    } catch (IOException e) {
        throw new TcgException("Error loading test file", e);
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) TestSuite(com.rockwellcollins.atc.tcg.suite.TestSuite) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) TcgXmlReader(com.rockwellcollins.atc.tcg.readers.TcgXmlReader) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) TcgException(com.rockwellcollins.atc.tcg.TcgException)

Aggregations

TcgException (com.rockwellcollins.atc.tcg.TcgException)1 TcgXmlReader (com.rockwellcollins.atc.tcg.readers.TcgXmlReader)1 TestSuite (com.rockwellcollins.atc.tcg.suite.TestSuite)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Shell (org.eclipse.swt.widgets.Shell)1