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/17 12:46:34 UTC
[07/50] [abbrv] incubator-taverna-plugin-bioinformatics git commit:
taverna-biomart-martservice/
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_3utr.gif
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_3utr.gif b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_3utr.gif
new file mode 100644
index 0000000..3e0e2ac
Binary files /dev/null and b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_3utr.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_5utr.gif
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_5utr.gif b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_5utr.gif
new file mode 100644
index 0000000..2ebe5a5
Binary files /dev/null and b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_5utr.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_cdna.gif
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_cdna.gif b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_cdna.gif
new file mode 100644
index 0000000..ad08e22
Binary files /dev/null and b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_cdna.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_coding.gif
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_coding.gif b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_coding.gif
new file mode 100644
index 0000000..6944b2b
Binary files /dev/null and b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_coding.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_coding_gene_flank.gif
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_coding_gene_flank.gif b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_coding_gene_flank.gif
new file mode 100644
index 0000000..8dbc528
Binary files /dev/null and b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_coding_gene_flank.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_coding_transcript_flank.gif
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_coding_transcript_flank.gif b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_coding_transcript_flank.gif
new file mode 100644
index 0000000..093e316
Binary files /dev/null and b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_coding_transcript_flank.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_gene_exon.gif
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_gene_exon.gif b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_gene_exon.gif
new file mode 100644
index 0000000..9bb1258
Binary files /dev/null and b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_gene_exon.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_gene_exon_intron.gif
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_gene_exon_intron.gif b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_gene_exon_intron.gif
new file mode 100644
index 0000000..ba3b184
Binary files /dev/null and b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_gene_exon_intron.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_gene_flank.gif
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_gene_flank.gif b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_gene_flank.gif
new file mode 100644
index 0000000..d9e0520
Binary files /dev/null and b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_gene_flank.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_peptide.gif
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_peptide.gif b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_peptide.gif
new file mode 100644
index 0000000..6944b2b
Binary files /dev/null and b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_peptide.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_transcript_exon.gif
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_transcript_exon.gif b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_transcript_exon.gif
new file mode 100644
index 0000000..6ac00a4
Binary files /dev/null and b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_transcript_exon.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_transcript_exon_intron.gif
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_transcript_exon_intron.gif b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_transcript_exon_intron.gif
new file mode 100644
index 0000000..aa4e783
Binary files /dev/null and b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_transcript_exon_intron.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_transcript_flank.gif
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_transcript_flank.gif b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_transcript_flank.gif
new file mode 100644
index 0000000..2aece28
Binary files /dev/null and b/taverna-biomart-martservice/src/main/resources/org/biomart/martservice/config/ui/gene_schematic_transcript_flank.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartDatasetTest.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartDatasetTest.java b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartDatasetTest.java
new file mode 100644
index 0000000..abf963d
--- /dev/null
+++ b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartDatasetTest.java
@@ -0,0 +1,335 @@
+/*
+ * Copyright (C) 2003 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate. Authorship
+ * of the modifications may be determined from the ChangeLog placed at
+ * the end of this file.
+ *
+ * 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
+ * USA.
+ *
+ ****************************************************************
+ * Source code information
+ * -----------------------
+ * Filename $RCSfile: MartDatasetTest.java,v $
+ * Revision $Revision: 1.1 $
+ * Release status $State: Exp $
+ * Last modified on $Date: 2007/01/31 14:12:14 $
+ * by $Author: davidwithers $
+ * Created on 4 Aug 2006
+ *****************************************************************/
+package org.biomart.martservice;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author David Withers
+ */
+public class MartDatasetTest extends TestCase {
+
+ private String displayName;
+
+ private String name;
+
+ private String type;
+
+ private int initialBatchSize;
+
+ private int maximumBatchSize;
+
+ private boolean visible;
+
+ private String interfaceValue;
+
+ private String modified;
+
+ private MartURLLocation martUrlLocation;
+
+ private MartDataset martDataset;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ displayName = "dataset-display-name";
+ name = "dataset-name";
+ type = "type";
+ initialBatchSize = 1;
+ maximumBatchSize = 2;
+ visible = true;
+ interfaceValue = "interface";
+ modified = "modified";
+ martUrlLocation = new MartURLLocation();
+ martUrlLocation.setDefault(true);
+ martUrlLocation.setDisplayName("location-display-name");
+ martUrlLocation.setHost("host");
+ martUrlLocation.setName("location-name");
+ martUrlLocation.setPort(42);
+ martUrlLocation.setServerVirtualSchema("server-virtual-schema");
+ martUrlLocation.setVirtualSchema("virtual-schema");
+ martUrlLocation.setVisible(false);
+ martDataset = new MartDataset();
+ martDataset.setDisplayName(displayName);
+ martDataset.setInitialBatchSize(initialBatchSize);
+ martDataset.setMartURLLocation(martUrlLocation);
+ martDataset.setMaximumBatchSize(maximumBatchSize);
+ martDataset.setName(name);
+ martDataset.setType(type);
+ martDataset.setVisible(visible);
+ martDataset.setInterface(interfaceValue);
+ martDataset.setModified(modified);
+ }
+
+ /**
+ * Test method for {@link org.biomart.martservice.MartDataset#hashCode()}.
+ */
+ public void testHashCode() {
+ assertEquals(martDataset.hashCode(), martDataset.hashCode());
+ }
+
+ /**
+ * Test method for
+ * {@link org.biomart.martservice.MartDataset#getDisplayName()}.
+ */
+ public void testGetDisplayName() {
+ assertEquals(martDataset.getDisplayName(), displayName);
+ }
+
+ /**
+ * Test method for
+ * {@link org.biomart.martservice.MartDataset#setDisplayName(java.lang.String)}.
+ */
+ public void testSetDisplayName() {
+ martDataset.setDisplayName("new" + displayName);
+ assertEquals(martDataset.getDisplayName(), "new" + displayName);
+ martDataset.setDisplayName(null);
+ assertNull(martDataset.getDisplayName());
+ }
+
+ /**
+ * Test method for
+ * {@link org.biomart.martservice.MartDataset#getInitialBatchSize()}.
+ */
+ public void testGetInitialBatchSize() {
+ assertEquals(martDataset.getInitialBatchSize(), initialBatchSize);
+ }
+
+ /**
+ * Test method for
+ * {@link org.biomart.martservice.MartDataset#setInitialBatchSize(long)}.
+ */
+ public void testSetInitialBatchSize() {
+ martDataset.setInitialBatchSize(1 + initialBatchSize);
+ assertEquals(martDataset.getInitialBatchSize(), 1 + initialBatchSize);
+ }
+
+ /**
+ * Test method for
+ * {@link org.biomart.martservice.MartDataset#getMaximumBatchSize()}.
+ */
+ public void testGetMaximumBatchSize() {
+ assertEquals(martDataset.getMaximumBatchSize(), maximumBatchSize);
+ }
+
+ /**
+ * Test method for
+ * {@link org.biomart.martservice.MartDataset#setMaximumBatchSize(long)}.
+ */
+ public void testSetMaximumBatchSize() {
+ martDataset.setMaximumBatchSize(1 + maximumBatchSize);
+ assertEquals(martDataset.getMaximumBatchSize(), 1 + maximumBatchSize);
+ }
+
+ /**
+ * Test method for {@link org.biomart.martservice.MartDataset#getName()}.
+ */
+ public void testGetName() {
+ assertEquals(martDataset.getName(), name);
+ }
+
+ /**
+ * Test method for
+ * {@link org.biomart.martservice.MartDataset#setName(java.lang.String)}.
+ */
+ public void testSetName() {
+ martDataset.setName("new" + name);
+ assertEquals(martDataset.getName(), "new" + name);
+ martDataset.setName(null);
+ assertNull(martDataset.getName());
+ }
+
+ /**
+ * Test method for {@link org.biomart.martservice.MartDataset#getType()}.
+ */
+ public void testGetType() {
+ assertEquals(martDataset.getType(), type);
+ }
+
+ /**
+ * Test method for
+ * {@link org.biomart.martservice.MartDataset#setType(java.lang.String)}.
+ */
+ public void testSetType() {
+ martDataset.setType("new" + type);
+ assertEquals(martDataset.getType(), "new" + type);
+ martDataset.setType(null);
+ assertNull(martDataset.getType());
+ }
+
+ /**
+ * Test method for {@link org.biomart.martservice.MartDataset#isVisible()}.
+ */
+ public void testIsVisible() {
+ assertEquals(martDataset.isVisible(), visible);
+ }
+
+ /**
+ * Test method for
+ * {@link org.biomart.martservice.MartDataset#setVisible(boolean)}.
+ */
+ public void testSetVisible() {
+ martDataset.setVisible(!visible);
+ assertEquals(martDataset.isVisible(), !visible);
+ }
+
+ /**
+ * Test method for {@link org.biomart.martservice.MartDataset#getInterface()}.
+ */
+ public void testGetInterface() {
+ assertEquals(martDataset.getInterface(), interfaceValue);
+ }
+
+ /**
+ * Test method for
+ * {@link org.biomart.martservice.MartDataset#setInterface(java.lang.String)}.
+ */
+ public void testSetInterface() {
+ martDataset.setInterface("new" + interfaceValue);
+ assertEquals(martDataset.getInterface(), "new" + interfaceValue);
+ martDataset.setInterface(null);
+ assertNull(martDataset.getInterface());
+ }
+
+ /**
+ * Test method for {@link org.biomart.martservice.MartDataset#getModified()}.
+ */
+ public void testGetModified() {
+ assertEquals(martDataset.getModified(), modified);
+ }
+
+ /**
+ * Test method for
+ * {@link org.biomart.martservice.MartDataset#setModified(java.lang.String)}.
+ */
+ public void testSetModified() {
+ martDataset.setModified("new" + modified);
+ assertEquals(martDataset.getModified(), "new" + modified);
+ martDataset.setModified(null);
+ assertNull(martDataset.getModified());
+ }
+
+ /**
+ * Test method for
+ * {@link org.biomart.martservice.MartDataset#getMartURLLocation()}.
+ */
+ public void testGetMartURLLocation() {
+ assertEquals(martDataset.getMartURLLocation(), martUrlLocation);
+ }
+
+ /**
+ * Test method for
+ * {@link org.biomart.martservice.MartDataset#setMartURLLocation(org.biomart.martservice.MartURLLocation)}.
+ */
+ public void testSetMartURLLocation() {
+ martUrlLocation = new MartURLLocation();
+ martDataset.setMartURLLocation(martUrlLocation);
+ assertEquals(martDataset.getMartURLLocation(), martUrlLocation);
+ martDataset.setMartURLLocation(null);
+ assertNull(martDataset.getMartURLLocation());
+ }
+
+ /**
+ * Test method for
+ * {@link org.biomart.martservice.MartDataset#getVirtualSchema()}.
+ */
+ public void testGetVirtualSchema() {
+ assertEquals(martDataset.getVirtualSchema(), martDataset
+ .getMartURLLocation().getVirtualSchema());
+ martDataset.setMartURLLocation(null);
+ assertNull(martDataset.getVirtualSchema());
+ }
+
+ /**
+ * Test method for
+ * {@link org.biomart.martservice.MartDataset#getQualifiedName()}.
+ */
+ public void testGetQualifiedName() {
+ assertEquals(martDataset.getQualifiedName(), martDataset
+ .getVirtualSchema()
+ + "." + name);
+ martDataset.setMartURLLocation(null);
+ assertEquals(martDataset.getQualifiedName(), name);
+ }
+
+ /**
+ * Test method for {@link org.biomart.martservice.MartDataset#toString()}.
+ */
+ public void testToString() {
+ assertEquals(martDataset.toString(), martDataset.getDisplayName());
+ }
+
+ /**
+ * Test method for
+ * {@link org.biomart.martservice.MartDataset#equals(java.lang.Object)}.
+ */
+ public void testEqualsObject() {
+ MartDataset martDataset2 = new MartDataset();
+ martDataset2.setDisplayName(displayName);
+ martDataset2.setInitialBatchSize(initialBatchSize);
+ martDataset2.setMartURLLocation(martUrlLocation);
+ martDataset2.setMaximumBatchSize(maximumBatchSize);
+ martDataset2.setName(name);
+ martDataset2.setType(type);
+ martDataset2.setVisible(visible);
+
+ assertTrue(martDataset.equals(martDataset));
+ assertTrue(martDataset.equals(martDataset2));
+ assertTrue(martDataset2.equals(martDataset));
+ assertFalse(martDataset.equals(null));
+ assertFalse(martDataset.equals(new Object()));
+ assertFalse(martDataset.equals(new MartRegistry()));
+ martDataset2.setName("new" + name);
+ assertFalse(martDataset.equals(martDataset2));
+ assertFalse(martDataset2.equals(martDataset));
+ }
+
+ /**
+ * Test method for
+ * {@link org.biomart.martservice.MartDataset#getDisplayComparator()}.
+ */
+ public void testGetDisplayComparator() {
+ MartDataset martDataset2 = new MartDataset();
+ martDataset2.setDisplayName(displayName);
+ assertEquals(MartDataset.getDisplayComparator().compare(martDataset, martDataset2), 0);
+ martDataset2.setDisplayName("new" + displayName);
+ assertTrue(MartDataset.getDisplayComparator().compare(martDataset, martDataset2) != 0);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartRegistryTest.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartRegistryTest.java b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartRegistryTest.java
new file mode 100644
index 0000000..5766d60
--- /dev/null
+++ b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartRegistryTest.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2003 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate. Authorship
+ * of the modifications may be determined from the ChangeLog placed at
+ * the end of this file.
+ *
+ * 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
+ * USA.
+ *
+ ****************************************************************
+ * Source code information
+ * -----------------------
+ * Filename $RCSfile: MartRegistryTest.java,v $
+ * Revision $Revision: 1.1 $
+ * Release status $State: Exp $
+ * Last modified on $Date: 2007/01/31 14:12:14 $
+ * by $Author: davidwithers $
+ * Created on 4 Aug 2006
+ *****************************************************************/
+package org.biomart.martservice;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author David Withers
+ */
+public class MartRegistryTest extends TestCase {
+
+ private MartURLLocation martUrlLocation;
+
+ private MartRegistry martRegistry;
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ martUrlLocation = new MartURLLocation();
+ martUrlLocation.setDefault(true);
+ martUrlLocation.setDisplayName("location-display-name");
+ martUrlLocation.setHost("host");
+ martUrlLocation.setName("location-name");
+ martUrlLocation.setPort(42);
+ martUrlLocation.setServerVirtualSchema("server-virtual-schema");
+ martUrlLocation.setVirtualSchema("virtual-schema");
+ martUrlLocation.setVisible(false);
+ martRegistry = new MartRegistry();
+ }
+
+ /**
+ * Test method for {@link org.biomart.martservice.MartRegistry#hashCode()}.
+ */
+ public void testHashCode() {
+ MartRegistry martRegistry2 = new MartRegistry();
+ martRegistry.addMartURLLocation(martUrlLocation);
+ martRegistry2.addMartURLLocation(martUrlLocation);
+ assertEquals(martRegistry.hashCode(), martRegistry.hashCode());
+ assertEquals(martRegistry.hashCode(), martRegistry2.hashCode());
+ }
+
+ /**
+ * Test method for {@link org.biomart.martservice.MartRegistry#getMartURLLocations()}.
+ */
+ public void testGetMartURLLocations() {
+ assertEquals(martRegistry.getMartURLLocations().length, 0);
+ martRegistry.addMartURLLocation(martUrlLocation);
+ assertEquals(martRegistry.getMartURLLocations()[0], martUrlLocation);
+ }
+
+ /**
+ * Test method for {@link org.biomart.martservice.MartRegistry#addMartURLLocation(org.biomart.martservice.MartURLLocation)}.
+ */
+ public void testAddMartURLLocation() {
+ martRegistry.addMartURLLocation(martUrlLocation);
+ MartURLLocation[] martURLLocations = martRegistry.getMartURLLocations();
+ assertEquals(martURLLocations[martURLLocations.length - 1], martUrlLocation);
+ }
+
+ /**
+ * Test method for {@link org.biomart.martservice.MartRegistry#equals(java.lang.Object)}.
+ */
+ public void testEqualsObject() {
+ MartRegistry martRegistry2 = new MartRegistry();
+ martRegistry.addMartURLLocation(martUrlLocation);
+ martRegistry2.addMartURLLocation(martUrlLocation);
+
+ assertTrue(martRegistry.equals(martRegistry));
+ assertTrue(martRegistry.equals(martRegistry2));
+ assertTrue(martRegistry2.equals(martRegistry));
+ assertFalse(martRegistry.equals(null));
+ assertFalse(martRegistry.equals(new Object()));
+ assertFalse(martRegistry.equals(new MartRegistry()));
+ martRegistry2.addMartURLLocation(martUrlLocation);
+ assertFalse(martRegistry.equals(martRegistry2));
+ assertFalse(martRegistry2.equals(martRegistry));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartServiceUtilsTest.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartServiceUtilsTest.java b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartServiceUtilsTest.java
new file mode 100644
index 0000000..d938440
--- /dev/null
+++ b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartServiceUtilsTest.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2003 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate. Authorship
+ * of the modifications may be determined from the ChangeLog placed at
+ * the end of this file.
+ *
+ * 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
+ * USA.
+ *
+ ****************************************************************
+ * Source code information
+ * -----------------------
+ * Filename $RCSfile: MartServiceUtilsTest.java,v $
+ * Revision $Revision: 1.1 $
+ * Release status $State: Exp $
+ * Last modified on $Date: 2007/02/22 18:31:56 $
+ * by $Author: davidwithers $
+ * Created on 22 Feb 2007
+ *****************************************************************/
+package org.biomart.martservice;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+/**
+ *
+ * @author David Withers
+ */
+public class MartServiceUtilsTest {
+
+ /**
+ * Test method for {@link org.biomart.martservice.MartServiceUtils#isProxyHost(java.lang.String)}.
+ */
+ @Test
+ public void testIsProxyHost() {
+ System.setProperty("http.nonProxyHosts", "localhost|127.0.0.1|*.mydomain.com|192.168.1.*");
+ assertFalse(MartServiceUtils.isProxyHost("http://localhost/"));
+ assertFalse(MartServiceUtils.isProxyHost("http://localhost:8080/"));
+ assertFalse(MartServiceUtils.isProxyHost("http://127.0.0.1/"));
+ assertFalse(MartServiceUtils.isProxyHost("http://www.mydomain.com/"));
+ assertFalse(MartServiceUtils.isProxyHost("http://www.sub.mydomain.com/"));
+ assertFalse(MartServiceUtils.isProxyHost("http://192.168.1.1/"));
+ assertFalse(MartServiceUtils.isProxyHost("http://192.168.1.2/"));
+ assertTrue(MartServiceUtils.isProxyHost("http://www.mydomain.co.uk/"));
+ assertTrue(MartServiceUtils.isProxyHost("http://192.168.2.1/"));
+ assertTrue(MartServiceUtils.isProxyHost("http://127.0.0.2/"));
+ assertTrue(MartServiceUtils.isProxyHost("http://nonlocalhost/"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartServiceXMLHandlerTest.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartServiceXMLHandlerTest.java b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartServiceXMLHandlerTest.java
new file mode 100644
index 0000000..4c4dded
--- /dev/null
+++ b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartServiceXMLHandlerTest.java
@@ -0,0 +1,218 @@
+/*
+ * Copyright (C) 2003 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate. Authorship
+ * of the modifications may be determined from the ChangeLog placed at
+ * the end of this file.
+ *
+ * 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
+ * USA.
+ *
+ ****************************************************************
+ * Source code information
+ * -----------------------
+ * Filename $RCSfile: MartServiceXMLHandlerTest.java,v $
+ * Revision $Revision: 1.2 $
+ * Release status $State: Exp $
+ * Last modified on $Date: 2007/10/04 14:16:00 $
+ * by $Author: davidwithers $
+ * Created on 02-Jun-2006
+ *****************************************************************/
+package org.biomart.martservice;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import junit.framework.TestCase;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.Namespace;
+import org.jdom.input.SAXBuilder;
+import org.jdom.output.XMLOutputter;
+
+/**
+ *
+ * @author David Withers
+ */
+public class MartServiceXMLHandlerTest extends TestCase {
+ private XMLOutputter xmlOutputter;
+
+ private SAXBuilder saxBuilder;
+
+ private Namespace namespace;
+
+ private MartService martService;
+
+ private String martServiceXML;
+
+ private MartURLLocation martUrlLocation;
+
+ private String martUrlLocationXML;
+
+ private MartDataset martDataset;
+
+ private String martDatasetXML;
+
+ private MartRegistry martRegistry;
+
+ private String martRegistryXML;
+
+ private String martRegistryXML2;
+
+ /*
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ xmlOutputter = new XMLOutputter();
+ saxBuilder = new SAXBuilder();
+ namespace = Namespace.getNamespace("test-namespace");
+ martService = MartService.getMartService("url-location");
+ martServiceXML = "<MartService xmlns=\"test-namespace\" location=\"url-location\" />";
+ martUrlLocation = new MartURLLocation();
+ martUrlLocation.setDefault(true);
+ martUrlLocation.setDisplayName("location-display-name");
+ martUrlLocation.setHost("host");
+ martUrlLocation.setName("location-name");
+ martUrlLocation.setPort(42);
+ martUrlLocation.setServerVirtualSchema("server-virtual-schema");
+ martUrlLocation.setVirtualSchema("virtual-schema");
+ martUrlLocation.setVisible(false);
+ martUrlLocation.setRedirect(true);
+ martUrlLocationXML = "<MartURLLocation xmlns=\"test-namespace\" default=\"1\" displayName=\"location-display-name\" host=\"host\" name=\"location-name\" port=\"42\" serverVirtualSchema=\"server-virtual-schema\" virtualSchema=\"virtual-schema\" visible=\"0\" redirect=\"1\" />";
+ martDataset = new MartDataset();
+ martDataset.setDisplayName("dataset-display-name");
+ martDataset.setInitialBatchSize(1);
+ martDataset.setMartURLLocation(martUrlLocation);
+ martDataset.setMaximumBatchSize(2);
+ martDataset.setName("dataset-name");
+ martDataset.setType("type");
+ martDataset.setVisible(true);
+ martDataset.setInterface("interface");
+ martDataset.setModified("modified");
+ martDatasetXML = "<MartDataset xmlns=\"test-namespace\" displayName=\"dataset-display-name\" name=\"dataset-name\" type=\"type\" initialBatchSize=\"1\" maximumBatchSize=\"2\" visible=\"true\" interface=\"interface\" modified=\"modified\"><MartURLLocation default=\"1\" displayName=\"location-display-name\" host=\"host\" name=\"location-name\" port=\"42\" serverVirtualSchema=\"server-virtual-schema\" virtualSchema=\"virtual-schema\" visible=\"0\" redirect=\"1\" /></MartDataset>";
+ martRegistry = new MartRegistry();
+ martRegistry.addMartURLLocation(martUrlLocation);
+ martRegistryXML = "<MartRegistry xmlns=\"test-namespace\" ><virtualSchema xmlns=\"test-namespace\" name=\"virtual-schema\" visible=\"0\"><MartURLLocation xmlns=\"test-namespace\" default=\"1\" displayName=\"location-display-name\" host=\"host\" name=\"location-name\" port=\"42\" serverVirtualSchema=\"server-virtual-schema\" visible=\"0\" redirect=\"1\" /></virtualSchema></MartRegistry>";
+ martRegistryXML2 = "<MartRegistry xmlns=\"test-namespace\" ><virtualSchema xmlns=\"test-namespace\" name=\"default\" visible=\"0\"><MartURLLocation xmlns=\"test-namespace\" default=\"1\" displayName=\"location-display-name\" host=\"host\" name=\"location-name\" port=\"42\" serverVirtualSchema=\"server-virtual-schema\" visible=\"0\" redirect=\"1\" /></virtualSchema></MartRegistry>";
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.MartServiceXMLHandler.martServiceToElement(MartService,
+ * Namespace)'
+ */
+ public void testMartServiceToElement() {
+ Element element = MartServiceXMLHandler.martServiceToElement(
+ martService, namespace);
+ assertEquals(xmlOutputter.outputString(element), martServiceXML);
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.MartServiceXMLHandler.elementToMartService(Element)'
+ */
+ public void testElementToMartService() throws JDOMException, IOException {
+ Element element = saxBuilder.build(new StringReader(martServiceXML))
+ .getRootElement();
+ assertEquals(MartServiceXMLHandler.elementToMartService(element),
+ martService);
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.MartServiceXMLHandler.datasetToElement(MartDataset,
+ * Namespace)'
+ */
+ public void testDatasetToElement() {
+ Element element = MartServiceXMLHandler.datasetToElement(martDataset,
+ namespace);
+ assertEquals(xmlOutputter.outputString(element), martDatasetXML);
+// System.out.println(new XMLOutputter().outputString(element));
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.MartServiceXMLHandler.elementToDataset(Element,
+ * Namespace)'
+ */
+ public void testElementToDataset() throws JDOMException, IOException {
+ Element element = saxBuilder.build(new StringReader(martDatasetXML))
+ .getRootElement();
+ assertEquals(
+ MartServiceXMLHandler.elementToDataset(element, namespace),
+ martDataset);
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.MartServiceXMLHandler.elementToRegistry(Element,
+ * Namespace)'
+ */
+ public void testElementToRegistry() throws JDOMException, IOException {
+ Element element = saxBuilder.build(new StringReader(martRegistryXML))
+ .getRootElement();
+ assertEquals(MartServiceXMLHandler
+ .elementToRegistry(element, namespace), martRegistry);
+
+ martUrlLocation.setVirtualSchema("default");
+ element = saxBuilder.build(new StringReader(martRegistryXML2))
+ .getRootElement();
+ assertEquals(MartServiceXMLHandler
+ .elementToRegistry(element, namespace), martRegistry);
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.MartServiceXMLHandler.locationToElement(MartURLLocation,
+ * Namespace)'
+ */
+ public void testLocationToElement() {
+ Element element = MartServiceXMLHandler.locationToElement(
+ martUrlLocation, namespace);
+ assertEquals(xmlOutputter.outputString(element), martUrlLocationXML);
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.MartServiceXMLHandler.elementToLocation(Element)'
+ */
+ public void testElementToLocation() throws JDOMException, IOException {
+ Element element = saxBuilder
+ .build(new StringReader(martUrlLocationXML)).getRootElement();
+ assertEquals(MartServiceXMLHandler.elementToLocation(element),
+ martUrlLocation);
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.MartServiceXMLHandler.elementToMartQuery(Element,
+ * Namespace)'
+ */
+ public void testElementToMartQuery() {
+
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.MartServiceXMLHandler.martQueryToElement(MartQuery,
+ * Namespace)'
+ */
+ public void testMartQueryToElement() {
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartURLLocationTest.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartURLLocationTest.java b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartURLLocationTest.java
new file mode 100644
index 0000000..aa5ad8a
--- /dev/null
+++ b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/MartURLLocationTest.java
@@ -0,0 +1,255 @@
+/*
+ * Copyright (C) 2003 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate. Authorship
+ * of the modifications may be determined from the ChangeLog placed at
+ * the end of this file.
+ *
+ * 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
+ * USA.
+ *
+ ****************************************************************
+ * Source code information
+ * -----------------------
+ * Filename $RCSfile: MartURLLocationTest.java,v $
+ * Revision $Revision: 1.1 $
+ * Release status $State: Exp $
+ * Last modified on $Date: 2007/01/31 14:12:14 $
+ * by $Author: davidwithers $
+ * Created on 02-Jun-2006
+ *****************************************************************/
+package org.biomart.martservice;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author David Withers
+ */
+public class MartURLLocationTest extends TestCase {
+ private MartURLLocation martURLLocation;
+ /*
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ martURLLocation = new MartURLLocation();
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.isDefault()'
+ */
+ public void testIsDefault() {
+ assertFalse(martURLLocation.isDefault());
+ martURLLocation.setDefault(true);
+ assertTrue(martURLLocation.isDefault());
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.setDefault(boolean)'
+ */
+ public void testSetDefault() {
+ martURLLocation.setDefault(true);
+ assertTrue(martURLLocation.isDefault());
+ martURLLocation.setDefault(false);
+ assertFalse(martURLLocation.isDefault());
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.getDisplayName()'
+ */
+ public void testGetDisplayName() {
+ assertNull(martURLLocation.getDisplayName());
+ martURLLocation.setDisplayName("DisplayName");
+ assertEquals(martURLLocation.getDisplayName(), "DisplayName");
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.setDisplayName(String)'
+ */
+ public void testSetDisplayName() {
+ martURLLocation.setDisplayName("DisplayName");
+ assertEquals(martURLLocation.getDisplayName(), "DisplayName");
+ martURLLocation.setDisplayName(null);
+ assertNull(martURLLocation.getDisplayName());
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.getHost()'
+ */
+ public void testGetHost() {
+ assertNull(martURLLocation.getHost());
+ martURLLocation.setHost("Host");
+ assertEquals(martURLLocation.getHost(), "Host");
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.setHost(String)'
+ */
+ public void testSetHost() {
+ martURLLocation.setHost("Host");
+ assertEquals(martURLLocation.getHost(), "Host");
+ martURLLocation.setHost(null);
+ assertNull(martURLLocation.getHost());
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.getName()'
+ */
+ public void testGetName() {
+ assertNull(martURLLocation.getName());
+ martURLLocation.setName("Name");
+ assertEquals(martURLLocation.getName(), "Name");
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.setName(String)'
+ */
+ public void testSetName() {
+ martURLLocation.setName("Name");
+ assertEquals(martURLLocation.getName(), "Name");
+ martURLLocation.setName(null);
+ assertNull(martURLLocation.getName());
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.getPort()'
+ */
+ public void testGetPort() {
+ assertEquals(martURLLocation.getPort(), 0);
+ martURLLocation.setPort(-1);
+ assertEquals(martURLLocation.getPort(), -1);
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.setPort(int)'
+ */
+ public void testSetPort() {
+ martURLLocation.setPort(-1);
+ assertEquals(martURLLocation.getPort(), -1);
+ martURLLocation.setPort(0);
+ assertEquals(martURLLocation.getPort(), 0);
+ martURLLocation.setPort(1);
+ assertEquals(martURLLocation.getPort(), 1);
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.getServerVirtualSchema()'
+ */
+ public void testGetServerVirtualSchema() {
+ assertNull(martURLLocation.getServerVirtualSchema());
+ martURLLocation.setServerVirtualSchema("ServerVirtualSchema");
+ assertEquals(martURLLocation.getServerVirtualSchema(), "ServerVirtualSchema");
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.setServerVirtualSchema(String)'
+ */
+ public void testSetServerVirtualSchema() {
+ martURLLocation.setServerVirtualSchema("ServerVirtualSchema");
+ assertEquals(martURLLocation.getServerVirtualSchema(), "ServerVirtualSchema");
+ martURLLocation.setServerVirtualSchema(null);
+ assertNull(martURLLocation.getServerVirtualSchema());
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.getVirtualSchema()'
+ */
+ public void testGetVirtualSchema() {
+ assertNull(martURLLocation.getVirtualSchema());
+ martURLLocation.setVirtualSchema("VirtualSchema");
+ assertEquals(martURLLocation.getVirtualSchema(), "VirtualSchema");
+
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.setVirtualSchema(String)'
+ */
+ public void testSetVirtualSchema() {
+ martURLLocation.setVirtualSchema("VirtualSchema");
+ assertEquals(martURLLocation.getVirtualSchema(), "VirtualSchema");
+ martURLLocation.setVirtualSchema(null);
+ assertNull(martURLLocation.getVirtualSchema());
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.isVisible()'
+ */
+ public void testIsVisible() {
+ assertFalse(martURLLocation.isVisible());
+ martURLLocation.setVisible(true);
+ assertTrue(martURLLocation.isVisible());
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.setVisible(boolean)'
+ */
+ public void testSetVisible() {
+ martURLLocation.setVisible(true);
+ assertTrue(martURLLocation.isVisible());
+ martURLLocation.setVisible(false);
+ assertFalse(martURLLocation.isVisible());
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.getType()'
+ */
+ public void testGetType() {
+ assertEquals(martURLLocation.getType(), "URL");
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.MartURLLocation.toString()'
+ */
+ public void testToString() {
+ martURLLocation.setDisplayName("DisplayName");
+ assertEquals(martURLLocation.toString(), "DisplayName");
+ }
+
+ public void testHashCode() {
+ MartURLLocation martURLLocation2 = new MartURLLocation();
+ assertEquals(martURLLocation.hashCode(), martURLLocation2.hashCode());
+ martURLLocation.setDefault(true);
+ martURLLocation2.setDefault(true);
+ assertEquals(martURLLocation.hashCode(), martURLLocation2.hashCode());
+ martURLLocation.setDisplayName("DisplayName");
+ martURLLocation2.setDisplayName("DisplayName");
+ assertEquals(martURLLocation.hashCode(), martURLLocation2.hashCode());
+ martURLLocation.setHost("Host");
+ martURLLocation2.setHost("Host");
+ assertEquals(martURLLocation.hashCode(), martURLLocation2.hashCode());
+ martURLLocation.setName("Name");
+ martURLLocation2.setName("Name");
+ assertEquals(martURLLocation.hashCode(), martURLLocation2.hashCode());
+ martURLLocation.setPort(-1);
+ martURLLocation2.setPort(-1);
+ assertEquals(martURLLocation.hashCode(), martURLLocation2.hashCode());
+ martURLLocation.setServerVirtualSchema("ServerVirtualSchema");
+ martURLLocation2.setServerVirtualSchema("ServerVirtualSchema");
+ assertEquals(martURLLocation.hashCode(), martURLLocation2.hashCode());
+ martURLLocation.setVirtualSchema("VirtualSchema");
+ martURLLocation2.setVirtualSchema("VirtualSchema");
+ assertEquals(martURLLocation.hashCode(), martURLLocation2.hashCode());
+ martURLLocation.setVisible(true);
+ martURLLocation2.setVisible(true);
+ assertEquals(martURLLocation.hashCode(), martURLLocation2.hashCode());
+ martURLLocation.setVisible(true);
+ martURLLocation2.setVisible(true);
+ assertEquals(martURLLocation.hashCode(), martURLLocation2.hashCode());
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/test/java/org/biomart/martservice/config/event/QueryComponentEventTest.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/test/java/org/biomart/martservice/config/event/QueryComponentEventTest.java b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/config/event/QueryComponentEventTest.java
new file mode 100644
index 0000000..c22d8e2
--- /dev/null
+++ b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/config/event/QueryComponentEventTest.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2003 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate. Authorship
+ * of the modifications may be determined from the ChangeLog placed at
+ * the end of this file.
+ *
+ * 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
+ * USA.
+ *
+ ****************************************************************
+ * Source code information
+ * -----------------------
+ * Filename $RCSfile: QueryComponentEventTest.java,v $
+ * Revision $Revision: 1.1 $
+ * Release status $State: Exp $
+ * Last modified on $Date: 2007/01/31 14:12:15 $
+ * by $Author: davidwithers $
+ * Created on 06-Jun-2006
+ *****************************************************************/
+package org.biomart.martservice.config.event;
+
+import org.biomart.martservice.MartDataset;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author David Withers
+ */
+public class QueryComponentEventTest extends TestCase {
+ private QueryComponentEvent queryComponentEvent;
+
+ private QueryComponentEvent nullQueryComponentEvent;
+
+ private Object source;
+
+ private String name;
+
+ private MartDataset martDataset;
+
+ private String value;
+
+ /*
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ source = "source";
+ name = "name";
+ martDataset = new MartDataset();
+ value = "value";
+ queryComponentEvent = new QueryComponentEvent(source, name, martDataset, value);
+ nullQueryComponentEvent = new QueryComponentEvent(source, null, null, null);
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.config.event.QueryComponentEvent.QueryComponentEvent(Object,
+ * String, MartDataset)'
+ */
+ public void testQueryComponentEventObjectStringMartDataset() {
+ QueryComponentEvent event = new QueryComponentEvent(source, name, martDataset);
+ assertSame(event.getSource(), source);
+ assertEquals(event.getName(), name);
+ assertEquals(event.getDataset(), martDataset);
+ assertNull(event.getValue());
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.config.event.QueryComponentEvent.QueryComponentEvent(Object,
+ * String, MartDataset, String)'
+ */
+ public void testQueryComponentEventObjectStringMartDatasetString() {
+ QueryComponentEvent event = new QueryComponentEvent(source, name, martDataset, value);
+ assertSame(event.getSource(), source);
+ assertEquals(event.getName(), name);
+ assertEquals(event.getDataset(), martDataset);
+ assertEquals(event.getValue(), value);
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.config.event.QueryComponentEvent.getName()'
+ */
+ public void testGetName() {
+ assertEquals(queryComponentEvent.getName(), name);
+ assertNull(nullQueryComponentEvent.getName());
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.config.event.QueryComponentEvent.getDataset()'
+ */
+ public void testGetDataset() {
+ assertEquals(queryComponentEvent.getDataset(), martDataset);
+ assertNull(nullQueryComponentEvent.getDataset());
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.config.event.QueryComponentEvent.getValue()'
+ */
+ public void testGetValue() {
+ assertEquals(queryComponentEvent.getValue(), value);
+ assertNull(nullQueryComponentEvent.getValue());
+ }
+
+ /*
+ * Test method for 'java.util.EventObject.getSource()'
+ */
+ public void testGetSource() {
+ assertSame(queryComponentEvent.getSource(), source);
+ assertSame(nullQueryComponentEvent.getSource(), source);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/test/java/org/biomart/martservice/config/ui/MartServiceIconsTest.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/test/java/org/biomart/martservice/config/ui/MartServiceIconsTest.java b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/config/ui/MartServiceIconsTest.java
new file mode 100644
index 0000000..2236f37
--- /dev/null
+++ b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/config/ui/MartServiceIconsTest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2003 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate. Authorship
+ * of the modifications may be determined from the ChangeLog placed at
+ * the end of this file.
+ *
+ * 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
+ * USA.
+ *
+ ****************************************************************
+ * Source code information
+ * -----------------------
+ * Filename $RCSfile: MartServiceIconsTest.java,v $
+ * Revision $Revision: 1.1 $
+ * Release status $State: Exp $
+ * Last modified on $Date: 2007/01/31 14:12:16 $
+ * by $Author: davidwithers $
+ * Created on 24-Aug-2006
+ *****************************************************************/
+package org.biomart.martservice.config.ui;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author witherd5
+ */
+public class MartServiceIconsTest extends TestCase {
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /**
+ * Test method for {@link org.biomart.martservice.config.ui.MartServiceIcons#getIcon(java.lang.String)}.
+ */
+ public void testGetIcon() {
+ assertNotNull(MartServiceIcons.getIcon("gene_schematic"));
+ assertNotNull(MartServiceIcons.getIcon("gene_schematic"));
+ assertNotNull(MartServiceIcons.getIcon("gene_schematic_3utr"));
+ assertNotNull(MartServiceIcons.getIcon("gene_schematic_5utr"));
+ assertNotNull(MartServiceIcons.getIcon("gene_schematic_cdna"));
+ assertNotNull(MartServiceIcons.getIcon("gene_schematic_coding_gene_flank"));
+ assertNotNull(MartServiceIcons.getIcon("gene_schematic_coding_transcript_flank"));
+ assertNotNull(MartServiceIcons.getIcon("gene_schematic_coding"));
+ assertNotNull(MartServiceIcons.getIcon("gene_schematic_gene_exon_intron"));
+ assertNotNull(MartServiceIcons.getIcon("gene_schematic_gene_exon"));
+ assertNotNull(MartServiceIcons.getIcon("gene_schematic_gene_flank"));
+ assertNotNull(MartServiceIcons.getIcon("gene_schematic_peptide"));
+ assertNotNull(MartServiceIcons.getIcon("gene_schematic_transcript_exon_intron"));
+ assertNotNull(MartServiceIcons.getIcon("gene_schematic_transcript_exon"));
+ assertNotNull(MartServiceIcons.getIcon("gene_schematic_transcript_flank"));
+ assertNotNull(MartServiceIcons.getIcon("expand"));
+ assertNotNull(MartServiceIcons.getIcon("contract"));
+ assertNull(MartServiceIcons.getIcon("something else"));
+ assertNull(MartServiceIcons.getIcon(""));
+ assertNull(MartServiceIcons.getIcon(null));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/test/java/org/biomart/martservice/query/AttributeTest.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/test/java/org/biomart/martservice/query/AttributeTest.java b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/query/AttributeTest.java
new file mode 100644
index 0000000..5ac4c9e
--- /dev/null
+++ b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/query/AttributeTest.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2003 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate. Authorship
+ * of the modifications may be determined from the ChangeLog placed at
+ * the end of this file.
+ *
+ * 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
+ * USA.
+ *
+ ****************************************************************
+ * Source code information
+ * -----------------------
+ * Filename $RCSfile: AttributeTest.java,v $
+ * Revision $Revision: 1.2 $
+ * Release status $State: Exp $
+ * Last modified on $Date: 2008/03/04 16:43:40 $
+ * by $Author: davidwithers $
+ * Created on 02-May-2006
+ *****************************************************************/
+package org.biomart.martservice.query;
+
+import org.junit.Test;
+import org.junit.Before;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+/**
+ *
+ * @author David Withers
+ */
+public class AttributeTest {
+ private String attributeName;
+
+ private String attributes;
+
+ private Dataset dataset;
+
+ private Attribute attribute;
+
+ @Before
+ public void setUp() throws Exception {
+ attributeName = "attribute name";
+ attributes = "attributes";
+ dataset = new Dataset("dataset name");
+ attribute = new Attribute(attributeName);
+ }
+
+ @Test
+ public void AttributeString() {
+ Attribute attribute = new Attribute(attributeName);
+ assertEquals("Name should be '" + attributeName + "'", attribute
+ .getName(), attributeName);
+ }
+
+ @Test
+ public void AttributeAttribute() {
+ attribute.setContainingDataset(dataset);
+ Attribute copy = new Attribute(attribute);
+ assertEquals(attribute.getName(), copy.getName());
+ assertNull(copy.getContainingDataset());
+ }
+
+ @Test
+ public final void getName() {
+ assertEquals("Name should be '" + attributeName + "'", attribute
+ .getName(), attributeName);
+ }
+
+ @Test (expected=IllegalArgumentException.class)
+ public final void setName() {
+ String newName = "new attribute name";
+ attribute.setName(newName);
+ assertEquals("Name should be '" + newName + "'", attribute.getName(),
+ newName);
+ attribute.setName(null);
+ }
+
+ @Test
+ public final void getQualifiedName() {
+ assertEquals("Qualified name should be '" + attributeName + "'",
+ attribute.getQualifiedName(), attributeName);
+
+ String qualifiedName = dataset.getName() + "." + attributeName;
+ attribute.setContainingDataset(dataset);
+ assertEquals("Qualified name should be '" + qualifiedName + "'",
+ attribute.getQualifiedName(), qualifiedName);
+
+ dataset.setName("new dataset name");
+ qualifiedName = dataset.getName() + "." + attributeName;
+ attribute.setContainingDataset(dataset);
+ assertEquals("Qualified name should be '" + qualifiedName + "'",
+ attribute.getQualifiedName(), qualifiedName);
+
+ attribute.setContainingDataset(null);
+ assertEquals("Qualified name should be '" + attributeName + "'",
+ attribute.getQualifiedName(), attributeName);
+ }
+
+ @Test
+ public void getAttributes() {
+ assertNull(attribute.getAttributes());
+ attribute.setAttributes(attributes);
+ assertEquals("Attributes should be '" + attributes + "'", attribute
+ .getAttributes(), attributes);
+ }
+
+ @Test
+ public void setAttributes() {
+ String newAttributes = "new attributes";
+ attribute.setAttributes(newAttributes);
+ assertEquals("Attributes should be '" + newAttributes + "'", attribute.getAttributes(),
+ newAttributes);
+ attribute.setAttributes(null);
+ assertNull(attribute.getAttributes());
+ }
+
+ @Test
+ public void testGetAttributesCount() {
+ assertEquals(attribute.getAttributesCount(), 0);
+ attribute.setAttributes("a");
+ assertEquals(attribute.getAttributesCount(), 1);
+ attribute.setAttributes("a,b,c");
+ assertEquals(attribute.getAttributesCount(), 3);
+ attribute.setAttributes(null);
+ assertEquals(attribute.getAttributesCount(), 0);
+ }
+
+ @Test
+ public void getContainingDataset() {
+ assertNull(attribute.getContainingDataset());
+ dataset.addAttribute(attribute);
+ assertEquals(attribute.getContainingDataset(), dataset);
+ }
+
+ @Test
+ public void setContainingDataset() {
+ attribute.setContainingDataset(dataset);
+ assertEquals(attribute.getContainingDataset(), dataset);
+ attribute.setContainingDataset(null);
+ assertNull(attribute.getContainingDataset());
+ }
+
+ @Test
+ public void hashCodeTest() {
+ Attribute attribute2 = new Attribute(attributeName);
+ assertEquals(attribute.hashCode(), attribute.hashCode());
+ assertEquals(attribute.hashCode(), attribute2.hashCode());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/test/java/org/biomart/martservice/query/DatasetTest.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/test/java/org/biomart/martservice/query/DatasetTest.java b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/query/DatasetTest.java
new file mode 100644
index 0000000..374ce5d
--- /dev/null
+++ b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/query/DatasetTest.java
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2003 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate. Authorship
+ * of the modifications may be determined from the ChangeLog placed at
+ * the end of this file.
+ *
+ * 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
+ * USA.
+ *
+ ****************************************************************
+ * Source code information
+ * -----------------------
+ * Filename $RCSfile: DatasetTest.java,v $
+ * Revision $Revision: 1.1 $
+ * Release status $State: Exp $
+ * Last modified on $Date: 2007/01/31 14:12:10 $
+ * by $Author: davidwithers $
+ * Created on 03-May-2006
+ *****************************************************************/
+package org.biomart.martservice.query;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author David Withers
+ */
+public class DatasetTest extends TestCase {
+ private String attributeName;
+
+ private Attribute attribute;
+
+ private String filterName;
+
+ private String filterValue;
+
+ private Filter filter;
+
+// private Link link;
+
+ private String datasetName;
+
+ private Dataset dataset;
+
+ private Query query;
+
+ /*
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ attributeName = "attribute name";
+ attribute = new Attribute(attributeName);
+
+ filterName = "filter name";
+ filterValue = "filter value";
+ filter = new Filter(filterName, filterValue);
+
+// link = new Link("source", "target", "id");
+
+ datasetName = "dataset name";
+ dataset = new Dataset(datasetName);
+
+ query = new Query("default");
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Dataset.Dataset(String)'
+ */
+ public final void testDatasetString() {
+ Dataset dataset = new Dataset(datasetName);
+ assertEquals("Name should be '" + datasetName + "'", dataset.getName(),
+ datasetName);
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Dataset.Dataset(Dataset)'
+ */
+ public final void testDatasetDataset() {
+ dataset.addAttribute(attribute);
+ dataset.addFilter(filter);
+ Dataset copy = new Dataset(dataset);
+ assertEquals("Name should be '" + datasetName + "'", copy.getName(),
+ datasetName);
+ assertEquals(copy.getAttributes().size(), 1);
+ assertEquals(((Attribute) copy.getAttributes().get(0)).getName(),
+ attribute.getName());
+ assertEquals(copy.getFilters().size(), 1);
+ assertEquals(((Filter) copy.getFilters().get(0)).getName(), filter
+ .getName());
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Dataset.getName()'
+ */
+ public final void testGetName() {
+ assertEquals("Name should be '" + datasetName + "'", dataset.getName(),
+ datasetName);
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Dataset.setName(String)'
+ */
+ public final void testSetName() {
+ String newName = "new dataset name";
+ filter.setName(newName);
+ assertEquals("Name should be '" + newName + "'", filter.getName(),
+ newName);
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Dataset.getAttributes()'
+ */
+ public final void testGetAttributes() {
+ assertEquals(dataset.getAttributes().size(), 0);
+ dataset.addAttribute(attribute);
+ assertEquals(dataset.getAttributes().size(), 1);
+ assertEquals(dataset.getAttributes().get(0), attribute);
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.query.Dataset.addAttribute(Attribute)'
+ */
+ public final void testAddAttribute() {
+ assertTrue(dataset.addAttribute(attribute));
+ assertFalse(dataset.addAttribute(attribute));
+ assertEquals(dataset.getAttributes().size(), 1);
+ assertEquals(dataset.getAttributes().get(0), attribute);
+ query.addDataset(dataset);
+ assertTrue(dataset.addAttribute(new Attribute("new attribute")));
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.query.Dataset.addAttributes(Attribute[])'
+ */
+ public final void testAddAttributes() {
+ dataset.addAttributes(new Attribute[] {});
+ assertEquals(dataset.getAttributes().size(), 0);
+ dataset.addAttributes(new Attribute[] { attribute });
+ assertEquals(dataset.getAttributes().size(), 1);
+ assertEquals(dataset.getAttributes().get(0), attribute);
+ Attribute anotherAttribute = new Attribute("another attribute");
+ dataset.addAttributes(new Attribute[] { attribute, anotherAttribute });
+ assertEquals(dataset.getAttributes().size(), 2);
+ assertEquals(dataset.getAttributes().get(0), attribute);
+ assertEquals(dataset.getAttributes().get(1), anotherAttribute);
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.query.Dataset.hasAttribute(Attribute)'
+ */
+ public final void testHasAttribute() {
+ assertFalse(dataset.hasAttribute(attribute));
+ dataset.addAttribute(attribute);
+ assertTrue(dataset.hasAttribute(attribute));
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Dataset.hasAttributes()'
+ */
+ public final void testHasAttributes() {
+ assertFalse(dataset.hasAttributes());
+ dataset.addAttribute(attribute);
+ assertTrue(dataset.hasAttributes());
+ dataset.removeAttribute(attribute);
+ assertFalse(dataset.hasAttributes());
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.query.Dataset.removeAttribute(Attribute)'
+ */
+ public final void testRemoveAttribute() {
+ assertFalse(dataset.removeAttribute(attribute));
+ dataset.addAttribute(attribute);
+ assertTrue(dataset.removeAttribute(attribute));
+ assertEquals(dataset.getAttributes().size(), 0);
+ query.addDataset(dataset);
+ dataset.addAttribute(attribute);
+ assertTrue(dataset.removeAttribute(attribute));
+ }
+
+ public void testRemoveAllAttributes() {
+ dataset.removeAllAttributes();
+ assertFalse(dataset.hasAttributes());
+ dataset.addAttribute(attribute);
+ dataset.removeAllAttributes();
+ assertFalse(dataset.hasAttributes());
+ dataset.addAttributes(new Attribute[] { attribute, new Attribute("new attribute") });
+ dataset.removeAllAttributes();
+ assertFalse(dataset.hasAttributes());
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Dataset.getFilters()'
+ */
+ public final void testGetFilters() {
+ assertEquals(dataset.getFilters().size(), 0);
+ dataset.addFilter(filter);
+ assertEquals(dataset.getFilters().size(), 1);
+ assertEquals(dataset.getFilters().get(0), filter);
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Dataset.addFilter(Filter)'
+ */
+ public final void testAddFilter() {
+ assertTrue(dataset.addFilter(filter));
+ assertFalse(dataset.addFilter(filter));
+ assertEquals(dataset.getFilters().size(), 1);
+ assertEquals(dataset.getFilters().get(0), filter);
+ query.addDataset(dataset);
+ assertTrue(dataset.addFilter(new Filter("new filter")));
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.query.Dataset.addFilters(Filter[])'
+ */
+ public final void testAddFilters() {
+ dataset.addFilters(new Filter[] {});
+ assertEquals(dataset.getFilters().size(), 0);
+ dataset.addFilters(new Filter[] { filter });
+ assertEquals(dataset.getFilters().size(), 1);
+ assertEquals(dataset.getFilters().get(0), filter);
+ Filter anotherFilter = new Filter("another filter");
+ dataset.addFilters(new Filter[] { filter, anotherFilter });
+ assertEquals(dataset.getFilters().size(), 2);
+ assertEquals(dataset.getFilters().get(0), filter);
+ assertEquals(dataset.getFilters().get(1), anotherFilter);
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Dataset.hasFilter(Filter)'
+ */
+ public final void testHasFilter() {
+ assertFalse(dataset.hasFilter(filter));
+ dataset.addFilter(filter);
+ assertTrue(dataset.hasFilter(filter));
+ dataset.removeFilter(filter);
+ assertFalse(dataset.hasFilters());
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Dataset.hasFilters()'
+ */
+ public final void testHasFilters() {
+ assertFalse(dataset.hasFilters());
+ dataset.addFilter(filter);
+ assertTrue(dataset.hasFilters());
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.query.Dataset.removeFilter(Filter)'
+ */
+ public final void testRemoveFilter() {
+ assertFalse(dataset.removeFilter(filter));
+ dataset.addFilter(filter);
+ assertTrue(dataset.removeFilter(filter));
+ assertEquals(dataset.getFilters().size(), 0);
+ query.addDataset(dataset);
+ dataset.addFilter(filter);
+ assertTrue(dataset.removeFilter(filter));
+ }
+
+ public void testRemoveAllFilters() {
+ dataset.removeAllFilters();
+ assertFalse(dataset.hasFilters());
+ dataset.addFilter(filter);
+ dataset.removeAllFilters();
+ assertFalse(dataset.hasFilters());
+ dataset.addFilters(new Filter[] { filter, new Filter("new filter") });
+ dataset.removeAllFilters();
+ assertFalse(dataset.hasFilters());
+ }
+
+ public void testGetContainingQuery() {
+ assertNull(dataset.getContainingQuery());
+ query.addDataset(dataset);
+ assertEquals(dataset.getContainingQuery(), query);
+ }
+
+ public void testSetContainingQuery() {
+ dataset.setContainingQuery(query);
+ assertEquals(dataset.getContainingQuery(), query);
+ dataset.setContainingQuery(null);
+ assertNull(dataset.getContainingQuery());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-bioinformatics/blob/9e08cac0/taverna-biomart-martservice/src/test/java/org/biomart/martservice/query/FilterTest.java
----------------------------------------------------------------------
diff --git a/taverna-biomart-martservice/src/test/java/org/biomart/martservice/query/FilterTest.java b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/query/FilterTest.java
new file mode 100644
index 0000000..2d0be4e
--- /dev/null
+++ b/taverna-biomart-martservice/src/test/java/org/biomart/martservice/query/FilterTest.java
@@ -0,0 +1,242 @@
+/*
+ * Copyright (C) 2003 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate. Authorship
+ * of the modifications may be determined from the ChangeLog placed at
+ * the end of this file.
+ *
+ * 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
+ * USA.
+ *
+ ****************************************************************
+ * Source code information
+ * -----------------------
+ * Filename $RCSfile: FilterTest.java,v $
+ * Revision $Revision: 1.1 $
+ * Release status $State: Exp $
+ * Last modified on $Date: 2007/01/31 14:12:10 $
+ * by $Author: davidwithers $
+ * Created on 03-May-2006
+ *****************************************************************/
+package org.biomart.martservice.query;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author David Withers
+ */
+public class FilterTest extends TestCase {
+ private String filterName;
+
+ private String filterValue;
+
+ private Dataset dataset;
+
+ private Filter filter;
+
+ private Query query;
+
+ /*
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ filterName = "filter name";
+ filterValue = "filter value";
+ dataset = new Dataset("dataset name");
+ filter = new Filter(filterName, filterValue);
+ query = new Query("default");
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Filter.Filter(String)'
+ */
+ public final void testFilterString() {
+ Filter filter = new Filter(filterName);
+ assertEquals("Name should be '" + filterName + "'", filter.getName(),
+ filterName);
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Filter.Filter(String,
+ * String)'
+ */
+ public final void testFilterStringString() {
+ Filter filter = new Filter(filterName, filterValue);
+ assertEquals("Name should be '" + filterName + "'", filter.getName(),
+ filterName);
+ assertEquals("Value should be '" + filterValue + "'",
+ filter.getValue(), filterValue);
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Filter.Filter(String,
+ * String, boolean)'
+ */
+ public final void testFilterStringStringBoolean() {
+ Filter filter = new Filter(filterName, filterValue, true);
+ assertEquals("Name should be '" + filterName + "'", filter.getName(),
+ filterName);
+ assertEquals("Value should be '" + filterValue + "'",
+ filter.getValue(), filterValue);
+ assertTrue("isBoolean should be true", filter.isBoolean());
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Filter.Filter(Filter)'
+ */
+ public final void testFilterFilter() {
+ filter.setContainingDataset(dataset);
+ Filter copy = new Filter(filter);
+ assertEquals("Name should be '" + filterName + "'", copy.getName(),
+ filterName);
+ assertEquals("Value should be '" + filterValue + "'", copy.getValue(),
+ filterValue);
+ assertFalse("isBoolean should be false", copy.isBoolean());
+ assertNull(copy.getContainingDataset());
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.query.Filter.getContainingDataset()'
+ */
+ public final void testGetContainingDataset() {
+ assertNull("Default should be NULL ", filter.getContainingDataset());
+ dataset.addFilter(filter);
+ assertEquals(filter.getContainingDataset(), dataset);
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.query.Filter.setContainingDataset(Dataset)'
+ */
+ public final void testSetContainingDataset() {
+ filter.setContainingDataset(dataset);
+ assertEquals(filter.getContainingDataset(), dataset);
+ filter.setContainingDataset(null);
+ assertNull(filter.getContainingDataset());
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Filter.getName()'
+ */
+ public final void testGetName() {
+ assertEquals("Name should be '" + filterName + "'", filter.getName(),
+ filterName);
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Filter.setName(String)'
+ */
+ public final void testSetName() {
+ String newName = "new filter name";
+ filter.setName(newName);
+ assertEquals("Name should be '" + newName + "'", filter.getName(),
+ newName);
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Filter.getValue()'
+ */
+ public final void testGetValue() {
+ assertEquals("Value should be '" + filterValue + "'",
+ filter.getValue(), filterValue);
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Filter.setValue(String)'
+ */
+ public final void testSetValue() {
+ String newValue = "new filter value";
+ filter.setValue(newValue);
+ assertEquals("Value should be '" + newValue + "'", filter.getValue(),
+ newValue);
+ filter.setValue(null);
+ assertNull(filter.getValue());
+ filter.setValue(null);
+ assertNull(filter.getValue());
+ filter.setValue(newValue);
+ assertEquals("Value should be '" + newValue + "'", filter.getValue(),
+ newValue);
+ filter.setValue(newValue);
+ assertEquals("Value should be '" + newValue + "'", filter.getValue(),
+ newValue);
+ dataset.addFilter(filter);
+ filter.setValue(null);
+ filter.setValue(newValue);
+ assertEquals("Value should be '" + newValue + "'", filter.getValue(),
+ newValue);
+ query.addDataset(dataset);
+ filter.setValue(null);
+ filter.setValue(newValue);
+ assertEquals("Value should be '" + newValue + "'", filter.getValue(),
+ newValue);
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Filter.isBoolean()'
+ */
+ public final void testIsBoolean() {
+ assertFalse("Default should be false", filter.isBoolean());
+ }
+
+ /*
+ * Test method for
+ * 'org.biomart.martservice.query.Filter.setBoolean(boolean)'
+ */
+ public final void testSetBoolean() {
+ filter.setBoolean(true);
+ assertTrue("isBoolean should be true", filter.isBoolean());
+ }
+
+ /*
+ * Test method for 'org.biomart.martservice.query.Filter.getQualifiedName()'
+ */
+ public final void testGetQualifiedName() {
+ assertEquals("Qualified name should be '" + filterName + "'", filter
+ .getQualifiedName(), filterName);
+
+ String qualifiedName = dataset.getName() + "." + filterName;
+ filter.setContainingDataset(dataset);
+ assertEquals("Qualified name should be '" + qualifiedName + "'", filter
+ .getQualifiedName(), qualifiedName);
+
+ dataset.setName("new dataset name");
+ qualifiedName = dataset.getName() + "." + filterName;
+ filter.setContainingDataset(dataset);
+ assertEquals("Qualified name should be '" + qualifiedName + "'", filter
+ .getQualifiedName(), qualifiedName);
+
+ filter.setContainingDataset(null);
+ assertEquals("Qualified name should be '" + filterName + "'", filter
+ .getQualifiedName(), filterName);
+ }
+
+ public void testIsList() {
+ assertFalse(filter.isList());
+ filter.setList(true);
+ assertTrue(filter.isList());
+ }
+
+ public void testSetList() {
+ filter.setList(false);
+ assertFalse(filter.isList());
+ filter.setList(true);
+ assertTrue(filter.isList());
+ }
+
+}