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:47 UTC

[32/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/org/apache/taverna/component/registry/local/RegistrySupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/RegistrySupport.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/RegistrySupport.java
new file mode 100644
index 0000000..59e4c33
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/local/RegistrySupport.java
@@ -0,0 +1,26 @@
+package org.apache.taverna.component.registry.local;
+
+import static java.lang.System.getProperty;
+import static org.apache.commons.io.FileUtils.deleteDirectory;
+import static org.apache.taverna.component.registry.Harness.componentRegistry;
+import static org.apache.taverna.component.registry.Harness.componentRegistryUrl;
+
+import java.io.File;
+
+import org.apache.taverna.component.registry.local.LocalComponentRegistryFactory;
+
+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/org/apache/taverna/component/registry/standard/NewComponentFamilyTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentFamilyTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentFamilyTest.java
new file mode 100644
index 0000000..2882698
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentFamilyTest.java
@@ -0,0 +1,24 @@
+package org.apache.taverna.component.registry.standard;
+
+import org.apache.taverna.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/org/apache/taverna/component/registry/standard/NewComponentRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentRegistryTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentRegistryTest.java
new file mode 100644
index 0000000..999cc6b
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentRegistryTest.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * 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.standard;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
+import java.net.URL;
+
+import org.apache.taverna.component.api.Version;
+import org.apache.taverna.component.registry.ComponentRegistryTest;
+import org.apache.taverna.component.registry.standard.NewComponent;
+import org.apache.taverna.component.registry.standard.NewComponentRegistry;
+import org.apache.taverna.component.registry.standard.Policy;
+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/org/apache/taverna/component/registry/standard/NewComponentTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentTest.java
new file mode 100644
index 0000000..7e43d98
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentTest.java
@@ -0,0 +1,24 @@
+package org.apache.taverna.component.registry.standard;
+
+import org.apache.taverna.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/org/apache/taverna/component/registry/standard/NewComponentVersionTest.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentVersionTest.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentVersionTest.java
new file mode 100644
index 0000000..ccbb606
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/NewComponentVersionTest.java
@@ -0,0 +1,24 @@
+package org.apache.taverna.component.registry.standard;
+
+import org.apache.taverna.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/org/apache/taverna/component/registry/standard/RegistrySupport.java
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/RegistrySupport.java b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/RegistrySupport.java
new file mode 100644
index 0000000..0186291
--- /dev/null
+++ b/taverna-component-activity/src/test/java/org/apache/taverna/component/registry/standard/RegistrySupport.java
@@ -0,0 +1,37 @@
+package org.apache.taverna.component.registry.standard;
+
+import static org.apache.taverna.component.registry.Harness.componentRegistry;
+import static org.apache.taverna.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;
+import org.apache.taverna.component.registry.standard.NewComponent;
+import org.apache.taverna.component.registry.standard.NewComponentFamily;
+import org.apache.taverna.component.registry.standard.NewComponentRegistry;
+import org.apache.taverna.component.registry.standard.NewComponentRegistryFactory;
+
+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/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI
----------------------------------------------------------------------
diff --git a/taverna-component-activity/src/test/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI b/taverna-component-activity/src/test/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI
index d15cdb0..a2a1b06 100644
--- a/taverna-component-activity/src/test/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI
+++ b/taverna-component-activity/src/test/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI
@@ -1 +1 @@
-net.sf.taverna.t2.component.registry.myexperiment.TestPasswordProvider
+org.apache.taverna.component.registry.myexperiment.TestPasswordProvider