From 3a90602b3402c23548e3cd601af48eb2b8302c9e Mon Sep 17 00:00:00 2001 From: bbimber Date: Mon, 30 Jun 2025 15:42:17 -0700 Subject: [PATCH 1/8] Use remote API to load JBrowse search results --- .../external/labModules/JBrowseTest.java | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java b/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java index 5f03b05a6..0374d5540 100644 --- a/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java +++ b/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java @@ -25,7 +25,9 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import org.labkey.remoteapi.CommandException; +import org.labkey.remoteapi.CommandResponse; import org.labkey.remoteapi.Connection; +import org.labkey.remoteapi.SimplePostCommand; import org.labkey.remoteapi.query.Filter; import org.labkey.remoteapi.query.InsertRowsCommand; import org.labkey.remoteapi.query.SelectRowsCommand; @@ -53,6 +55,7 @@ import java.io.File; import java.io.FileReader; import java.io.IOException; +import java.net.http.HttpRequest; import java.util.List; import java.util.Map; @@ -542,6 +545,18 @@ private void createGenomeFeatures(int genomeId) throws IOException, CommandExcep ic.execute(cn, getProjectName()); } + private JSONObject getSearchResults(Map queryParams) throws CommandException, IOException + { + Connection connection = createDefaultConnection(); + + SimplePostCommand command = new SimplePostCommand("jbrowse", "luceneQuery"); + command.setParameters(queryParams); + command.setTimeout(1200000); + CommandResponse response = command.execute(connection, getProjectName()); + + return new JSONObject(response.getText()); + } + @Override public List getAssociatedModules() { @@ -573,22 +588,17 @@ private void testFullTextSearch() throws Exception // all // this should return 143 results. We can't make any other assumptions about the content - String url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=all&pageSize=143"; - beginAt(url, WAIT_FOR_PAGE * 2); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - String jsonString = getText(Locator.tagWithClass("pre", "data")); - JSONObject mainJsonObject = new JSONObject(jsonString); + JSONObject mainJsonObject = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "all", "pageSize", 43)); JSONArray jsonArray = mainJsonObject.getJSONArray("data"); Assert.assertEquals(143, jsonArray.length()); // stringType: // ref equals A - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=ref%3AA"; + String url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=ref%3AA"; beginAt(url); waitForText("data"); waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); + String jsonString = getText(Locator.tagWithClass("pre", "data")); mainJsonObject = new JSONObject(jsonString); jsonArray = mainJsonObject.getJSONArray("data"); Assert.assertEquals(100, jsonArray.length()); From 44bffc32748c62a0ba95658a697c4772f92c3c68 Mon Sep 17 00:00:00 2001 From: bbimber Date: Mon, 30 Jun 2025 19:43:03 -0700 Subject: [PATCH 2/8] Debug --- .../test/tests/external/labModules/JBrowseTest.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java b/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java index 0374d5540..42b13093f 100644 --- a/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java +++ b/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java @@ -17,6 +17,7 @@ import au.com.bytecode.opencsv.CSVReader; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.DurationFormatUtils; import org.apache.commons.lang3.tuple.Pair; import org.json.JSONArray; import org.json.JSONException; @@ -55,7 +56,7 @@ import java.io.File; import java.io.FileReader; import java.io.IOException; -import java.net.http.HttpRequest; +import java.util.Date; import java.util.List; import java.util.Map; @@ -549,10 +550,12 @@ private JSONObject getSearchResults(Map queryParams) throws Comm { Connection connection = createDefaultConnection(); + Date start = new Date(); SimplePostCommand command = new SimplePostCommand("jbrowse", "luceneQuery"); command.setParameters(queryParams); - command.setTimeout(1200000); + command.setTimeout(WAIT_FOR_PAGE * 3); CommandResponse response = command.execute(connection, getProjectName()); + log("JBrowse search time: " + DurationFormatUtils.formatDurationWords(new Date().getTime() - start.getTime(), true, true)); return new JSONObject(response.getText()); } @@ -589,6 +592,7 @@ private void testFullTextSearch() throws Exception // all // this should return 143 results. We can't make any other assumptions about the content JSONObject mainJsonObject = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "all", "pageSize", 43)); + log(mainJsonObject.toString()); JSONArray jsonArray = mainJsonObject.getJSONArray("data"); Assert.assertEquals(143, jsonArray.length()); From 6f277976e40005e85087c7dbad73ea5d47ab00d3 Mon Sep 17 00:00:00 2001 From: bbimber Date: Tue, 1 Jul 2025 05:45:30 -0700 Subject: [PATCH 3/8] Debug --- .../test/tests/external/labModules/JBrowseTest.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java b/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java index 42b13093f..508dc133a 100644 --- a/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java +++ b/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java @@ -556,6 +556,7 @@ private JSONObject getSearchResults(Map queryParams) throws Comm command.setTimeout(WAIT_FOR_PAGE * 3); CommandResponse response = command.execute(connection, getProjectName()); log("JBrowse search time: " + DurationFormatUtils.formatDurationWords(new Date().getTime() - start.getTime(), true, true)); + log(response.getText()); return new JSONObject(response.getText()); } @@ -591,10 +592,8 @@ private void testFullTextSearch() throws Exception // all // this should return 143 results. We can't make any other assumptions about the content - JSONObject mainJsonObject = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "all", "pageSize", 43)); - log(mainJsonObject.toString()); - JSONArray jsonArray = mainJsonObject.getJSONArray("data"); - Assert.assertEquals(143, jsonArray.length()); + JSONObject searchJson = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "all", "pageSize", 43)); + Assert.assertEquals(143, searchJson.length()); // stringType: // ref equals A @@ -603,8 +602,8 @@ private void testFullTextSearch() throws Exception waitForText("data"); waitAndClick(Locator.tagWithId("a", "rawdata-tab")); String jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + JSONObject mainJsonObject = new JSONObject(jsonString); + JSONArray jsonArray = mainJsonObject.getJSONArray("data"); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); From 4a9666221ed6a56d3c918245e35cf67fd9abdb15 Mon Sep 17 00:00:00 2001 From: bbimber Date: Tue, 1 Jul 2025 07:26:12 -0700 Subject: [PATCH 4/8] Debug --- .../labkey/test/tests/external/labModules/JBrowseTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java b/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java index 508dc133a..1c2360066 100644 --- a/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java +++ b/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java @@ -546,7 +546,7 @@ private void createGenomeFeatures(int genomeId) throws IOException, CommandExcep ic.execute(cn, getProjectName()); } - private JSONObject getSearchResults(Map queryParams) throws CommandException, IOException + private JSONArray getSearchResults(Map queryParams) throws CommandException, IOException { Connection connection = createDefaultConnection(); @@ -558,7 +558,7 @@ private JSONObject getSearchResults(Map queryParams) throws Comm log("JBrowse search time: " + DurationFormatUtils.formatDurationWords(new Date().getTime() - start.getTime(), true, true)); log(response.getText()); - return new JSONObject(response.getText()); + return new JSONArray(response.getText()); } @Override @@ -592,7 +592,7 @@ private void testFullTextSearch() throws Exception // all // this should return 143 results. We can't make any other assumptions about the content - JSONObject searchJson = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "all", "pageSize", 43)); + JSONArray searchJson = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "all", "pageSize", 43)); Assert.assertEquals(143, searchJson.length()); // stringType: From 850b113e9632b5779f27c31271682f6d3c23c5fa Mon Sep 17 00:00:00 2001 From: bbimber Date: Tue, 1 Jul 2025 09:20:04 -0700 Subject: [PATCH 5/8] Debug --- .../org/labkey/test/tests/external/labModules/JBrowseTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java b/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java index 1c2360066..329bb45ec 100644 --- a/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java +++ b/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java @@ -558,7 +558,7 @@ private JSONArray getSearchResults(Map queryParams) throws Comma log("JBrowse search time: " + DurationFormatUtils.formatDurationWords(new Date().getTime() - start.getTime(), true, true)); log(response.getText()); - return new JSONArray(response.getText()); + return new JSONArray("[" + response.getText() + "]"); } @Override From dffc49ad29700ed0d45e1fc95891e8a812b2cb3e Mon Sep 17 00:00:00 2001 From: bbimber Date: Tue, 1 Jul 2025 09:26:45 -0700 Subject: [PATCH 6/8] Update npm --- jbrowse/package-lock.json | 255 +++++++++++++++++++++++++++++--------- 1 file changed, 197 insertions(+), 58 deletions(-) diff --git a/jbrowse/package-lock.json b/jbrowse/package-lock.json index a59c3c97c..b2b8218e0 100644 --- a/jbrowse/package-lock.json +++ b/jbrowse/package-lock.json @@ -3091,9 +3091,9 @@ } }, "node_modules/@labkey/api": { - "version": "1.41.2", - "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/api/-/@labkey/api-1.41.2.tgz", - "integrity": "sha512-ninfc/+Sj5+8Zla9bY2j/4fSy41OS27YAHKtDFPnu52QkC8WsOYh3JFI5PkU6Rn+xIp0In4P6d5Qn/yluJRC/w==" + "version": "1.42.0", + "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/api/-/@labkey/api-1.42.0.tgz", + "integrity": "sha512-fh65cogl+8HNe9+3OHzI6ygkaa+ARJbKyUopguy3NqtOWIAXAA21GNxayRoeVf9m1n2Kpubqk4QS2z/+WCzf8A==" }, "node_modules/@labkey/build": { "version": "8.5.0", @@ -3133,12 +3133,12 @@ } }, "node_modules/@labkey/components": { - "version": "6.50.1", - "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/components/-/@labkey/components-6.50.1.tgz", - "integrity": "sha512-g6DDCg3rsoCzkJDTRAtUFdGskyufFipJB50mmgQhEgtyEEbaXB6rF/Ny8ytPCZOmpA5yL2+pEtqFoXlvyXBMDg==", + "version": "6.52.5", + "resolved": "https://labkey.jfrog.io/artifactory/api/npm/libs-client/@labkey/components/-/@labkey/components-6.52.5.tgz", + "integrity": "sha512-hkesy0zyVEpADMfK4CQN9ZPWRjGFGfqS7h1QgRazp0QiHgXI3i6Va39lMSBdZb27bDeQd5V78Xze4tclHO/xIQ==", "dependencies": { "@hello-pangea/dnd": "18.0.1", - "@labkey/api": "1.41.2", + "@labkey/api": "1.42.0", "@testing-library/dom": "~10.4.0", "@testing-library/jest-dom": "~6.6.3", "@testing-library/react": "~16.3.0", @@ -5361,14 +5361,41 @@ } }, "node_modules/call-bind": { - "version": "1.0.7", - "license": "MIT", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", "dependencies": { + "call-bind-apply-helpers": "^1.0.0", "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.1" + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" }, "engines": { "node": ">= 0.4" @@ -6495,6 +6522,19 @@ "tslib": "^2.0.3" } }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/duplexer": { "version": "0.1.2", "dev": true, @@ -6619,11 +6659,9 @@ } }, "node_modules/es-define-property": { - "version": "1.0.0", - "license": "MIT", - "dependencies": { - "get-intrinsic": "^1.2.4" - }, + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", "engines": { "node": ">= 0.4" } @@ -6639,6 +6677,17 @@ "version": "1.5.4", "license": "MIT" }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", @@ -6949,10 +6998,17 @@ } }, "node_modules/for-each": { - "version": "0.3.3", - "license": "MIT", + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", "dependencies": { - "is-callable": "^1.1.3" + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/foreground-child": { @@ -7252,14 +7308,20 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.4", - "license": "MIT", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -7268,6 +7330,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/get-value": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/get-value/-/get-value-3.0.1.tgz", @@ -7352,10 +7426,11 @@ } }, "node_modules/gopd": { - "version": "1.0.1", - "license": "MIT", - "dependencies": { - "get-intrinsic": "^1.1.3" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -7403,19 +7478,10 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has-proto": { - "version": "1.0.3", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/has-symbols": { - "version": "1.0.3", - "license": "MIT", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", "engines": { "node": ">= 0.4" }, @@ -7887,7 +7953,8 @@ }, "node_modules/is-callable": { "version": "1.2.7", - "license": "MIT", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", "engines": { "node": ">= 0.4" }, @@ -8076,10 +8143,11 @@ } }, "node_modules/is-typed-array": { - "version": "1.1.13", - "license": "MIT", + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", "dependencies": { - "which-typed-array": "^1.1.14" + "which-typed-array": "^1.1.16" }, "engines": { "node": ">= 0.4" @@ -8411,6 +8479,14 @@ "react": "^16.8.0 || ^17.0.0 || ^18.0.0" } }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/md5": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", @@ -9404,20 +9480,49 @@ } }, "node_modules/pbkdf2": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", - "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.3.tgz", + "integrity": "sha512-wfRLBZ0feWRhCIkoMB6ete7czJcnNnqRpcoWQBLqatqXXmelSRqfdDK4F3u9T2s2cXas/hQJcryI/4lAL+XTlA==", "dependencies": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" + "create-hash": "~1.1.3", + "create-hmac": "^1.1.7", + "ripemd160": "=2.0.1", + "safe-buffer": "^5.2.1", + "sha.js": "^2.4.11", + "to-buffer": "^1.2.0" }, "engines": { "node": ">=0.12" } }, + "node_modules/pbkdf2/node_modules/create-hash": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.1.3.tgz", + "integrity": "sha512-snRpch/kwQhcdlnZKYanNF1m0RDlrCdSKQaH87w1FCFPVPNCQ/Il9QJKAX2jVBZddRdaHBMC+zXa9Gw9tmkNUA==", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "sha.js": "^2.4.0" + } + }, + "node_modules/pbkdf2/node_modules/hash-base": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-2.0.2.tgz", + "integrity": "sha512-0TROgQ1/SxE6KmxWSvXHvRj90/Xo1JvZShofnYF+f6ZsGtR4eES7WfrQzPalmyagfKZCXpVnitiRebZulWsbiw==", + "dependencies": { + "inherits": "^2.0.1" + } + }, + "node_modules/pbkdf2/node_modules/ripemd160": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.1.tgz", + "integrity": "sha512-J7f4wutN8mdbV08MJnXibYpCOPHR+yzy+iQ/AsjMv2j8cLavQ8VGagDFUwwTAdF8FmRKVeNpbTTEwNHCW1g94w==", + "dependencies": { + "hash-base": "^2.0.0", + "inherits": "^2.0.1" + } + }, "node_modules/performance-now": { "version": "2.1.0", "license": "MIT", @@ -11555,6 +11660,24 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/to-buffer": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.2.1.tgz", + "integrity": "sha512-tB82LpAIWjhLYbqjx3X4zEeHN6M8CiuOEy2JY8SEQVdYRe3CCHOFaqrBW1doLDrfpWhplcW7BL+bO3/6S3pcDQ==", + "dependencies": { + "isarray": "^2.0.5", + "safe-buffer": "^5.2.1", + "typed-array-buffer": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/to-buffer/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -11676,6 +11799,19 @@ "node": ">= 0.6" } }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/typescript": { "version": "5.8.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", @@ -12328,13 +12464,16 @@ } }, "node_modules/which-typed-array": { - "version": "1.1.15", - "license": "MIT", + "version": "1.1.19", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz", + "integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==", "dependencies": { "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.7", - "for-each": "^0.3.3", - "gopd": "^1.0.1", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", "has-tostringtag": "^1.0.2" }, "engines": { From 5f7a2b277e3607125a41d6a1adf8a4ba0100aa55 Mon Sep 17 00:00:00 2001 From: bbimber Date: Tue, 1 Jul 2025 10:08:11 -0700 Subject: [PATCH 7/8] Deal with ndjson --- .../org/labkey/test/tests/external/labModules/JBrowseTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java b/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java index 329bb45ec..cce83f35c 100644 --- a/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java +++ b/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java @@ -558,7 +558,8 @@ private JSONArray getSearchResults(Map queryParams) throws Comma log("JBrowse search time: " + DurationFormatUtils.formatDurationWords(new Date().getTime() - start.getTime(), true, true)); log(response.getText()); - return new JSONArray("[" + response.getText() + "]"); + // NOTE: the response is ndjson. This converts it into a more standard JSONArray form: + return new JSONArray("[" + StringUtils.join(response.getText().split("\n"), ",") + "]"); } @Override From 6e5ce56e4be40fe9c769986bebff7347a59fe397 Mon Sep 17 00:00:00 2001 From: bbimber Date: Tue, 1 Jul 2025 11:47:21 -0700 Subject: [PATCH 8/8] Convert more API calls --- .../external/labModules/JBrowseTest.java | 289 +++--------------- 1 file changed, 37 insertions(+), 252 deletions(-) diff --git a/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java b/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java index cce83f35c..87dd973f6 100644 --- a/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java +++ b/jbrowse/test/src/org/labkey/test/tests/external/labModules/JBrowseTest.java @@ -593,18 +593,12 @@ private void testFullTextSearch() throws Exception // all // this should return 143 results. We can't make any other assumptions about the content - JSONArray searchJson = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "all", "pageSize", 43)); - Assert.assertEquals(143, searchJson.length()); + JSONArray jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "all", "pageSize", 143)); + Assert.assertEquals(143, jsonArray.length()); // stringType: // ref equals A - String url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=ref%3AA"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - String jsonString = getText(Locator.tagWithClass("pre", "data")); - JSONObject mainJsonObject = new JSONObject(jsonString); - JSONArray jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "ref:A")); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -612,13 +606,7 @@ private void testFullTextSearch() throws Exception } // alt does not equal C - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=*%3A*%20-alt%3AC"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "*:* -alt:C")); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -626,13 +614,7 @@ private void testFullTextSearch() throws Exception } // ref contains A - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=ref%3A*A*"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "ref:*A*")); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -640,13 +622,7 @@ private void testFullTextSearch() throws Exception } // alt does not contain AA - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=*%3A*%20-alt%3A*AA*"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "*:* -alt:*AA*")); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -654,13 +630,7 @@ private void testFullTextSearch() throws Exception } // IMPACT starts with HI - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=IMPACT%3AHI*"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "IMPACT:HI*")); Assert.assertEquals(1, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -668,13 +638,7 @@ private void testFullTextSearch() throws Exception } // ref ends with TA - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=ref%3A*TA"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "ref:*TA")); Assert.assertEquals(5, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -682,13 +646,7 @@ private void testFullTextSearch() throws Exception } // IMPACT is empty - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=*%3A*%20-IMPACT%3A*"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "*:* -IMPACT:*")); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -696,13 +654,7 @@ private void testFullTextSearch() throws Exception } // IMPACT is not empty - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=IMPACT%3A*"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "IMPACT:*")); Assert.assertEquals(3, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -710,23 +662,11 @@ private void testFullTextSearch() throws Exception } // variableSamplesType in set TestGroup - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=variableSamples%3A~!TestGroup!~"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "variableSamples:~!TestGroup!~")); Assert.assertEquals(100, jsonArray.length()); // variable in m00004 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=variableSamples%3Am00004"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "variableSamples:m00004")); Assert.assertEquals(79, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { @@ -745,13 +685,7 @@ private void testFullTextSearch() throws Exception } // not variable in m00004 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=*%3A*%20-variableSamples%3Am00004"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "*:* -variableSamples:m00004")); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { @@ -781,13 +715,7 @@ private void testFullTextSearch() throws Exception } // variable in all of m00004, m00013, m00029 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=%252BvariableSamples%3Am00004%20%252BvariableSamples%3Am00013%20%252BvariableSamples%3Am00029"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "%2BvariableSamples:m00004 %2BvariableSamples:m00013 %2BvariableSamples:m00029")); Assert.assertEquals(69, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { @@ -815,13 +743,7 @@ private void testFullTextSearch() throws Exception } // variable in any of m00004, m00013, m00029 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=variableSamples%3Am00004%20OR%20variableSamples%3Am00013%20OR%20variableSamples%3Am00029"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "variableSamples:m00004 OR variableSamples:m00013 OR variableSamples:m00029")); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { @@ -847,13 +769,7 @@ private void testFullTextSearch() throws Exception } // not variable in any of m00004, m00013, m00029 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=*%3A*%20-variableSamples%3Am00004%20AND%20*%3A*%20-variableSamples%3Am00013%20AND%20*%3A*%20-variableSamples%3Am00029"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "*:* -variableSamples:m00004 AND *:* -variableSamples:m00013 AND *:* -variableSamples:m00029")); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { @@ -899,13 +815,7 @@ private void testFullTextSearch() throws Exception } // not variable in one of m00004, m00013, m00029 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=*%3A*%20-variableSamples%3Am00004%20OR%20*%3A*%20-variableSamples%3Am00013%20OR%20*%3A*%20-variableSamples%3Am00029"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "*:* -variableSamples:m00004 OR *:* -variableSamples:m00013 OR *:* -variableSamples:m00029")); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { @@ -949,13 +859,7 @@ private void testFullTextSearch() throws Exception } // is empty - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=*%3A*%20-variableSamples%3A*"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "*:* -variableSamples:*")); Assert.assertEquals(5, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -963,13 +867,7 @@ private void testFullTextSearch() throws Exception } // is not empty - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=variableSamples%3A*"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "variableSamples:*")); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -979,13 +877,7 @@ private void testFullTextSearch() throws Exception // numericType, int and float: // AC = 12 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=AC%3A%5B12%20TO%2012%5D"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "AC:[12 TO 12]")); Assert.assertEquals(3, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -993,13 +885,7 @@ private void testFullTextSearch() throws Exception } // AC != 88 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=AC%3A%5B*%20TO%2088%7D%20OR%20AC%3A%7B88%20TO%20*%5D"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "AC:[* TO 88} OR AC:{88 TO *]")); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -1007,13 +893,7 @@ private void testFullTextSearch() throws Exception } // AC > 88 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=AC%3A%7B88%20TO%20*%5D"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "AC:{88 TO *]")); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -1021,13 +901,7 @@ private void testFullTextSearch() throws Exception } // AC >= 88 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=AC%3A%5B88%20TO%20*%5D"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "AC:[88 TO *]")); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -1035,13 +909,7 @@ private void testFullTextSearch() throws Exception } // start < 137 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=start%3A%5B*%20TO%20137%7D"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "start:[* TO 137}")); Assert.assertEquals(2, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -1049,13 +917,7 @@ private void testFullTextSearch() throws Exception } // end <= 440 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=end%3A%5B*%20TO%20440%5D"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "end:[* TO 440]")); Assert.assertEquals(7, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -1063,13 +925,7 @@ private void testFullTextSearch() throws Exception } // AF = 0.532 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=AF%3A%5B0.531999%20TO%200.5320010000000001%5D"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "AF:[0.531999 TO 0.5320010000000001]")); Assert.assertEquals(1, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -1077,13 +933,7 @@ private void testFullTextSearch() throws Exception } // AF != 0.029 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=AF%3A%5B*%20TO%200.028999%5D%20OR%20AF%3A%5B0.029001000000000002%20TO%20*%5D"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "AF:[* TO 0.028999] OR AF:[0.029001000000000002 TO *]")); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -1091,13 +941,7 @@ private void testFullTextSearch() throws Exception } // AF > 0.532 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=AF%3A%5B0.5320010000000001%20TO%20*%5D"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "AF:[0.5320010000000001 TO *]")); Assert.assertEquals(18, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -1105,13 +949,7 @@ private void testFullTextSearch() throws Exception } // AF >= 0.029 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=AF%3A%5B0.029%20TO%20*%5D"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "AF:[0.029 TO *]")); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -1119,13 +957,7 @@ private void testFullTextSearch() throws Exception } // AF < 0.029 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=AF%3A%5B*%20TO%200.028999%5D"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "AF:[* TO 0.028999]")); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -1133,13 +965,7 @@ private void testFullTextSearch() throws Exception } // AF <= 0.029 - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=AF%3A%5B*%20TO%200.029%5D"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "AF:[* TO 0.029]")); Assert.assertEquals(100, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -1151,13 +977,7 @@ private void testFullTextSearch() throws Exception // contig := 1 // ref := A // should be 100 results and each should be ref = A - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=contig%3A%3D1%26ref%3A%3DA&pageSize=200"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "contig:=1&ref:=A", "pageSize", 200)); Assert.assertEquals(104, jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -1166,14 +986,7 @@ private void testFullTextSearch() throws Exception } // Default genomic position sort (ascending) - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=all&pageSize=100"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); - + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "all", "pageSize", 100)); long previousGenomicPosition = Long.MIN_VALUE; for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -1183,14 +996,7 @@ private void testFullTextSearch() throws Exception } // Sort by alt, ascending - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=all&pageSize=100&sortField=alt"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); - + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "all", "pageSize", 100, "sortField", "alt")); String previousAlt = ""; for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -1200,14 +1006,7 @@ private void testFullTextSearch() throws Exception } // Sort by alt, descending - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=all&pageSize=100&sortField=alt&sortReverse=true"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); - + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "all", "pageSize", 100, "sortField", "alt", "sortReverse", "true")); previousAlt = "ZZZZ"; // Assuming 'Z' is higher than any character in your data for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -1217,14 +1016,7 @@ private void testFullTextSearch() throws Exception } // Sort by af, ascending - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=all&pageSize=100&sortField=AF"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); - + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "all", "pageSize", 100, "sortField", "AF")); double previousAf = -1.0; for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); @@ -1234,14 +1026,7 @@ private void testFullTextSearch() throws Exception } // Sort by af, descending - url = "/jbrowse/" + getProjectName() + "/luceneQuery.view?sessionId=" + sessionId + "&trackId=" + trackId + "&searchString=all&pageSize=100&sortField=AF&sortReverse=true"; - beginAt(url); - waitForText("data"); - waitAndClick(Locator.tagWithId("a", "rawdata-tab")); - jsonString = getText(Locator.tagWithClass("pre", "data")); - mainJsonObject = new JSONObject(jsonString); - jsonArray = mainJsonObject.getJSONArray("data"); - + jsonArray = getSearchResults(Map.of("sessionId", sessionId, "trackId", trackId, "searchString", "all", "pageSize", 100, "sortField", "AF", "sortReverse", "true")); previousAf = 2.0; // Assuming 'af' is <= 1.0 for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i);