mil.dod.th.ose.sdk.integration/src/mil/dod/th/ose/sdk/integration/TestSdkCommands.java
public void testVersionCommand() throws IOException
    {
        ProcessBuilder pb;
        if (System.getProperty("os.name").startsWith("Windows")) 
        {
            pb = new ProcessBuilder("cmd.exe", "/C", "those.bat", "version");
        } 
        else 
        {
            pb = new ProcessBuilder("sh", "those.sh", "version");
        } 
        pb.redirectErrorStream(true);
        pb.directory(new File(m_SdkDir));
        Process p = pb.start();
        BufferedReader bf = new BufferedReader(new InputStreamReader(p.getInputStream()));
        
        final Pattern apiVersionPattern = Pattern.compile("API Version: [0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]{12}+");
        
        boolean found = false;
        String line = bf.readLine();
        while (line != null)
        {
            //Read lines till API version string is found. This is needed as windows prints out the header of the
            //batch file.
            final Matcher apiVersionMatcher = apiVersionPattern.matcher(line);
            if (apiVersionMatcher.matches())
            {
                found = true;
                break;
            }
            line = bf.readLine();
        }
        
        assertThat(found, is(true));
    }
/**
     * Verify that the version command works and returns the expected output.
     */
Verify that the version command works and returns the expected output.
Verify that the version command works and returns the expected output .
public void testVersionCommand() throws IOException
    {
        ProcessBuilder pb;
        if (System.getProperty("os.name").startsWith("Windows")) 
        {
            pb = new ProcessBuilder("cmd.exe", "/C", "those.bat", "version");
        } 
        else 
        {
            pb = new ProcessBuilder("sh", "those.sh", "version");
        } 
        pb.redirectErrorStream(true);
        pb.directory(new File(m_SdkDir));
        Process p = pb.start();
        BufferedReader bf = new BufferedReader(new InputStreamReader(p.getInputStream()));
        final Pattern apiVersionPattern = Pattern.compile("API Version: [0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]{12}+");
        boolean found = false;
        String line = bf.readLine();
        while (line != null)
        {
            final Matcher apiVersionMatcher = apiVersionPattern.matcher(line);
            if (apiVersionMatcher.matches())
            {
                found = true;
                break;
            }
            line = bf.readLine();
        }
        assertThat(found, is(true));
    }
public void testVersionCommand ( ) throws IOException { ProcessBuilder pb ; if ( System . getProperty ( "os.name" ) . startsWith ( "Windows" ) ) { pb = new ProcessBuilder ( "cmd.exe" , "/C" , "those.bat" , "version" ) ; } else { pb = new ProcessBuilder ( "sh" , "those.sh" , "version" ) ; } pb . redirectErrorStream ( true ) ; pb . directory ( new File ( m_SdkDir ) ) ; Process p = pb . start ( ) ; BufferedReader bf = new BufferedReader ( new InputStreamReader ( p . getInputStream ( ) ) ) ; final Pattern apiVersionPattern = Pattern . compile ( "API Version: [0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]{12}+" ) ; boolean found = false ; String line = bf . readLine ( ) ; while ( line != null ) { final Matcher apiVersionMatcher = apiVersionPattern . matcher ( line ) ; if ( apiVersionMatcher . matches ( ) ) { found = true ; break ; } line = bf . readLine ( ) ; } assertThat ( found , is ( true ) ) ; }
Verify that the version command works and returns the expected output.
Verify that the version command works and returns the expected output .
//Read lines till API version string is found. This is needed as windows prints out the header of the //batch file.