JAL-4114 updated mock tests and responses for v2.0 api
[jalview.git] / test / jalview / fts / service / pdb / PDBFTSRestClientTest.java
index 355eae5..3839065 100644 (file)
@@ -732,15 +732,18 @@ public class PDBFTSRestClientTest
 
     try
     {
-      mocks.add(
-              new String[]
-              { readJsonStringFromFile(
-                      "test/jalview/fts/threedbeacons/p01308_pdbfts_query.txt")
-                              .trim(),
-                  readJsonStringFromFile(
-                          "test/jalview/fts/threedbeacons/p01308_pdbfts_resp.txt")
-                                  .trim() });
-      for (int i = 1; i < 5; i++)
+      for (int i = 1; i < 3; i++)
+      {
+        mocks.add(
+                new String[]
+                { readJsonStringFromFile(
+                        "test/jalview/fts/threedbeacons/p01308_pdbfts_query_pt"
+                                + i + ".txt").trim(),
+                    readJsonStringFromFile(
+                            "test/jalview/fts/threedbeacons/p01308_pdbfts_query_pt"
+                                    + i + "_resp.txt").trim() });
+      }
+      for (int i = 1; i < 6; i++)
       {
         mocks.add(
 
@@ -752,11 +755,83 @@ public class PDBFTSRestClientTest
                             "test/jalview/fts/threedbeacons/p0dtd1_pdbfts_fts_query_pt"
                                     + i + "_resp.txt").trim() });
       }
+      // maize
+      mocks.add(
+              new String[]
+              { "https://www.ebi.ac.uk/pdbe/search/pdb/select?wt=json&fl=pdb_id,title,experimental_method,resolution&rows=500&start=0&q=(1gaq+OR+5h92+OR+3b2f+OR+3w5u+OR+5h8y+OR+3w5v)+AND+molecule_sequence:%5B''+TO+*%5D+AND+status:REL&sort=",
+                  "{\n" + "  \"responseHeader\":{\n" + "    \"status\":0,\n"
+                          + "    \"QTime\":0,\n" + "    \"params\":{\n"
+                          + "      \"q\":\"(1gaq OR 5h92 OR 3b2f OR 3w5u OR 5h8y OR 3w5v) AND molecule_sequence:['' TO *] AND status:REL\",\n"
+                          + "      \"fl\":\"pdb_id,title,experimental_method,resolution\",\n"
+                          + "      \"start\":\"0\",\n"
+                          + "      \"sort\":\"\",\n"
+                          + "      \"rows\":\"500\",\n"
+                          + "      \"wt\":\"json\"}},\n"
+                          + "  \"response\":{\"numFound\":11,\"start\":0,\"docs\":[\n"
+                          + "      {\n"
+                          + "        \"experimental_method\":[\"X-ray diffraction\"],\n"
+                          + "        \"pdb_id\":\"3b2f\",\n"
+                          + "        \"resolution\":1.7,\n"
+                          + "        \"title\":\"Maize Ferredoxin 1\"},\n"
+                          + "      {\n"
+                          + "        \"experimental_method\":[\"X-ray diffraction\"],\n"
+                          + "        \"pdb_id\":\"5h92\",\n"
+                          + "        \"resolution\":2.08,\n"
+                          + "        \"title\":\"Crystal structure of the complex between maize Sulfite Reductase and ferredoxin in the form-3 crystal\"},\n"
+                          + "      {\n"
+                          + "        \"experimental_method\":[\"X-ray diffraction\"],\n"
+                          + "        \"pdb_id\":\"5h8y\",\n"
+                          + "        \"resolution\":2.2,\n"
+                          + "        \"title\":\"Crystal structure of the complex between maize sulfite reductase and ferredoxin in the form-2 crystal\"},\n"
+                          + "      {\n"
+                          + "        \"experimental_method\":[\"X-ray diffraction\"],\n"
+                          + "        \"pdb_id\":\"1gaq\",\n"
+                          + "        \"resolution\":2.59,\n"
+                          + "        \"title\":\"CRYSTAL STRUCTURE OF THE COMPLEX BETWEEN FERREDOXIN AND FERREDOXIN-NADP+ REDUCTASE\"},\n"
+                          + "      {\n"
+                          + "        \"experimental_method\":[\"X-ray diffraction\"],\n"
+                          + "        \"pdb_id\":\"3w5u\",\n"
+                          + "        \"resolution\":2.7,\n"
+                          + "        \"title\":\"Cross-linked complex between Ferredoxin and Ferredoxin-NADP+ reductase\"},\n"
+                          + "      {\n"
+                          + "        \"experimental_method\":[\"X-ray diffraction\"],\n"
+                          + "        \"pdb_id\":\"3w5v\",\n"
+                          + "        \"resolution\":3.81,\n"
+                          + "        \"title\":\"Cross-linked complex between Ferredoxin and Ferredoxin-NADP+ reductase\"},\n"
+                          + "      {\n"
+                          + "        \"experimental_method\":[\"X-ray diffraction\"],\n"
+                          + "        \"pdb_id\":\"3w5u\",\n"
+                          + "        \"resolution\":2.7,\n"
+                          + "        \"title\":\"Cross-linked complex between Ferredoxin and Ferredoxin-NADP+ reductase\"},\n"
+                          + "      {\n"
+                          + "        \"experimental_method\":[\"X-ray diffraction\"],\n"
+                          + "        \"pdb_id\":\"3w5v\",\n"
+                          + "        \"resolution\":3.81,\n"
+                          + "        \"title\":\"Cross-linked complex between Ferredoxin and Ferredoxin-NADP+ reductase\"},\n"
+                          + "      {\n"
+                          + "        \"experimental_method\":[\"X-ray diffraction\"],\n"
+                          + "        \"pdb_id\":\"1gaq\",\n"
+                          + "        \"resolution\":2.59,\n"
+                          + "        \"title\":\"CRYSTAL STRUCTURE OF THE COMPLEX BETWEEN FERREDOXIN AND FERREDOXIN-NADP+ REDUCTASE\"},\n"
+                          + "      {\n"
+                          + "        \"experimental_method\":[\"X-ray diffraction\"],\n"
+                          + "        \"pdb_id\":\"5h92\",\n"
+                          + "        \"resolution\":2.08,\n"
+                          + "        \"title\":\"Crystal structure of the complex between maize Sulfite Reductase and ferredoxin in the form-3 crystal\"},\n"
+                          + "      {\n"
+                          + "        \"experimental_method\":[\"X-ray diffraction\"],\n"
+                          + "        \"pdb_id\":\"5h8y\",\n"
+                          + "        \"resolution\":2.2,\n"
+                          + "        \"title\":\"Crystal structure of the complex between maize sulfite reductase and ferredoxin in the form-2 crystal\"}]\n"
+                          + "  }}" });
     } catch (Throwable e)
     {
       Assert.fail("Couldn't read mock data.", e);
     }
-
+    /*
+     * updating mocks for p0dtd1 require very long URLs to be queried 
+     for i in test/jalview/fts/threedbeacons/p0dtd1_pdbfts_fts_query_pt?.txt; do wget -i $i -O ${i/.txt/_resp.txt}; done
+     */
     FTSRestClient.createMockFTSRestClient(
             (FTSRestClient) PDBFTSRestClient.getInstance(),
             mocks.toArray(new String[0][2]));