/** * Returns the name of the <code>Profile</code> to use when running the * <code>Workflow</code>. If no <code>Profile</code> name is set the main * <code>Profile</code> from the <code>WorkflowBundle</code> will be used. * * @return the <code>Profile</code> to use when running the * <code>Workflow</code> */ public String getProfileName() { if (profileName == null && workflowBundle.getMainProfile() != null) { return workflowBundle.getMainProfile().getName(); } return profileName; }
private void profile(Profile node) { profile = node; profileElem = objectFactory.createProfile(); profileElem.setAbout(uri(node)); profileElem.setName(node.getName()); doc.getAny().add(profileElem); }
@Test public void profileName() throws Exception { assertEquals("tavernaWorkbench", profile.getName()); }
@Test public void profileName() throws Exception { Profile p = new Profile(); UUID uuid = UUID.fromString(p.getName()); assertEquals(4, uuid.version()); }
/** * Test method for * {@link org.apache.taverna.platform.run.api.RunProfile#RunProfile(org.apache.taverna.scufl2.api.container.WorkflowBundle, org.apache.taverna.scufl2.api.core.Workflow, org.apache.taverna.scufl2.api.profiles.Profile, java.util.Map, org.apache.taverna.reference.ReferenceService, org.apache.taverna.platform.execution.api.ExecutionService)} * . */ @Test public void testRunProfileWorkflowBundleWorkflowProfileMapOfStringT2ReferenceReferenceServiceExecutionService() { runProfile = new RunProfile(executionEnvironment, workflowBundle, workflow.getName(), profile.getName(), dataBundle); }
/** * Test method for * {@link org.apache.taverna.platform.run.api.RunProfile#setProfile(org.apache.taverna.scufl2.api.profiles.Profile)} * . */ @Test public void testSetProfile() { runProfile.setProfileName(null); assertNotNull(runProfile.getProfileName()); assertEquals(mainProfile.getName(), runProfile.getProfileName()); runProfile.setWorkflowBundle(new WorkflowBundle()); runProfile.setProfileName(null); assertNull(runProfile.getProfileName()); runProfile.setProfileName(profile.getName()); assertEquals(profile.getName(), runProfile.getProfileName()); runProfile.setProfileName(mainProfile.getName()); assertEquals(mainProfile.getName(), runProfile.getProfileName()); }
} else logger.warning("Can't find bundle URI for profile document " + pf.getName());
@Test public void profiles() throws Exception { assertEquals(2, workflowBundle.getProfiles().size()); Profile tavernaWorkbench = workflowBundle.getProfiles().getByName( "tavernaWorkbench"); assertEquals("tavernaWorkbench", tavernaWorkbench.getName()); assertEquals(workflowBundle.getMainProfile(), tavernaWorkbench); assertEquals("tavernaServer", workflowBundle.getProfiles().getByName("tavernaServer").getName()); }
/** * Test method for * {@link org.apache.taverna.platform.run.api.RunProfile#getProfile()}. */ @Test public void testGetProfile() { assertNotNull(runProfile.getProfileName()); assertEquals(profile.getName(), runProfile.getProfileName()); assertEquals(runProfile.getProfileName(), runProfile.getProfileName()); runProfile.setProfileName(null); assertNotNull(runProfile.getProfileName()); assertEquals(mainProfile.getName(), runProfile.getProfileName()); }
@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); }
@Test public void cloneProfile() throws Exception { Profile original = originalWfBundle.getMainProfile(); assertEquals(originalWfBundle, original.getParent()); Profile clone = (Profile) original.clone(); assertNull(clone.getParent()); assertEquals(original.getName(), clone.getName()); ProcessorBinding originalBinding = original.getProcessorBindings() .getByName("Hello"); ProcessorBinding cloneBinding = clone.getProcessorBindings().getByName( "Hello"); assertNotSame(originalBinding, cloneBinding); assertNotSame(originalBinding.getBoundActivity(), cloneBinding.getBoundActivity()); // but processor is the same, as we did not clone the workflow assertSame(originalBinding.getBoundProcessor(), cloneBinding.getBoundProcessor()); }
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { workflow = new Workflow(); mainWorkflow = new Workflow(); profile = new Profile(); mainProfile = new Profile(); workflowBundle = new WorkflowBundle(); workflowBundle.setMainProfile(mainProfile); workflowBundle.setMainWorkflow(mainWorkflow); executionService = new LocalExecutionService(); executionEnvironment = new LocalExecutionEnvironment(executionService, null, null); dataBundle = DataBundles.createBundle(); runProfile = new RunProfile(executionEnvironment, workflowBundle, workflow.getName(), profile.getName(), dataBundle); }
@Test public void createBundle() throws Exception { WorkflowBundle wb = bundleIO.createBundle(); assertEquals(wb, wb.getMainWorkflow().getParent()); assertEquals(wb, wb.getMainProfile().getParent()); assertEquals("bundle1", wb.getName()); assertEquals("workflow1", wb.getMainWorkflow().getName()); assertEquals("profile1", wb.getMainProfile().getName()); assertNotNull(wb.getCurrentRevision()); assertNotNull(wb.getMainWorkflow().getCurrentRevision()); assertNotNull(wb.getMainProfile().getCurrentRevision()); }