X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=test%2Fjalview%2Ffts%2Fcore%2FFTSRestClientTest.java;h=44fe8d0e763cb9d57c5ac1a26e16b4cc6feafa14;hb=1bfb581512684bc3bcbb108405d5db0e795cbc6f;hp=4a90c4ee64cd65c531b52cce8da7330be4be8ff7;hpb=e3a91c662873d6b6e6f86b6b596f578a16e23779;p=jalview.git
diff --git a/test/jalview/fts/core/FTSRestClientTest.java b/test/jalview/fts/core/FTSRestClientTest.java
index 4a90c4e..44fe8d0 100644
--- a/test/jalview/fts/core/FTSRestClientTest.java
+++ b/test/jalview/fts/core/FTSRestClientTest.java
@@ -1,18 +1,48 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.fts.core;
import jalview.fts.api.FTSDataColumnI;
import jalview.fts.api.FTSDataColumnI.FTSDataColumnGroupI;
+import jalview.gui.JvOptionPane;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class FTSRestClientTest
{
+
+ @BeforeClass(alwaysRun = true)
+ public void setUpJvOptionPane()
+ {
+ JvOptionPane.setInteractiveMode(false);
+ JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+ }
+
private FTSRestClient ftsRestClient;
@BeforeMethod(alwaysRun = true)
@@ -24,7 +54,7 @@ public class FTSRestClientTest
@Override
public String getColumnDataConfigFileName()
{
- return "examples/testdata/test_fts_data_columns.conf";
+ return "/fts/uniprot_data_columns.txt";
}
@Override
@@ -40,7 +70,7 @@ public class FTSRestClientTest
public void getPrimaryKeyColumIndexTest()
{
Collection wantedFields = ftsRestClient
- .getAllDefaulDisplayedDataColumns();
+ .getAllDefaultDisplayedFTSDataColumns();
int foundIndex = -1;
try
{
@@ -61,33 +91,23 @@ public class FTSRestClientTest
@Test(groups = { "Functional" })
public void getAllDefaulDisplayedDataColumns()
{
- Assert.assertNotNull(ftsRestClient.getAllDefaulDisplayedDataColumns());
- Assert.assertTrue(!ftsRestClient.getAllDefaulDisplayedDataColumns()
+ Assert.assertNotNull(ftsRestClient
+ .getAllDefaultDisplayedFTSDataColumns());
+ Assert.assertTrue(!ftsRestClient.getAllDefaultDisplayedFTSDataColumns()
.isEmpty());
- Assert.assertEquals(ftsRestClient.getAllDefaulDisplayedDataColumns()
- .size(), 6);
+ Assert.assertEquals(ftsRestClient
+ .getAllDefaultDisplayedFTSDataColumns().size(), 7);
}
@Test(groups = { "Functional" })
public void getDataColumnsFieldsAsCommaDelimitedString()
{
Collection wantedFields = ftsRestClient
- .getAllDefaulDisplayedDataColumns();
+ .getAllDefaultDisplayedFTSDataColumns();
String actual = ftsRestClient
.getDataColumnsFieldsAsCommaDelimitedString(wantedFields);
Assert.assertEquals(actual,
- "entry name,protein names,genes,organism,created,last-modified");
- }
-
- @Test(groups = { "Functional" })
- public void getDataColumnsFieldsAsTabDelimitedString()
- {
- Collection wantedFields = ftsRestClient
- .getAllDefaulDisplayedDataColumns();
- String actual = ftsRestClient
- .getDataColumnsFieldsAsTabDelimitedString(wantedFields);
- Assert.assertEquals(actual,
- "Entry Name\tProtein names\tGene Names\tOrganism\tDate of creation\tDate of last modification");
+ "id,entry name,protein names,genes,organism,reviewed,length");
}
@Test(groups = { "Functional" })
@@ -96,7 +116,7 @@ public class FTSRestClientTest
Collection allFields = ftsRestClient
.getAllFTSDataColumns();
Assert.assertNotNull(allFields);
- Assert.assertEquals(allFields.size(), 116);
+ Assert.assertEquals(allFields.size(), 117);
}
@Test(groups = { "Functional" })
@@ -105,7 +125,7 @@ public class FTSRestClientTest
Collection searchalbeFields = ftsRestClient
.getSearchableDataColumns();
Assert.assertNotNull(searchalbeFields);
- Assert.assertEquals(searchalbeFields.size(), 28);
+ Assert.assertEquals(searchalbeFields.size(), 22);
}
@Test(groups = { "Functional" })
@@ -115,7 +135,7 @@ public class FTSRestClientTest
try
{
expectedPKColumn = ftsRestClient
- .getDataColumnByNameOrCode("Entry Name");
+ .getDataColumnByNameOrCode("Uniprot Id");
Assert.assertNotNull(ftsRestClient.getPrimaryKeyColumn());
Assert.assertEquals(ftsRestClient.getPrimaryKeyColumn(),
expectedPKColumn);
@@ -161,7 +181,7 @@ public class FTSRestClientTest
public void getDefaultResponsePageSize()
{
int defaultResSize = ftsRestClient.getDefaultResponsePageSize();
- Assert.assertEquals(defaultResSize, 100);
+ Assert.assertEquals(defaultResSize, 500);
}
@Test(groups = { "Functional" })
@@ -223,10 +243,12 @@ public class FTSRestClientTest
FTSDataColumnI foundDataCol = ftsRestClient
.getDataColumnByNameOrCode("Protein names");
Assert.assertNotNull(foundDataCol);
- Assert.assertEquals(foundDataCol.getDataColumnClass(), String.class);
+ Assert.assertEquals(foundDataCol.getDataType().getDataTypeClass(),
+ String.class);
foundDataCol = ftsRestClient.getDataColumnByNameOrCode("length");
Assert.assertNotNull(foundDataCol);
- Assert.assertEquals(foundDataCol.getDataColumnClass(), Integer.class);
+ Assert.assertEquals(foundDataCol.getDataType().getDataTypeClass(),
+ Integer.class);
// foundDataCol = ftsRestClient.getDataColumnByNameOrCode("length");
// Assert.assertNotNull(foundDataCol);
// Assert.assertEquals(foundDataCol.getDataColumnClass(), Double.class);
@@ -245,18 +267,19 @@ public class FTSRestClientTest
.getSearchableDataColumns();
for (FTSDataColumnI foundCol : searchableCols)
{
+ System.out.println(foundCol.toString());
uniqueSet.add(foundCol);
uniqueSet.add(foundCol);
}
Assert.assertTrue(!uniqueSet.isEmpty());
- Assert.assertEquals(uniqueSet.size(), 28);
+ Assert.assertEquals(uniqueSet.size(), 22);
}
@Test(groups = { "Functional" })
public void coverageForMiscellaneousBranches()
{
String actual = ftsRestClient.getPrimaryKeyColumn().toString();
- Assert.assertEquals(actual, "Entry Name");
+ Assert.assertEquals(actual, "Uniprot Id");
String actualGroupStr;
try
@@ -272,7 +295,7 @@ public class FTSRestClientTest
}
String actualResourseFile = ftsRestClient
- .getResourceFile("fts/uniprot_data_columns.conf");
+ .getResourceFile("/fts/uniprot_data_columns.txt");
Assert.assertNotNull(actualResourseFile);
Assert.assertTrue(actualResourseFile.length() > 31);
}