ServiceTypes { public Set<String> serviceTypes(String[] filepaths) throws ReaderException, IOException, WriterException { Set<String> types = new LinkedHashSet<String>(); WorkflowBundleIO io = new WorkflowBundleIO(); for (String filepath : filepaths) { File file = new File(filepath); WorkflowBundle wfBundle = io.readBundle(file, null); for (Profile profile : wfBundle.getProfiles()) { for (Activity activity : profile.getActivities()) { types.add(activity.getType().toASCIIString()); } } } return types; }  static void main(String[] args); Set<String> serviceTypes(String[] filepaths);  }
@Test public void defaultActivitiesT2flow() throws Exception { File tmp = File.createTempFile("defaultActivities2.2", ".t2flow"); tmp.deleteOnExit(); InputStream ebi = getClass() .getResourceAsStream( "/workflows/t2flow/defaultActivitiesTaverna2.2.t2flow"); FileOutputStream output = new FileOutputStream(tmp); IOUtils.copy(ebi, output); output.close(); Set<String> expectedTypes = new HashSet<String>(); expectedTypes.addAll(Arrays.asList( "http: "http: "http: "http: "http: "http: "http: "http: "http: "http: "http: "http: "http: Set<String> types = new ServiceTypes().serviceTypes(new String[] { tmp .getAbsolutePath() }); assertEquals(expectedTypes, types); }
@Test public void defaultActivitiesWfBundle() throws Exception { File tmp = File.createTempFile("defaultActivities2.2", ".wfbundle"); tmp.deleteOnExit(); InputStream ebi = getClass() .getResourceAsStream( "/workflows/wfbundle/defaultActivitiesTaverna2.wfbundle"); FileOutputStream output = new FileOutputStream(tmp); IOUtils.copy(ebi, output); output.close(); Set<String> expectedTypes = new HashSet<String>(); expectedTypes.addAll(Arrays.asList( "http: "http: "http: "http: "http: "http: "http: "http: "http: "http: "http: "http: "http: Set<String> types = new ServiceTypes().serviceTypes(new String[] { tmp .getAbsolutePath() }); assertEquals(expectedTypes, types); }