private void parseProfile(Scanner scanner) { level = Level.Profile; profile = new Profile(); String profileName = parseName(scanner); profile.setName(profileName); wb.getProfiles().add(profile); if (profileName.equals(mainProfile)) wb.setMainProfile(profile); }
public Profile makeSecondaryProfile() { Profile profile = makeMainProfile(); profile.setName("tavernaServer"); Configuration config = profile.getConfigurations().getByName("Hello"); ObjectNode json = JsonNodeFactory.instance.objectNode(); json.put("script", "hello = \"Hello, \" + personName;\n" + "System.out.println(\"Server says: \" + hello);"); config.setJson(json); return profile; }
protected void parseProfile(Profile original, URI profileUri) { org.apache.taverna.scufl2.api.profiles.Profile p = new org.apache.taverna.scufl2.api.profiles.Profile(); p.setParent(getParserState().getCurrent(WorkflowBundle.class)); getParserState().push(p); if (original.getAbout() != null) { URI about = getParserState().getCurrentBase().resolve( original.getAbout()); mapBean(about, p); } else mapBean(profileUri, p); if (original.getName() != null) p.setName(original.getName()); // Note - we'll pop() in profileSecond() instead }
public Profile makeMainProfile() { Profile profile = new Profile(); profile.setName("tavernaWorkbench"); // FIXME: Can't set dc:creator/date/description // FIXME: Can't create recommendsEnvironment/requiresEnvironment makeActivity().setParent(profile); makeConfiguration().setParent(profile); makeProcessorBinding().setParent(profile); // profile.setProfilePosition(0); return profile; }
@Test public void awkwardFilenames() throws Exception { workflowBundle.getProfiles().removeByName("tavernaServer"); String funnyName = "Funny_%2f_characters_50%_of the time"; workflowBundle.getMainProfile().setName(funnyName); workflowBundle.getMainWorkflow().setName(funnyName); File bundleFile = tempFile(); bundleIO.writeBundle(workflowBundle, bundleFile, APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE); UCFPackage ucfPackage = new UCFPackage(bundleFile); Map<String, ResourceEntry> profiles = ucfPackage.listResources("profile"); assertEquals(2, profiles.size()); assertTrue(profiles.keySet().contains("Funny_%252f_characters_50%25_of%20the%20time.rdf")); assertTrue(profiles.keySet().contains("Funny_%252f_characters_50%25_of%20the%20time/")); Map<String, ResourceEntry> workflows = ucfPackage.listResources("workflow"); assertEquals(1, workflows.size()); assertEquals("Funny_%252f_characters_50%25_of%20the%20time.rdf", workflows.keySet().iterator().next()); // and.. can we read it in again correctly? WorkflowBundle readBundle = bundleIO.readBundle(bundleFile, APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE); assertEquals(funnyName, readBundle.getMainProfile().getName()); assertEquals(funnyName, readBundle.getMainWorkflow().getName()); // did the JSON parse back in? JsonNode oldJson = workflowBundle.getMainProfile().getConfigurations().getByName("Hello").getJson(); assertTrue(oldJson.get("script").asText().startsWith("hello")); JsonNode newJson = readBundle.getMainProfile().getConfigurations().getByName("Hello").getJson(); assertTrue(newJson.get("script").asText().startsWith("hello")); assertEquals(oldJson, newJson); }
profile.setName("profile1"); profile.setParent(wb); profile.newRevision();