You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2015/02/23 11:35:48 UTC
[33/58] [abbrv] incubator-taverna-plugin-component git commit:
org.apache.taverna.component.*
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/ComponentActivityTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/ComponentActivityTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/ComponentActivityTest.java
deleted file mode 100644
index d2c6213..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/ComponentActivityTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package net.sf.taverna.t2.component;
-
-
-public class ComponentActivityTest {
-
- @SuppressWarnings("unused")
- private ComponentActivityConfigurationBean configBean;
-
- @SuppressWarnings("unused")
- private ComponentActivity activity = new ComponentActivityFactory().createActivity(); // FIXME
-
-/* @Before
- public void makeConfigBean() throws Exception {
- configBean = new ComponentActivityConfigurationBean();
- configBean.setExampleString("something");
- configBean
- .setExampleUri(URI.create("http://localhost:8080/myEndPoint"));
- }
-
- @Test(expected = ActivityConfigurationException.class)
- public void invalidConfiguration() throws ActivityConfigurationException {
- ComponentActivityConfigurationBean invalidBean = new ComponentActivityConfigurationBean();
- invalidBean.setExampleString("invalidExample");
- // Should throw ActivityConfigurationException
- activity.configure(invalidBean);
- }
-
- @Test
- public void executeAsynch() throws Exception {
- activity.configure(configBean);
-
- Map<String, Object> inputs = new HashMap<String, Object>();
- inputs.put("firstInput", "hello");
-
- Map<String, Class<?>> expectedOutputTypes = new HashMap<String, Class<?>>();
- expectedOutputTypes.put("simpleOutput", String.class);
- expectedOutputTypes.put("moreOutputs", String.class);
-
- Map<String, Object> outputs = ActivityInvoker.invokeAsyncActivity(
- activity, inputs, expectedOutputTypes);
-
- assertEquals("Unexpected outputs", 2, outputs.size());
- assertEquals("simple", outputs.get("simpleOutput"));
- assertEquals(Arrays.asList("Value 1", "Value 2"), outputs
- .get("moreOutputs"));
-
- }
-
- @Test
- public void reConfiguredActivity() throws Exception {
- assertEquals("Unexpected inputs", 0, activity.getInputPorts().size());
- assertEquals("Unexpected outputs", 0, activity.getOutputPorts().size());
-
- activity.configure(configBean);
- assertEquals("Unexpected inputs", 1, activity.getInputPorts().size());
- assertEquals("Unexpected outputs", 2, activity.getOutputPorts().size());
-
- activity.configure(configBean);
- // Should not change on reconfigure
- assertEquals("Unexpected inputs", 1, activity.getInputPorts().size());
- assertEquals("Unexpected outputs", 2, activity.getOutputPorts().size());
- }
-
- @Test
- public void reConfiguredSpecialPorts() throws Exception {
- activity.configure(configBean);
-
- ComponentActivityConfigurationBean specialBean = new ComponentActivityConfigurationBean();
- specialBean.setExampleString("specialCase");
- specialBean.setExampleUri(URI
- .create("http://localhost:8080/myEndPoint"));
- activity.configure(specialBean);
- // Should now have added the optional ports
- assertEquals("Unexpected inputs", 2, activity.getInputPorts().size());
- assertEquals("Unexpected outputs", 3, activity.getOutputPorts().size());
- }
-
- @Test
- public void configureActivity() throws Exception {
- Set<String> expectedInputs = new HashSet<String>();
- expectedInputs.add("firstInput");
-
- Set<String> expectedOutputs = new HashSet<String>();
- expectedOutputs.add("simpleOutput");
- expectedOutputs.add("moreOutputs");
-
- activity.configure(configBean);
-
- Set<ActivityInputPort> inputPorts = activity.getInputPorts();
- assertEquals(expectedInputs.size(), inputPorts.size());
- for (ActivityInputPort inputPort : inputPorts) {
- assertTrue("Wrong input : " + inputPort.getName(), expectedInputs
- .remove(inputPort.getName()));
- }
-
- Set<OutputPort> outputPorts = activity.getOutputPorts();
- assertEquals(expectedOutputs.size(), outputPorts.size());
- for (OutputPort outputPort : outputPorts) {
- assertTrue("Wrong output : " + outputPort.getName(),
- expectedOutputs.remove(outputPort.getName()));
- }
- }*/
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java
deleted file mode 100644
index 0aba440..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentFamilyTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.net.URL;
-
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.Profile;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
-
-/**
- *
- *
- * @author David Withers
- */
-@Ignore
-public class ComponentFamilyTest extends Harness {
- private Family componentFamily;
- private Profile componentProfile;
- private WorkflowBundle bundle;
-
- @Before
- public void setup() throws Exception {
- URL componentProfileUrl = getClass().getClassLoader().getResource(
- "ValidationComponent.xml");
- assertNotNull(componentProfileUrl);
- componentProfile = util.getProfile(componentProfileUrl);
- componentRegistry.addComponentProfile(componentProfile, null, null);
- URL dataflowUrl = getClass().getClassLoader().getResource(
- "beanshell_test.t2flow");
- assertNotNull(dataflowUrl);
- bundle = new WorkflowBundleIO().readBundle(dataflowUrl, null);
- componentFamily = componentRegistry.createComponentFamily(
- "Test Component Family", componentProfile, "Some description",
- null, null);
- }
-
- @After
- public void tearDown() throws Exception {
- componentRegistry.removeComponentFamily(componentFamily);
- }
-
- @Test
- public void testGetComponentRegistry() throws Exception {
- assertEquals(componentRegistry, componentFamily.getComponentRegistry());
- }
-
- @Test
- public void testGetName() throws Exception {
- assertEquals("Test Component Family", componentFamily.getName());
- assertEquals("Test Component Family", componentFamily.getName());
- }
-
- @Test
- public void testGetComponentProfile() throws Exception {
- Profile componentProfile2 = componentFamily.getComponentProfile();
- assertNotNull(componentProfile2);
- String id = componentProfile.getId();
- String id2 = componentProfile2.getId();
- assertEquals(id, id2);
- }
-
- @Test
- public void testGetComponents() throws Exception {
- assertEquals(0, componentFamily.getComponents().size());
- assertEquals(0, componentFamily.getComponents().size());
- Version componentVersion = componentFamily.createComponentBasedOn(
- "Test Component", "Some description", bundle);
- assertEquals(1, componentFamily.getComponents().size());
- assertTrue(componentFamily.getComponents().contains(
- componentVersion.getComponent()));
- // componentFamily.removeComponent(componentVersion.getComponent());
- // assertEquals(0, componentFamily.getComponents().size());
- }
-
- @Test
- public void testCreateComponentBasedOn() throws Exception {
- Version componentVersion = componentFamily.createComponentBasedOn(
- "Test Component", "Some description", bundle);
- assertEquals("Test Component", componentVersion.getComponent()
- .getName());
- }
-
- @Test
- public void testGetComponent() throws Exception {
- assertNull(componentFamily.getComponent("Test Component"));
- Version componentVersion = componentFamily.createComponentBasedOn(
- "Test Component", "Some description", bundle);
- assertNotNull(componentFamily.getComponent("Test Component"));
- assertEquals(componentVersion.getComponent(),
- componentFamily.getComponent("Test Component"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java
deleted file mode 100644
index 211c725..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentRegistryTest.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.net.URL;
-import java.util.List;
-
-import org.apache.taverna.component.api.ComponentException;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.profile.Profile;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- *
- *
- * @author David Withers
- */
-@Ignore
-public abstract class ComponentRegistryTest extends Harness {
- private Profile componentProfile;
-
- @Before
- public void setup() throws Exception {
- URL componentProfileUrl = getClass().getClassLoader().getResource(
- "ValidationComponent.xml");
- assertNotNull(componentProfileUrl);
- componentProfile = util.getProfile(componentProfileUrl);
- }
-
- @After
- public void tearDown() throws Exception {
- for (Family componentFamily : componentRegistry.getComponentFamilies()) {
- componentRegistry.removeComponentFamily(componentFamily);
- }
- }
-
- @Test
- public void testGetComponentFamilies() throws Exception {
- assertEquals(0, componentRegistry.getComponentFamilies().size());
- assertEquals(0, componentRegistry.getComponentFamilies().size());
- Family componentFamily = componentRegistry.createComponentFamily(
- "TestComponentFamily", componentProfile, "Some description",
- null, null);
- assertEquals(1, componentRegistry.getComponentFamilies().size());
- assertTrue(componentRegistry.getComponentFamilies().contains(
- componentFamily));
- componentRegistry.removeComponentFamily(componentFamily);
- assertEquals(0, componentRegistry.getComponentFamilies().size());
- }
-
- @Test
- public void testGetComponentFamily() throws Exception {
- assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
- assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
- Family componentFamily = componentRegistry.createComponentFamily(
- "TestComponentFamily", componentProfile, "Some description",
- null, null);
- assertNotNull(componentRegistry
- .getComponentFamily("TestComponentFamily"));
- assertNotNull(componentRegistry
- .getComponentFamily("TestComponentFamily"));
- assertEquals(componentFamily,
- componentRegistry.getComponentFamily("TestComponentFamily"));
- componentRegistry.removeComponentFamily(componentFamily);
- assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
- }
-
- @Test
- public void testCreateComponentFamily() throws Exception {
- assertEquals(0, componentRegistry.getComponentFamilies().size());
- assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
- Family componentFamily = componentRegistry.createComponentFamily(
- "TestComponentFamily", componentProfile, "Some description",
- null, null);
- assertEquals("TestComponentFamily", componentFamily.getName());
- assertEquals(componentRegistry, componentFamily.getComponentRegistry());
- assertEquals(0, componentFamily.getComponents().size());
- // assertEquals(componentProfile,
- // componentFamily.getComponentProfile());
- assertEquals(1, componentRegistry.getComponentFamilies().size());
- assertNotNull(componentRegistry
- .getComponentFamily("TestComponentFamily"));
- assertEquals(componentFamily,
- componentRegistry.getComponentFamily("TestComponentFamily"));
- }
-
- @Test(expected = ComponentException.class)
- public void testCreateComponentFamilyDuplicate() throws Exception {
- componentRegistry.createComponentFamily("TestComponentFamily",
- componentProfile, "Some description", null, null);
- componentRegistry.createComponentFamily("TestComponentFamily",
- componentProfile, "Some description", null, null);
- }
-
- @Test(expected = ComponentException.class)
- public void testCreateComponentFamilyNullProfile() throws Exception {
- componentRegistry.createComponentFamily("TestComponentFamily", null,
- "Some description", null, null);
- }
-
- @Test(expected = ComponentException.class)
- public void testCreateComponentFamilyNullName() throws Exception {
- componentRegistry.createComponentFamily(null, componentProfile,
- "Some description", null, null);
- }
-
- @Test
- public void testRemoveComponentFamily() throws Exception {
- assertEquals(0, componentRegistry.getComponentFamilies().size());
- assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
- Family componentFamily = componentRegistry.createComponentFamily(
- "TestComponentFamily", componentProfile, "Some description",
- null, null);
- assertEquals(1, componentRegistry.getComponentFamilies().size());
- assertNotNull(componentRegistry
- .getComponentFamily("TestComponentFamily"));
- assertEquals(componentFamily,
- componentRegistry.getComponentFamily("TestComponentFamily"));
- componentRegistry.removeComponentFamily(componentFamily);
- assertEquals(0, componentRegistry.getComponentFamilies().size());
- assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
- }
-
- @Test
- public void testGetResistryBase() throws Exception {
- assertEquals(componentRegistryUrl, componentRegistry.getRegistryBase());
- }
-
- @Test
- public void testGetComponentProfiles() throws Exception {
- assertNotNull(componentRegistry.getComponentProfiles());
- }
-
- @Test
- public void testAddComponentProfile() throws Exception {
- List<Profile> componentProfiles = componentRegistry
- .getComponentProfiles();
- boolean contained = false;
- for (Profile p : componentProfiles) {
- if (p.getId().equals(componentProfile.getId())) {
- contained = true;
- }
- }
- assertFalse(contained);
- int componentProfileCount = componentProfiles.size();
- componentRegistry.addComponentProfile(componentProfile, null, null);
- int newSize = componentRegistry.getComponentProfiles().size();
- assertEquals(componentProfileCount + 1, newSize);
- }
-
- @Test(expected = ComponentException.class)
- public void testAddComponentProfileNullProfile() throws Exception {
- componentRegistry.addComponentProfile(null, null, null);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java
deleted file mode 100644
index ac9fc47..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.net.URL;
-
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.Profile;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
-
-/**
- *
- *
- * @author David Withers
- */
-@Ignore
-public class ComponentTest extends Harness {
- private Family componentFamily;
- private Component component;
- private WorkflowBundle bundle;
-
- @Before
- public void setUp() throws Exception {
- URL dataflowUrl = getClass().getClassLoader().getResource(
- "beanshell_test.t2flow");
- assertNotNull(dataflowUrl);
- bundle = new WorkflowBundleIO().readBundle(dataflowUrl, null);
- URL componentProfileUrl = getClass().getClassLoader().getResource(
- "ValidationComponent.xml");
- assertNotNull(componentProfileUrl);
- Profile componentProfile = util
- .getProfile(componentProfileUrl);
- componentFamily = componentRegistry.createComponentFamily(
- "Test Component Family", componentProfile, "Some description",
- null, null);
- component = componentFamily.createComponentBasedOn("Test Component",
- "Some description", bundle).getComponent();
- }
-
- @After
- public void tearDown() throws Exception {
- componentRegistry.removeComponentFamily(componentFamily);
- }
-
- @Test
- public void testGetName() throws Exception {
- assertEquals("Test Component", component.getName());
- assertEquals("Test Component", component.getName());
- }
-
- @Test
- public void testGetComponentVersionMap() throws Exception {
- assertNotNull(component.getComponentVersionMap());
- assertEquals(1, component.getComponentVersionMap().size());
- assertEquals(component, component.getComponentVersionMap().get(1)
- .getComponent());
- }
-
- @Test
- public void testGetComponentVersion() throws Exception {
- assertNotNull(component.getComponentVersion(1));
- assertNull(component.getComponentVersion(2));
- }
-
- @Test
- public void testAddVersionBasedOn() throws Exception {
- assertNotNull(component.getComponentVersion(1));
- assertNull(component.getComponentVersion(2));
- Version componentVersion = component.addVersionBasedOn(bundle,
- "Some description");
- assertNotNull(componentVersion);
- assertEquals(component, componentVersion.getComponent());
- assertEquals(2, componentVersion.getVersionNumber().intValue());
- assertEquals(bundle.getIdentifier(), componentVersion.getImplementation()
- .getIdentifier());
- }
-
- @Test
- public void testGetComponentURL() throws Exception {
- assertNotNull(component.getComponentURL());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java
deleted file mode 100644
index 962f8dd..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/ComponentVersionTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.net.URL;
-
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.Version;
-import org.apache.taverna.component.api.profile.Profile;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
-
-/**
- *
- *
- * @author David Withers
- */
-@Ignore
-public class ComponentVersionTest extends Harness {
- private Family componentFamily;
- private WorkflowBundle bundle;
- private Version componentVersion;
-
- @Before
- public void setUp() throws Exception {
- URL dataflowUrl = getClass().getClassLoader().getResource(
- "beanshell_test.t2flow");
- assertNotNull(dataflowUrl);
- bundle = new WorkflowBundleIO().readBundle(dataflowUrl, null);
- URL componentProfileUrl = getClass().getClassLoader().getResource(
- "ValidationComponent.xml");
- assertNotNull(componentProfileUrl);
- Profile componentProfile = util.getProfile(componentProfileUrl);
- componentFamily = componentRegistry.createComponentFamily(
- "Test Component Family", componentProfile, "Some description",
- null, null);
- componentVersion = componentFamily.createComponentBasedOn(
- "Test Component", "Some description", bundle);
- }
-
- @After
- public void tearDown() throws Exception {
- componentRegistry.removeComponentFamily(componentFamily);
- }
-
- @Test
- public void testGetVersionNumber() throws Exception {
- assertNotNull(componentVersion.getVersionNumber());
- assertEquals(componentVersion.getVersionNumber(),
- componentVersion.getVersionNumber());
- }
-
- @Test
- public void testGetDescription() throws Exception {
- assertNotNull(componentVersion.getDescription());
- }
-
- @Test
- public void testGetDataflow() throws Exception {
- assertNotNull(componentVersion.getImplementation());
- assertEquals(bundle.getIdentifier(), componentVersion.getImplementation()
- .getIdentifier());
- }
-
- @Test
- public void testGetComponent() throws Exception {
- assertNotNull(componentVersion.getComponent());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/Harness.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/Harness.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/Harness.java
deleted file mode 100644
index 3bad69b..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/Harness.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package net.sf.taverna.t2.component.registry;
-
-import java.net.URL;
-
-import org.apache.taverna.component.api.Registry;
-
-public class Harness {
- public static URL componentRegistryUrl;
- public static Registry componentRegistry;
- public static ComponentUtil util;
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamilyTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamilyTest.java
deleted file mode 100644
index a6ed62e..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentFamilyTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry.local;
-
-import net.sf.taverna.t2.component.registry.ComponentFamilyTest;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-/**
- *
- *
- * @author David Withers
- */
-public class LocalComponentFamilyTest extends ComponentFamilyTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- RegistrySupport.pre();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- RegistrySupport.post();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java
deleted file mode 100644
index 157edf7..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentRegistryTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry.local;
-
-import static org.junit.Assert.assertSame;
-import net.sf.taverna.t2.component.registry.ComponentRegistryTest;
-
-import org.apache.taverna.component.api.Registry;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- *
- *
- * @author David Withers
- */
-public class LocalComponentRegistryTest extends ComponentRegistryTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- RegistrySupport.pre();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- RegistrySupport.post();
- }
-
- @Test
- public void testGetComponentRegistry() throws Exception {
- Registry getAgain = RegistrySupport.factory
- .getComponentRegistry(componentRegistryUrl);
- assertSame(componentRegistry, getAgain);
- }
-
- @Test
- @Ignore("broken")
- @Override
- public void testAddComponentProfile() throws Exception {
- super.testAddComponentProfile();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentTest.java
deleted file mode 100644
index a65a416..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry.local;
-
-import net.sf.taverna.t2.component.registry.ComponentTest;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-/**
- *
- *
- * @author David Withers
- */
-public class LocalComponentTest extends ComponentTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- RegistrySupport.pre();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- RegistrySupport.post();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersionTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersionTest.java
deleted file mode 100644
index 8262ebc..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/LocalComponentVersionTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry.local;
-
-import net.sf.taverna.t2.component.registry.ComponentVersionTest;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-/**
- *
- *
- * @author David Withers
- */
-public class LocalComponentVersionTest extends ComponentVersionTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- RegistrySupport.pre();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- RegistrySupport.post();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/RegistrySupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/RegistrySupport.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/RegistrySupport.java
deleted file mode 100644
index c015a96..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/local/RegistrySupport.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package net.sf.taverna.t2.component.registry.local;
-
-import static java.lang.System.getProperty;
-import static net.sf.taverna.t2.component.registry.Harness.componentRegistry;
-import static net.sf.taverna.t2.component.registry.Harness.componentRegistryUrl;
-import static org.apache.commons.io.FileUtils.deleteDirectory;
-
-import java.io.File;
-
-class RegistrySupport {
- private static File testRegistry;
- final static LocalComponentRegistryFactory factory = new LocalComponentRegistryFactory();
-
- public static void pre() throws Exception {
- testRegistry = new File(getProperty("java.io.tmpdir"), "TestRegistry");
- testRegistry.mkdir();
- componentRegistryUrl = testRegistry.toURI().toURL();
- componentRegistry = factory.getComponentRegistry(componentRegistryUrl);
- }
-
- public static void post() throws Exception {
- deleteDirectory(testRegistry);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamilyTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamilyTest.java
deleted file mode 100644
index 7874fa4..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentFamilyTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import net.sf.taverna.t2.component.registry.ComponentFamilyTest;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-
-/**
- *
- *
- * @author David Withers
- */
-@Ignore
-public class NewComponentFamilyTest extends ComponentFamilyTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- RegistrySupport.pre();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- RegistrySupport.post();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java
deleted file mode 100644
index 188e2e1..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentRegistryTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.component.registry.standard;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
-import java.net.URL;
-
-import net.sf.taverna.t2.component.registry.ComponentRegistryTest;
-
-import org.apache.taverna.component.api.Version;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
-
-/**
- *
- *
- * @author David Withers
- */
-@Ignore("affects remote service")
-public class NewComponentRegistryTest extends ComponentRegistryTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- RegistrySupport.pre();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- RegistrySupport.post();
- }
-
- @Test
- public void testGetComponentRegistry() throws Exception {
- assertSame(componentRegistry,
- RegistrySupport.factory.getComponentRegistry(componentRegistryUrl));
- }
-
- @Test
- public void testUploadWorkflow() throws Exception {
- URL dataflowUrl = getClass().getClassLoader().getResource(
- "beanshell_test.t2flow");
- WorkflowBundle bundle = new WorkflowBundleIO().readBundle(dataflowUrl, null);
-
- NewComponentRegistry registry = (NewComponentRegistry) RegistrySupport.factory.getComponentRegistry(componentRegistryUrl);
- Version v = registry.createComponentFrom(null, "Test Workflow",
- "test description", bundle, null, Policy.PRIVATE);
- assertEquals("test description", v.getDescription());
- registry.deleteComponent((NewComponent) v.getComponent());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentTest.java
deleted file mode 100644
index 6ea1cc0..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import net.sf.taverna.t2.component.registry.ComponentTest;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-
-/**
- *
- *
- * @author David Withers
- */
-@Ignore
-public class NewComponentTest extends ComponentTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- RegistrySupport.pre();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- RegistrySupport.post();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentVersionTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentVersionTest.java
deleted file mode 100644
index 4e428c7..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/NewComponentVersionTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import net.sf.taverna.t2.component.registry.ComponentVersionTest;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-
-/**
- *
- *
- * @author David Withers
- */
-@Ignore
-public class NewComponentVersionTest extends ComponentVersionTest {
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- RegistrySupport.pre();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- RegistrySupport.post();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java
deleted file mode 100644
index 18902e1..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/component/registry/standard/RegistrySupport.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package net.sf.taverna.t2.component.registry.standard;
-
-import static net.sf.taverna.t2.component.registry.Harness.componentRegistry;
-import static net.sf.taverna.t2.component.registry.Harness.componentRegistryUrl;
-
-import java.net.URL;
-
-import org.apache.taverna.component.api.Component;
-import org.apache.taverna.component.api.Family;
-import org.apache.taverna.component.api.profile.Profile;
-
-class RegistrySupport {
- static final String DEPLOYMENT = "http://aeon.cs.man.ac.uk:3006";
- static final NewComponentRegistryFactory factory = new NewComponentRegistryFactory();// FIXME
-
- public static void pre() throws Exception {
- componentRegistryUrl = new URL(DEPLOYMENT);
- componentRegistry = factory.getComponentRegistry(componentRegistryUrl);
- }
-
- public static void post() throws Exception {
- NewComponentRegistry registry = (NewComponentRegistry) factory
- .getComponentRegistry(componentRegistryUrl);
- for (Profile p : registry.getComponentProfiles())
- registry.client.delete("/file.xml", "id=" + p.getId());
- for (Family f : registry.getComponentFamilies()) {
- for (Component c : f.getComponents())
- registry.deleteComponent((NewComponent) c);
- registry.client.delete("/pack.xml", "id="
- + ((NewComponentFamily) f).getId());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/net/sf/taverna/t2/util/AnnotationTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/net/sf/taverna/t2/util/AnnotationTest.java b/taverna-component-activity/src/test/java/net/sf/taverna/t2/util/AnnotationTest.java
deleted file mode 100644
index 930bc0c..0000000
--- a/taverna-component-activity/src/test/java/net/sf/taverna/t2/util/AnnotationTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package net.sf.taverna.t2.util;
-
-import static org.junit.Assert.*;
-
-import java.io.IOException;
-
-import net.sf.taverna.t2.component.utils.AnnotationUtils;
-
-import org.junit.Test;
-
-import uk.org.taverna.scufl2.api.container.WorkflowBundle;
-import uk.org.taverna.scufl2.api.io.ReaderException;
-import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
-
-public class AnnotationTest {
- //uk.org.taverna.scufl2.annotation.AnnotationTools anntoo;
- @Test
- public void test() throws ReaderException, IOException {
- AnnotationUtils au = new AnnotationUtils();
- WorkflowBundleIO b = new WorkflowBundleIO();
- final String WORKFLOW_FILE = "/hello_anyone.wfbundle";
- final String TITLE = "Hello Anyone";
- final String DESC = "An extension to helloworld.t2flow - this workflow takes a workflow input \"name\" which is combined with the string constant \"Hello, \" using the local worker \"Concatenate two strings\", and outputs the produced string to the workflow output \"greeting\".";
-
- WorkflowBundle bdl = b.readBundle(
- getClass().getResource(WORKFLOW_FILE), null);
- assertEquals(TITLE, au.getTitle(bdl, "---NOT---GIVEN---"));
- assertEquals(DESC, au.getDescription(bdl, "---NOT---GIVEN---"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/org/apache/taverna/component/AnnotationTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/AnnotationTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/AnnotationTest.java
new file mode 100644
index 0000000..aa711fb
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/AnnotationTest.java
@@ -0,0 +1,30 @@
+package org.apache.taverna.component;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import org.apache.taverna.component.utils.AnnotationUtils;
+import org.junit.Test;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.io.ReaderException;
+import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
+
+public class AnnotationTest {
+ //uk.org.taverna.scufl2.annotation.AnnotationTools anntoo;
+ @Test
+ public void test() throws ReaderException, IOException {
+ AnnotationUtils au = new AnnotationUtils();
+ WorkflowBundleIO b = new WorkflowBundleIO();
+ final String WORKFLOW_FILE = "/hello_anyone.wfbundle";
+ final String TITLE = "Hello Anyone";
+ final String DESC = "An extension to helloworld.t2flow - this workflow takes a workflow input \"name\" which is combined with the string constant \"Hello, \" using the local worker \"Concatenate two strings\", and outputs the produced string to the workflow output \"greeting\".";
+
+ WorkflowBundle bdl = b.readBundle(
+ getClass().getResource(WORKFLOW_FILE), null);
+ assertEquals(TITLE, au.getTitle(bdl, "---NOT---GIVEN---"));
+ assertEquals(DESC, au.getDescription(bdl, "---NOT---GIVEN---"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/org/apache/taverna/component/ComponentActivityTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/ComponentActivityTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/ComponentActivityTest.java
new file mode 100644
index 0000000..322b848
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/ComponentActivityTest.java
@@ -0,0 +1,107 @@
+package org.apache.taverna.component;
+
+import org.apache.taverna.component.ComponentActivity;
+import org.apache.taverna.component.ComponentActivityConfigurationBean;
+import org.apache.taverna.component.ComponentActivityFactory;
+
+
+public class ComponentActivityTest {
+
+ @SuppressWarnings("unused")
+ private ComponentActivityConfigurationBean configBean;
+
+ @SuppressWarnings("unused")
+ private ComponentActivity activity = new ComponentActivityFactory().createActivity(); // FIXME
+
+/* @Before
+ public void makeConfigBean() throws Exception {
+ configBean = new ComponentActivityConfigurationBean();
+ configBean.setExampleString("something");
+ configBean
+ .setExampleUri(URI.create("http://localhost:8080/myEndPoint"));
+ }
+
+ @Test(expected = ActivityConfigurationException.class)
+ public void invalidConfiguration() throws ActivityConfigurationException {
+ ComponentActivityConfigurationBean invalidBean = new ComponentActivityConfigurationBean();
+ invalidBean.setExampleString("invalidExample");
+ // Should throw ActivityConfigurationException
+ activity.configure(invalidBean);
+ }
+
+ @Test
+ public void executeAsynch() throws Exception {
+ activity.configure(configBean);
+
+ Map<String, Object> inputs = new HashMap<String, Object>();
+ inputs.put("firstInput", "hello");
+
+ Map<String, Class<?>> expectedOutputTypes = new HashMap<String, Class<?>>();
+ expectedOutputTypes.put("simpleOutput", String.class);
+ expectedOutputTypes.put("moreOutputs", String.class);
+
+ Map<String, Object> outputs = ActivityInvoker.invokeAsyncActivity(
+ activity, inputs, expectedOutputTypes);
+
+ assertEquals("Unexpected outputs", 2, outputs.size());
+ assertEquals("simple", outputs.get("simpleOutput"));
+ assertEquals(Arrays.asList("Value 1", "Value 2"), outputs
+ .get("moreOutputs"));
+
+ }
+
+ @Test
+ public void reConfiguredActivity() throws Exception {
+ assertEquals("Unexpected inputs", 0, activity.getInputPorts().size());
+ assertEquals("Unexpected outputs", 0, activity.getOutputPorts().size());
+
+ activity.configure(configBean);
+ assertEquals("Unexpected inputs", 1, activity.getInputPorts().size());
+ assertEquals("Unexpected outputs", 2, activity.getOutputPorts().size());
+
+ activity.configure(configBean);
+ // Should not change on reconfigure
+ assertEquals("Unexpected inputs", 1, activity.getInputPorts().size());
+ assertEquals("Unexpected outputs", 2, activity.getOutputPorts().size());
+ }
+
+ @Test
+ public void reConfiguredSpecialPorts() throws Exception {
+ activity.configure(configBean);
+
+ ComponentActivityConfigurationBean specialBean = new ComponentActivityConfigurationBean();
+ specialBean.setExampleString("specialCase");
+ specialBean.setExampleUri(URI
+ .create("http://localhost:8080/myEndPoint"));
+ activity.configure(specialBean);
+ // Should now have added the optional ports
+ assertEquals("Unexpected inputs", 2, activity.getInputPorts().size());
+ assertEquals("Unexpected outputs", 3, activity.getOutputPorts().size());
+ }
+
+ @Test
+ public void configureActivity() throws Exception {
+ Set<String> expectedInputs = new HashSet<String>();
+ expectedInputs.add("firstInput");
+
+ Set<String> expectedOutputs = new HashSet<String>();
+ expectedOutputs.add("simpleOutput");
+ expectedOutputs.add("moreOutputs");
+
+ activity.configure(configBean);
+
+ Set<ActivityInputPort> inputPorts = activity.getInputPorts();
+ assertEquals(expectedInputs.size(), inputPorts.size());
+ for (ActivityInputPort inputPort : inputPorts) {
+ assertTrue("Wrong input : " + inputPort.getName(), expectedInputs
+ .remove(inputPort.getName()));
+ }
+
+ Set<OutputPort> outputPorts = activity.getOutputPorts();
+ assertEquals(expectedOutputs.size(), outputPorts.size());
+ for (OutputPort outputPort : outputPorts) {
+ assertTrue("Wrong output : " + outputPort.getName(),
+ expectedOutputs.remove(outputPort.getName()));
+ }
+ }*/
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentFamilyTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentFamilyTest.java
new file mode 100644
index 0000000..f4fea1f
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentFamilyTest.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.apache.taverna.component.api.Family;
+import org.apache.taverna.component.api.Version;
+import org.apache.taverna.component.api.profile.Profile;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+@Ignore
+public class ComponentFamilyTest extends Harness {
+ private Family componentFamily;
+ private Profile componentProfile;
+ private WorkflowBundle bundle;
+
+ @Before
+ public void setup() throws Exception {
+ URL componentProfileUrl = getClass().getClassLoader().getResource(
+ "ValidationComponent.xml");
+ assertNotNull(componentProfileUrl);
+ componentProfile = util.getProfile(componentProfileUrl);
+ componentRegistry.addComponentProfile(componentProfile, null, null);
+ URL dataflowUrl = getClass().getClassLoader().getResource(
+ "beanshell_test.t2flow");
+ assertNotNull(dataflowUrl);
+ bundle = new WorkflowBundleIO().readBundle(dataflowUrl, null);
+ componentFamily = componentRegistry.createComponentFamily(
+ "Test Component Family", componentProfile, "Some description",
+ null, null);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ componentRegistry.removeComponentFamily(componentFamily);
+ }
+
+ @Test
+ public void testGetComponentRegistry() throws Exception {
+ assertEquals(componentRegistry, componentFamily.getComponentRegistry());
+ }
+
+ @Test
+ public void testGetName() throws Exception {
+ assertEquals("Test Component Family", componentFamily.getName());
+ assertEquals("Test Component Family", componentFamily.getName());
+ }
+
+ @Test
+ public void testGetComponentProfile() throws Exception {
+ Profile componentProfile2 = componentFamily.getComponentProfile();
+ assertNotNull(componentProfile2);
+ String id = componentProfile.getId();
+ String id2 = componentProfile2.getId();
+ assertEquals(id, id2);
+ }
+
+ @Test
+ public void testGetComponents() throws Exception {
+ assertEquals(0, componentFamily.getComponents().size());
+ assertEquals(0, componentFamily.getComponents().size());
+ Version componentVersion = componentFamily.createComponentBasedOn(
+ "Test Component", "Some description", bundle);
+ assertEquals(1, componentFamily.getComponents().size());
+ assertTrue(componentFamily.getComponents().contains(
+ componentVersion.getComponent()));
+ // componentFamily.removeComponent(componentVersion.getComponent());
+ // assertEquals(0, componentFamily.getComponents().size());
+ }
+
+ @Test
+ public void testCreateComponentBasedOn() throws Exception {
+ Version componentVersion = componentFamily.createComponentBasedOn(
+ "Test Component", "Some description", bundle);
+ assertEquals("Test Component", componentVersion.getComponent()
+ .getName());
+ }
+
+ @Test
+ public void testGetComponent() throws Exception {
+ assertNull(componentFamily.getComponent("Test Component"));
+ Version componentVersion = componentFamily.createComponentBasedOn(
+ "Test Component", "Some description", bundle);
+ assertNotNull(componentFamily.getComponent("Test Component"));
+ assertEquals(componentVersion.getComponent(),
+ componentFamily.getComponent("Test Component"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentRegistryTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentRegistryTest.java
new file mode 100644
index 0000000..6aa0591
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentRegistryTest.java
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URL;
+import java.util.List;
+
+import org.apache.taverna.component.api.ComponentException;
+import org.apache.taverna.component.api.Family;
+import org.apache.taverna.component.api.profile.Profile;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+@Ignore
+public abstract class ComponentRegistryTest extends Harness {
+ private Profile componentProfile;
+
+ @Before
+ public void setup() throws Exception {
+ URL componentProfileUrl = getClass().getClassLoader().getResource(
+ "ValidationComponent.xml");
+ assertNotNull(componentProfileUrl);
+ componentProfile = util.getProfile(componentProfileUrl);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ for (Family componentFamily : componentRegistry.getComponentFamilies()) {
+ componentRegistry.removeComponentFamily(componentFamily);
+ }
+ }
+
+ @Test
+ public void testGetComponentFamilies() throws Exception {
+ assertEquals(0, componentRegistry.getComponentFamilies().size());
+ assertEquals(0, componentRegistry.getComponentFamilies().size());
+ Family componentFamily = componentRegistry.createComponentFamily(
+ "TestComponentFamily", componentProfile, "Some description",
+ null, null);
+ assertEquals(1, componentRegistry.getComponentFamilies().size());
+ assertTrue(componentRegistry.getComponentFamilies().contains(
+ componentFamily));
+ componentRegistry.removeComponentFamily(componentFamily);
+ assertEquals(0, componentRegistry.getComponentFamilies().size());
+ }
+
+ @Test
+ public void testGetComponentFamily() throws Exception {
+ assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
+ assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
+ Family componentFamily = componentRegistry.createComponentFamily(
+ "TestComponentFamily", componentProfile, "Some description",
+ null, null);
+ assertNotNull(componentRegistry
+ .getComponentFamily("TestComponentFamily"));
+ assertNotNull(componentRegistry
+ .getComponentFamily("TestComponentFamily"));
+ assertEquals(componentFamily,
+ componentRegistry.getComponentFamily("TestComponentFamily"));
+ componentRegistry.removeComponentFamily(componentFamily);
+ assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
+ }
+
+ @Test
+ public void testCreateComponentFamily() throws Exception {
+ assertEquals(0, componentRegistry.getComponentFamilies().size());
+ assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
+ Family componentFamily = componentRegistry.createComponentFamily(
+ "TestComponentFamily", componentProfile, "Some description",
+ null, null);
+ assertEquals("TestComponentFamily", componentFamily.getName());
+ assertEquals(componentRegistry, componentFamily.getComponentRegistry());
+ assertEquals(0, componentFamily.getComponents().size());
+ // assertEquals(componentProfile,
+ // componentFamily.getComponentProfile());
+ assertEquals(1, componentRegistry.getComponentFamilies().size());
+ assertNotNull(componentRegistry
+ .getComponentFamily("TestComponentFamily"));
+ assertEquals(componentFamily,
+ componentRegistry.getComponentFamily("TestComponentFamily"));
+ }
+
+ @Test(expected = ComponentException.class)
+ public void testCreateComponentFamilyDuplicate() throws Exception {
+ componentRegistry.createComponentFamily("TestComponentFamily",
+ componentProfile, "Some description", null, null);
+ componentRegistry.createComponentFamily("TestComponentFamily",
+ componentProfile, "Some description", null, null);
+ }
+
+ @Test(expected = ComponentException.class)
+ public void testCreateComponentFamilyNullProfile() throws Exception {
+ componentRegistry.createComponentFamily("TestComponentFamily", null,
+ "Some description", null, null);
+ }
+
+ @Test(expected = ComponentException.class)
+ public void testCreateComponentFamilyNullName() throws Exception {
+ componentRegistry.createComponentFamily(null, componentProfile,
+ "Some description", null, null);
+ }
+
+ @Test
+ public void testRemoveComponentFamily() throws Exception {
+ assertEquals(0, componentRegistry.getComponentFamilies().size());
+ assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
+ Family componentFamily = componentRegistry.createComponentFamily(
+ "TestComponentFamily", componentProfile, "Some description",
+ null, null);
+ assertEquals(1, componentRegistry.getComponentFamilies().size());
+ assertNotNull(componentRegistry
+ .getComponentFamily("TestComponentFamily"));
+ assertEquals(componentFamily,
+ componentRegistry.getComponentFamily("TestComponentFamily"));
+ componentRegistry.removeComponentFamily(componentFamily);
+ assertEquals(0, componentRegistry.getComponentFamilies().size());
+ assertNull(componentRegistry.getComponentFamily("TestComponentFamily"));
+ }
+
+ @Test
+ public void testGetResistryBase() throws Exception {
+ assertEquals(componentRegistryUrl, componentRegistry.getRegistryBase());
+ }
+
+ @Test
+ public void testGetComponentProfiles() throws Exception {
+ assertNotNull(componentRegistry.getComponentProfiles());
+ }
+
+ @Test
+ public void testAddComponentProfile() throws Exception {
+ List<Profile> componentProfiles = componentRegistry
+ .getComponentProfiles();
+ boolean contained = false;
+ for (Profile p : componentProfiles) {
+ if (p.getId().equals(componentProfile.getId())) {
+ contained = true;
+ }
+ }
+ assertFalse(contained);
+ int componentProfileCount = componentProfiles.size();
+ componentRegistry.addComponentProfile(componentProfile, null, null);
+ int newSize = componentRegistry.getComponentProfiles().size();
+ assertEquals(componentProfileCount + 1, newSize);
+ }
+
+ @Test(expected = ComponentException.class)
+ public void testAddComponentProfileNullProfile() throws Exception {
+ componentRegistry.addComponentProfile(null, null, null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentTest.java
new file mode 100644
index 0000000..71549df
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentTest.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.net.URL;
+
+import org.apache.taverna.component.api.Component;
+import org.apache.taverna.component.api.Family;
+import org.apache.taverna.component.api.Version;
+import org.apache.taverna.component.api.profile.Profile;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+@Ignore
+public class ComponentTest extends Harness {
+ private Family componentFamily;
+ private Component component;
+ private WorkflowBundle bundle;
+
+ @Before
+ public void setUp() throws Exception {
+ URL dataflowUrl = getClass().getClassLoader().getResource(
+ "beanshell_test.t2flow");
+ assertNotNull(dataflowUrl);
+ bundle = new WorkflowBundleIO().readBundle(dataflowUrl, null);
+ URL componentProfileUrl = getClass().getClassLoader().getResource(
+ "ValidationComponent.xml");
+ assertNotNull(componentProfileUrl);
+ Profile componentProfile = util
+ .getProfile(componentProfileUrl);
+ componentFamily = componentRegistry.createComponentFamily(
+ "Test Component Family", componentProfile, "Some description",
+ null, null);
+ component = componentFamily.createComponentBasedOn("Test Component",
+ "Some description", bundle).getComponent();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ componentRegistry.removeComponentFamily(componentFamily);
+ }
+
+ @Test
+ public void testGetName() throws Exception {
+ assertEquals("Test Component", component.getName());
+ assertEquals("Test Component", component.getName());
+ }
+
+ @Test
+ public void testGetComponentVersionMap() throws Exception {
+ assertNotNull(component.getComponentVersionMap());
+ assertEquals(1, component.getComponentVersionMap().size());
+ assertEquals(component, component.getComponentVersionMap().get(1)
+ .getComponent());
+ }
+
+ @Test
+ public void testGetComponentVersion() throws Exception {
+ assertNotNull(component.getComponentVersion(1));
+ assertNull(component.getComponentVersion(2));
+ }
+
+ @Test
+ public void testAddVersionBasedOn() throws Exception {
+ assertNotNull(component.getComponentVersion(1));
+ assertNull(component.getComponentVersion(2));
+ Version componentVersion = component.addVersionBasedOn(bundle,
+ "Some description");
+ assertNotNull(componentVersion);
+ assertEquals(component, componentVersion.getComponent());
+ assertEquals(2, componentVersion.getVersionNumber().intValue());
+ assertEquals(bundle.getIdentifier(), componentVersion.getImplementation()
+ .getIdentifier());
+ }
+
+ @Test
+ public void testGetComponentURL() throws Exception {
+ assertNotNull(component.getComponentURL());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentVersionTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentVersionTest.java
new file mode 100644
index 0000000..fdff6b6
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/ComponentVersionTest.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.net.URL;
+
+import org.apache.taverna.component.api.Family;
+import org.apache.taverna.component.api.Version;
+import org.apache.taverna.component.api.profile.Profile;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.io.WorkflowBundleIO;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+@Ignore
+public class ComponentVersionTest extends Harness {
+ private Family componentFamily;
+ private WorkflowBundle bundle;
+ private Version componentVersion;
+
+ @Before
+ public void setUp() throws Exception {
+ URL dataflowUrl = getClass().getClassLoader().getResource(
+ "beanshell_test.t2flow");
+ assertNotNull(dataflowUrl);
+ bundle = new WorkflowBundleIO().readBundle(dataflowUrl, null);
+ URL componentProfileUrl = getClass().getClassLoader().getResource(
+ "ValidationComponent.xml");
+ assertNotNull(componentProfileUrl);
+ Profile componentProfile = util.getProfile(componentProfileUrl);
+ componentFamily = componentRegistry.createComponentFamily(
+ "Test Component Family", componentProfile, "Some description",
+ null, null);
+ componentVersion = componentFamily.createComponentBasedOn(
+ "Test Component", "Some description", bundle);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ componentRegistry.removeComponentFamily(componentFamily);
+ }
+
+ @Test
+ public void testGetVersionNumber() throws Exception {
+ assertNotNull(componentVersion.getVersionNumber());
+ assertEquals(componentVersion.getVersionNumber(),
+ componentVersion.getVersionNumber());
+ }
+
+ @Test
+ public void testGetDescription() throws Exception {
+ assertNotNull(componentVersion.getDescription());
+ }
+
+ @Test
+ public void testGetDataflow() throws Exception {
+ assertNotNull(componentVersion.getImplementation());
+ assertEquals(bundle.getIdentifier(), componentVersion.getImplementation()
+ .getIdentifier());
+ }
+
+ @Test
+ public void testGetComponent() throws Exception {
+ assertNotNull(componentVersion.getComponent());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/Harness.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/Harness.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/Harness.java
new file mode 100644
index 0000000..a1b6576
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/Harness.java
@@ -0,0 +1,12 @@
+package org.apache.taverna.component.registry;
+
+import java.net.URL;
+
+import org.apache.taverna.component.api.Registry;
+import org.apache.taverna.component.registry.ComponentUtil;
+
+public class Harness {
+ public static URL componentRegistryUrl;
+ public static Registry componentRegistry;
+ public static ComponentUtil util;
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentFamilyTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentFamilyTest.java
new file mode 100644
index 0000000..a0e710c
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentFamilyTest.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry.local;
+
+import org.apache.taverna.component.registry.ComponentFamilyTest;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+public class LocalComponentFamilyTest extends ComponentFamilyTest {
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ RegistrySupport.pre();
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ RegistrySupport.post();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentRegistryTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentRegistryTest.java
new file mode 100644
index 0000000..f36ccc3
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentRegistryTest.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry.local;
+
+import static org.junit.Assert.assertSame;
+
+import org.apache.taverna.component.api.Registry;
+import org.apache.taverna.component.registry.ComponentRegistryTest;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+public class LocalComponentRegistryTest extends ComponentRegistryTest {
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ RegistrySupport.pre();
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ RegistrySupport.post();
+ }
+
+ @Test
+ public void testGetComponentRegistry() throws Exception {
+ Registry getAgain = RegistrySupport.factory
+ .getComponentRegistry(componentRegistryUrl);
+ assertSame(componentRegistry, getAgain);
+ }
+
+ @Test
+ @Ignore("broken")
+ @Override
+ public void testAddComponentProfile() throws Exception {
+ super.testAddComponentProfile();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentTest.java
new file mode 100644
index 0000000..f359675
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentTest.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry.local;
+
+import org.apache.taverna.component.registry.ComponentTest;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+public class LocalComponentTest extends ComponentTest {
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ RegistrySupport.pre();
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ RegistrySupport.post();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-component/blob/fb982e2f/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentVersionTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentVersionTest.java
new file mode 100644
index 0000000..6671daa
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/LocalComponentVersionTest.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (C) 2012 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package org.apache.taverna.component.registry.local;
+
+import org.apache.taverna.component.registry.ComponentVersionTest;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+public class LocalComponentVersionTest extends ComponentVersionTest {
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ RegistrySupport.pre();
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ RegistrySupport.post();
+ }
+}