@@ -0,0 +1,2456 @@
+package pipeTesting;%0A%0Aimport core.Artifact_ID;%0Aimport core.Pipe;%0Aimport java.io.File;%0Aimport java.io.FileInputStream;%0Aimport java.io.FileNotFoundException;%0Aimport java.io.IOException;%0Aimport java.util.LinkedList;%0Aimport java.util.List;%0Aimport java.util.UUID;%0A%0Aimport org.json.*;%0A%0A/**%0A * Created by nwilson on 2/23/15.%0A */%0Apublic class TestLoader %7B%0A%0A    private static final String KEY_AID_NAME = %22artifact_name%22;%0A    private static final String KEY_AID_UUID = %22artifact_uuid%22;%0A    private static final String KEY_TESTS    = %22tests%22;%0A    private static final String KEY_NAME     = %22name%22;%0A    private static final String KEY_CMD      = %22cmd%22;%0A%0A    public static Iterable%3CTest%3E TestsFromFile(File file, Pipe pipe) %7B%0A        List%3CTest%3E output = new LinkedList%3C%3E();%0A%0A        try (FileInputStream fileIn = new FileInputStream(file)) %7B%0A            JSONObject object = new JSONObject(new JSONTokener(fileIn));%0A            JSONArray tests = object.getJSONArray(KEY_TESTS);%0A            for (int itest = 0; itest %3C tests.length(); itest++) %7B%0A                JSONObject test = tests.getJSONObject(itest);%0A%0A                String name;%0A                if (test.has(KEY_NAME)) %7B%0A                    name = test.getString(KEY_NAME);%0A                %7D else%7B%0A                    name = null;%0A                %7D%0A%0A                Artifact_ID aid;%0A                if (test.has(KEY_AID_NAME)) %7B%0A                    aid = pipe.ArtifactIDFromName(test.getString(KEY_AID_NAME));%0A                %7D else if (test.has(KEY_AID_UUID)) %7B%0A                    aid = pipe.ArtifactIDFromUUID(UUID.fromString(test.getString(KEY_AID_UUID)));%0A                %7D else %7B%0A                    output.add(new ErrorTest(%22Must specify either artifact name or uuid.%22, name, null));%0A                    continue;%0A                %7D%0A%0A                if (test.has(KEY_CMD)) %7B%0A                    output.add(new CmdTest(test.getString(KEY_CMD), aid, name));%0A%0A                // %7D else if %7B TODO other kinds of tests%0A                %7D else %7B%0A                    output.add(new ErrorTest(%22Must specify a command for the test%22, name, aid));%0A                %7D%0A            %7D%0A%0A        %7D%0A        catch (FileNotFoundException ex) %7B%0A            System.err.println(%22Could not find file %22 + file.toString());%0A            return null;%0A        %7D%0A        catch (IOException ex) %7B%0A            System.err.println(%22Could not read file %22 + file.toString());%0A            return null;%0A        %7D%0A%0A        return output;%0A    %7D%0A%7D%0A

Add function to load tests from JSON file