From 251e980a88a9340dc2c2232bd1094fbd86bbc0af Mon Sep 17 00:00:00 2001 From: smarkwal Date: Sun, 22 Sep 2024 15:07:19 +0200 Subject: [PATCH] Tests: Use a local HTTP server to mock Maven Search API. --- .../org/jarhc/it/MavenArtifactFinderTest.java | 3 + .../org/jarhc/it/TestJettyWebAppTest.java | 4 + .../it/utils/MavenSearchApiMockServer.java | 111 ++++++++++++++++++ ...3496adda5acaea4078d92c4a766c8f2d0d5c5.json | 42 +++++++ ...ee1760aba62d6896d578bd7d247d0fa52f0e7.json | 67 +++++++++++ ...4567890123456789012345678901234567890.json | 22 ++++ ...9b264f76e3d087ee21bfc99305928e1bdb443.json | 64 ++++++++++ ...63d075497751784b2fa84be59432f4905bf7c.json | 41 +++++++ ...be637de4dd2143efdd003d48fdbcfde4390d7.json | 40 +++++++ ...893df5f31da2ece4040fe0a12fd44b577afaf.json | 81 +++++++++++++ ...08b5dce8e7b3188fde38d908494788e47f55d.json | 40 +++++++ ...753d673a124ba2880361871ab13f6863b2d40.json | 41 +++++++ ...20ed18833e7275ba688d88242af4c3711fbea.json | 35 ++++++ ...6c5e350d0aa1b310c07ec362755c34a1cc8cb.json | 40 +++++++ ...e11134bca83db85919a1710fce022c67df3b7.json | 43 +++++++ ...d4ba0dee443f68fb2dcb7fcdb945a2cd89912.json | 44 +++++++ ...4388db5ace49c7459e68b5c0e542ef55fd49b.json | 36 ++++++ ...a2fd904a881114aba79e2f881c6f4004e8148.json | 41 +++++++ 18 files changed, 795 insertions(+) create mode 100644 jarhc/src/integrationTest/java/org/jarhc/it/utils/MavenSearchApiMockServer.java create mode 100644 jarhc/src/integrationTest/resources/maven-search-api-responses/0693496adda5acaea4078d92c4a766c8f2d0d5c5.json create mode 100644 jarhc/src/integrationTest/resources/maven-search-api-responses/093ee1760aba62d6896d578bd7d247d0fa52f0e7.json create mode 100644 jarhc/src/integrationTest/resources/maven-search-api-responses/1234567890123456789012345678901234567890.json create mode 100644 jarhc/src/integrationTest/resources/maven-search-api-responses/2cd9b264f76e3d087ee21bfc99305928e1bdb443.json create mode 100644 jarhc/src/integrationTest/resources/maven-search-api-responses/3cd63d075497751784b2fa84be59432f4905bf7c.json create mode 100644 jarhc/src/integrationTest/resources/maven-search-api-responses/6a8be637de4dd2143efdd003d48fdbcfde4390d7.json create mode 100644 jarhc/src/integrationTest/resources/maven-search-api-responses/815893df5f31da2ece4040fe0a12fd44b577afaf.json create mode 100644 jarhc/src/integrationTest/resources/maven-search-api-responses/8d608b5dce8e7b3188fde38d908494788e47f55d.json create mode 100644 jarhc/src/integrationTest/resources/maven-search-api-responses/8ee753d673a124ba2880361871ab13f6863b2d40.json create mode 100644 jarhc/src/integrationTest/resources/maven-search-api-responses/9d920ed18833e7275ba688d88242af4c3711fbea.json create mode 100644 jarhc/src/integrationTest/resources/maven-search-api-responses/b246c5e350d0aa1b310c07ec362755c34a1cc8cb.json create mode 100644 jarhc/src/integrationTest/resources/maven-search-api-responses/d4ee11134bca83db85919a1710fce022c67df3b7.json create mode 100644 jarhc/src/integrationTest/resources/maven-search-api-responses/d74d4ba0dee443f68fb2dcb7fcdb945a2cd89912.json create mode 100644 jarhc/src/integrationTest/resources/maven-search-api-responses/e024388db5ace49c7459e68b5c0e542ef55fd49b.json create mode 100644 jarhc/src/integrationTest/resources/maven-search-api-responses/edda2fd904a881114aba79e2f881c6f4004e8148.json diff --git a/jarhc/src/integrationTest/java/org/jarhc/it/MavenArtifactFinderTest.java b/jarhc/src/integrationTest/java/org/jarhc/it/MavenArtifactFinderTest.java index 1f921635..8cdab913 100644 --- a/jarhc/src/integrationTest/java/org/jarhc/it/MavenArtifactFinderTest.java +++ b/jarhc/src/integrationTest/java/org/jarhc/it/MavenArtifactFinderTest.java @@ -29,15 +29,18 @@ import org.jarhc.artifacts.Artifact; import org.jarhc.artifacts.MavenArtifactFinder; import org.jarhc.artifacts.RepositoryException; +import org.jarhc.it.utils.MavenSearchApiMockServer; import org.jarhc.test.log.LoggerBuilder; import org.jarhc.test.log.LoggerUtils; import org.jarhc.utils.FileUtils; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.io.TempDir; import org.slf4j.Logger; +@ExtendWith(MavenSearchApiMockServer.class) class MavenArtifactFinderTest { private final Logger logger = LoggerBuilder.collect(MavenArtifactFinder.class); diff --git a/jarhc/src/integrationTest/java/org/jarhc/it/TestJettyWebAppTest.java b/jarhc/src/integrationTest/java/org/jarhc/it/TestJettyWebAppTest.java index 5cf3c66b..9a231b8e 100644 --- a/jarhc/src/integrationTest/java/org/jarhc/it/TestJettyWebAppTest.java +++ b/jarhc/src/integrationTest/java/org/jarhc/it/TestJettyWebAppTest.java @@ -16,6 +16,10 @@ package org.jarhc.it; +import org.jarhc.it.utils.MavenSearchApiMockServer; +import org.junit.jupiter.api.extension.ExtendWith; + +@ExtendWith(MavenSearchApiMockServer.class) class TestJettyWebAppTest extends AbstractMainTest { TestJettyWebAppTest() { diff --git a/jarhc/src/integrationTest/java/org/jarhc/it/utils/MavenSearchApiMockServer.java b/jarhc/src/integrationTest/java/org/jarhc/it/utils/MavenSearchApiMockServer.java new file mode 100644 index 00000000..fdbe40a3 --- /dev/null +++ b/jarhc/src/integrationTest/java/org/jarhc/it/utils/MavenSearchApiMockServer.java @@ -0,0 +1,111 @@ +/* + * Copyright 2024 Stephan Markwalder + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jarhc.it.utils; + +import com.sun.net.httpserver.Headers; +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; +import java.io.IOException; +import java.io.OutputStream; +import java.net.InetSocketAddress; +import org.jarhc.TestUtils; +import org.junit.jupiter.api.extension.AfterAllCallback; +import org.junit.jupiter.api.extension.BeforeAllCallback; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class MavenSearchApiMockServer implements BeforeAllCallback, AfterAllCallback { + + private static final Logger LOGGER = LoggerFactory.getLogger(MavenSearchApiMockServer.class); + + private HttpServer httpServer; + private String originalSearchUrl; + + @Override + public void beforeAll(ExtensionContext context) throws Exception { + if (httpServer != null) { + throw new IllegalStateException("Server is already running."); + } + + // start HTTP server on random port + httpServer = HttpServer.create(new InetSocketAddress("localhost", 0), 0); + httpServer.createContext("/checksum", new RequestHandler()); + httpServer.setExecutor(null); // use default executor + httpServer.start(); + + // get selected port + int port = httpServer.getAddress().getPort(); + + // update search URL in Java System Properties + originalSearchUrl = System.getProperty("jarhc.search.url"); + String searchUrl = "http://localhost:" + port + "/checksum?q=%s"; + System.setProperty("jarhc.search.url", searchUrl); + } + + @Override + public void afterAll(ExtensionContext context) { + + // stop HTTP server + if (httpServer != null) { + httpServer.stop(0); + httpServer = null; + } + + // restore original search URL in Java System Properties + if (originalSearchUrl != null) { + System.setProperty("jarhc.search.url", originalSearchUrl); + } else { + System.clearProperty("jarhc.search.url"); + } + } + + private static class RequestHandler implements HttpHandler { + + public void handle(HttpExchange exchange) throws IOException { + + // validate query string + String query = exchange.getRequestURI().getQuery(); + if (query == null || !query.startsWith("q=")) { + LOGGER.error("Invalid query: '{}'", query); + exchange.sendResponseHeaders(400, 0); + exchange.getResponseBody().close(); + return; + } + + // get checksum from query string + String checksum = query.substring(2); + + LOGGER.debug("Mock Maven Search API response for checksum: '{}'", checksum); + + // load response from test resources + String response = TestUtils.getResourceAsString("/maven-search-api-responses/" + checksum + ".json", "UTF-8"); + + // send response headers + Headers headers = exchange.getResponseHeaders(); + headers.set("Content-Type", "application/json"); + exchange.sendResponseHeaders(200, response.length()); + + // send response body + OutputStream stream = exchange.getResponseBody(); + stream.write(response.getBytes()); + stream.close(); + } + } + +} diff --git a/jarhc/src/integrationTest/resources/maven-search-api-responses/0693496adda5acaea4078d92c4a766c8f2d0d5c5.json b/jarhc/src/integrationTest/resources/maven-search-api-responses/0693496adda5acaea4078d92c4a766c8f2d0d5c5.json new file mode 100644 index 00000000..983ecd58 --- /dev/null +++ b/jarhc/src/integrationTest/resources/maven-search-api-responses/0693496adda5acaea4078d92c4a766c8f2d0d5c5.json @@ -0,0 +1,42 @@ +{ + "response": { + "docs": [{ + "p": "jar", + "a": "jetty-servlets", + "v": "9.4.20.v20190813", + "g": "org.eclipse.jetty", + "id": "org.eclipse.jetty:jetty-servlets:9.4.20.v20190813", + "ec": [ + "-javadoc.jar", + "-sources.jar", + "-config.jar", + ".jar", + ".pom" + ], + "timestamp": 1565732393000, + "tags": [ + "servlets", + "utility", + "from", + "jetty" + ] + }], + "numFound": 1, + "start": 0 + }, + "responseHeader": { + "QTime": 1, + "params": { + "q": "1:\"0693496adda5acaea4078d92c4a766c8f2d0d5c5\"", + "core": "", + "indent": "off", + "fl": "id,g,a,v,p,ec,timestamp,tags", + "start": "", + "sort": "score desc,timestamp desc,g asc,a asc,v desc", + "rows": "20", + "wt": "json", + "version": "2.2" + }, + "status": 0 + } +} \ No newline at end of file diff --git a/jarhc/src/integrationTest/resources/maven-search-api-responses/093ee1760aba62d6896d578bd7d247d0fa52f0e7.json b/jarhc/src/integrationTest/resources/maven-search-api-responses/093ee1760aba62d6896d578bd7d247d0fa52f0e7.json new file mode 100644 index 00000000..5b744b74 --- /dev/null +++ b/jarhc/src/integrationTest/resources/maven-search-api-responses/093ee1760aba62d6896d578bd7d247d0fa52f0e7.json @@ -0,0 +1,67 @@ +{ + "response": { + "docs": [{ + "p": "jar", + "a": "commons-codec", + "v": "1.11", + "g": "commons-codec", + "id": "commons-codec:commons-codec:1.11", + "ec": [ + "-sources.jar", + "-javadoc.jar", + "-test-sources.jar", + ".jar", + "-tests.jar", + "-src.zip", + "-src.tar.gz", + ".pom", + "-bin.zip", + "-bin.tar.gz" + ], + "timestamp": 1508252070000, + "tags": [ + "encoders", + "decoders", + "phonetic", + "such", + "simple", + "package", + "apache", + "codec", + "contains", + "collection", + "used", + "addition", + "formats", + "base64", + "hexadecimal", + "widely", + "commons", + "utilities", + "maintains", + "encoding", + "various", + "also", + "encoder", + "these" + ] + }], + "numFound": 1, + "start": 0 + }, + "responseHeader": { + "QTime": 3, + "params": { + "q": "1:\"093ee1760aba62d6896d578bd7d247d0fa52f0e7\"", + "core": "", + "indent": "off", + "fl": "id,g,a,v,p,ec,timestamp,tags", + "start": "", + "sort": "score desc,timestamp desc,g asc,a asc,v desc", + "rows": "20", + "wt": "json", + "version": "2.2" + }, + "status": 0 + } +} \ No newline at end of file diff --git a/jarhc/src/integrationTest/resources/maven-search-api-responses/1234567890123456789012345678901234567890.json b/jarhc/src/integrationTest/resources/maven-search-api-responses/1234567890123456789012345678901234567890.json new file mode 100644 index 00000000..a9a6b2a2 --- /dev/null +++ b/jarhc/src/integrationTest/resources/maven-search-api-responses/1234567890123456789012345678901234567890.json @@ -0,0 +1,22 @@ +{ + "response": { + "docs": [], + "numFound": 0, + "start": 0 + }, + "responseHeader": { + "QTime": 2, + "params": { + "q": "1:\"1234567890123456789012345678901234567890\"", + "core": "", + "indent": "off", + "fl": "id,g,a,v,p,ec,timestamp,tags", + "start": "", + "sort": "score desc,timestamp desc,g asc,a asc,v desc", + "rows": "20", + "wt": "json", + "version": "2.2" + }, + "status": 0 + } +} \ No newline at end of file diff --git a/jarhc/src/integrationTest/resources/maven-search-api-responses/2cd9b264f76e3d087ee21bfc99305928e1bdb443.json b/jarhc/src/integrationTest/resources/maven-search-api-responses/2cd9b264f76e3d087ee21bfc99305928e1bdb443.json new file mode 100644 index 00000000..02c27f54 --- /dev/null +++ b/jarhc/src/integrationTest/resources/maven-search-api-responses/2cd9b264f76e3d087ee21bfc99305928e1bdb443.json @@ -0,0 +1,64 @@ +{ + "response": { + "docs": [ + { + "p": "jar", + "a": "slf4j-api", + "v": "RELEASE113", + "g": "org.netbeans.external", + "id": "org.netbeans.external:slf4j-api:RELEASE113", + "ec": [ + "-sources.jar", + ".jar", + ".nbm", + ".pom" + ], + "timestamp": 1582302753000, + "tags": [ + "integrated", + "platform", + "application", + "environment", + "development", + "apache", + "tooling", + "netbeans", + "framework" + ] + }, + { + "p": "jar", + "a": "slf4j-api", + "v": "1.7.28", + "g": "org.slf4j", + "id": "org.slf4j:slf4j-api:1.7.28", + "ec": [ + "-sources.jar", + "-javadoc.jar", + ".jar", + "-tests.jar", + ".pom" + ], + "timestamp": 1565425641000, + "tags": ["slf4j"] + } + ], + "numFound": 2, + "start": 0 + }, + "responseHeader": { + "QTime": 2, + "params": { + "q": "1:\"2cd9b264f76e3d087ee21bfc99305928e1bdb443\"", + "core": "", + "indent": "off", + "fl": "id,g,a,v,p,ec,timestamp,tags", + "start": "", + "sort": "score desc,timestamp desc,g asc,a asc,v desc", + "rows": "20", + "wt": "json", + "version": "2.2" + }, + "status": 0 + } +} \ No newline at end of file diff --git a/jarhc/src/integrationTest/resources/maven-search-api-responses/3cd63d075497751784b2fa84be59432f4905bf7c.json b/jarhc/src/integrationTest/resources/maven-search-api-responses/3cd63d075497751784b2fa84be59432f4905bf7c.json new file mode 100644 index 00000000..83c8b892 --- /dev/null +++ b/jarhc/src/integrationTest/resources/maven-search-api-responses/3cd63d075497751784b2fa84be59432f4905bf7c.json @@ -0,0 +1,41 @@ +{ + "response": { + "docs": [{ + "p": "jar", + "a": "javax.servlet-api", + "v": "3.1.0", + "g": "javax.servlet", + "id": "javax.servlet:javax.servlet-api:3.1.0", + "ec": [ + "-javadoc.jar", + "-sources.jar", + ".jar", + ".pom" + ], + "timestamp": 1366933959000, + "tags": [ + "technology", + "collaboration", + "source", + "java" + ] + }], + "numFound": 1, + "start": 0 + }, + "responseHeader": { + "QTime": 1, + "params": { + "q": "1:\"3cd63d075497751784b2fa84be59432f4905bf7c\"", + "core": "", + "indent": "off", + "fl": "id,g,a,v,p,ec,timestamp,tags", + "start": "", + "sort": "score desc,timestamp desc,g asc,a asc,v desc", + "rows": "20", + "wt": "json", + "version": "2.2" + }, + "status": 0 + } +} \ No newline at end of file diff --git a/jarhc/src/integrationTest/resources/maven-search-api-responses/6a8be637de4dd2143efdd003d48fdbcfde4390d7.json b/jarhc/src/integrationTest/resources/maven-search-api-responses/6a8be637de4dd2143efdd003d48fdbcfde4390d7.json new file mode 100644 index 00000000..13d74377 --- /dev/null +++ b/jarhc/src/integrationTest/resources/maven-search-api-responses/6a8be637de4dd2143efdd003d48fdbcfde4390d7.json @@ -0,0 +1,40 @@ +{ + "response": { + "docs": [{ + "p": "jar", + "a": "websocket-servlet", + "v": "9.4.20.v20190813", + "g": "org.eclipse.jetty.websocket", + "id": "org.eclipse.jetty.websocket:websocket-servlet:9.4.20.v20190813", + "ec": [ + "-sources.jar", + "-javadoc.jar", + ".jar", + ".pom" + ], + "timestamp": 1565732848000, + "tags": [ + "project", + "jetty", + "eclipse" + ] + }], + "numFound": 1, + "start": 0 + }, + "responseHeader": { + "QTime": 2, + "params": { + "q": "1:\"6a8be637de4dd2143efdd003d48fdbcfde4390d7\"", + "core": "", + "indent": "off", + "fl": "id,g,a,v,p,ec,timestamp,tags", + "start": "", + "sort": "score desc,timestamp desc,g asc,a asc,v desc", + "rows": "20", + "wt": "json", + "version": "2.2" + }, + "status": 0 + } +} \ No newline at end of file diff --git a/jarhc/src/integrationTest/resources/maven-search-api-responses/815893df5f31da2ece4040fe0a12fd44b577afaf.json b/jarhc/src/integrationTest/resources/maven-search-api-responses/815893df5f31da2ece4040fe0a12fd44b577afaf.json new file mode 100644 index 00000000..1bc6815b --- /dev/null +++ b/jarhc/src/integrationTest/resources/maven-search-api-responses/815893df5f31da2ece4040fe0a12fd44b577afaf.json @@ -0,0 +1,81 @@ +{ + "response": { + "docs": [ + { + "p": "jar", + "a": "org-apache-commons-io", + "v": "RELEASE113", + "g": "org.netbeans.external", + "id": "org.netbeans.external:org-apache-commons-io:RELEASE113", + "ec": [ + "-sources.jar", + ".jar", + ".nbm", + ".pom" + ], + "timestamp": 1582302675000, + "tags": [ + "integrated", + "platform", + "application", + "environment", + "development", + "apache", + "tooling", + "netbeans", + "framework" + ] + }, + { + "p": "jar", + "a": "commons-io", + "v": "2.6", + "g": "commons-io", + "id": "commons-io:commons-io:2.6", + "ec": [ + "-sources.jar", + "-javadoc.jar", + "-test-sources.jar", + "-tests.jar", + ".jar", + ".pom" + ], + "timestamp": 1508061652000, + "tags": [ + "classes", + "stream", + "comparators", + "implementations", + "apache", + "contains", + "much", + "transformation", + "more", + "utility", + "endian", + "file", + "commons", + "library", + "filters" + ] + } + ], + "numFound": 2, + "start": 0 + }, + "responseHeader": { + "QTime": 1, + "params": { + "q": "1:\"815893df5f31da2ece4040fe0a12fd44b577afaf\"", + "core": "", + "indent": "off", + "fl": "id,g,a,v,p,ec,timestamp,tags", + "start": "", + "sort": "score desc,timestamp desc,g asc,a asc,v desc", + "rows": "20", + "wt": "json", + "version": "2.2" + }, + "status": 0 + } +} \ No newline at end of file diff --git a/jarhc/src/integrationTest/resources/maven-search-api-responses/8d608b5dce8e7b3188fde38d908494788e47f55d.json b/jarhc/src/integrationTest/resources/maven-search-api-responses/8d608b5dce8e7b3188fde38d908494788e47f55d.json new file mode 100644 index 00000000..aade75bb --- /dev/null +++ b/jarhc/src/integrationTest/resources/maven-search-api-responses/8d608b5dce8e7b3188fde38d908494788e47f55d.json @@ -0,0 +1,40 @@ +{ + "response": { + "docs": [{ + "p": "jar", + "a": "websocket-api", + "v": "9.4.20.v20190813", + "g": "org.eclipse.jetty.websocket", + "id": "org.eclipse.jetty.websocket:websocket-api:9.4.20.v20190813", + "ec": [ + "-javadoc.jar", + "-sources.jar", + ".jar", + ".pom" + ], + "timestamp": 1565732802000, + "tags": [ + "project", + "jetty", + "eclipse" + ] + }], + "numFound": 1, + "start": 0 + }, + "responseHeader": { + "QTime": 3, + "params": { + "q": "1:\"8d608b5dce8e7b3188fde38d908494788e47f55d\"", + "core": "", + "indent": "off", + "fl": "id,g,a,v,p,ec,timestamp,tags", + "start": "", + "sort": "score desc,timestamp desc,g asc,a asc,v desc", + "rows": "20", + "wt": "json", + "version": "2.2" + }, + "status": 0 + } +} \ No newline at end of file diff --git a/jarhc/src/integrationTest/resources/maven-search-api-responses/8ee753d673a124ba2880361871ab13f6863b2d40.json b/jarhc/src/integrationTest/resources/maven-search-api-responses/8ee753d673a124ba2880361871ab13f6863b2d40.json new file mode 100644 index 00000000..68afc91c --- /dev/null +++ b/jarhc/src/integrationTest/resources/maven-search-api-responses/8ee753d673a124ba2880361871ab13f6863b2d40.json @@ -0,0 +1,41 @@ +{ + "response": { + "docs": [{ + "p": "jar", + "a": "jetty-util", + "v": "9.4.20.v20190813", + "g": "org.eclipse.jetty", + "id": "org.eclipse.jetty:jetty-util:9.4.20.v20190813", + "ec": [ + "-config.jar", + "-sources.jar", + "-javadoc.jar", + ".jar", + ".pom" + ], + "timestamp": 1565731716000, + "tags": [ + "classes", + "utility", + "jetty" + ] + }], + "numFound": 1, + "start": 0 + }, + "responseHeader": { + "QTime": 1, + "params": { + "q": "1:\"8ee753d673a124ba2880361871ab13f6863b2d40\"", + "core": "", + "indent": "off", + "fl": "id,g,a,v,p,ec,timestamp,tags", + "start": "", + "sort": "score desc,timestamp desc,g asc,a asc,v desc", + "rows": "20", + "wt": "json", + "version": "2.2" + }, + "status": 0 + } +} \ No newline at end of file diff --git a/jarhc/src/integrationTest/resources/maven-search-api-responses/9d920ed18833e7275ba688d88242af4c3711fbea.json b/jarhc/src/integrationTest/resources/maven-search-api-responses/9d920ed18833e7275ba688d88242af4c3711fbea.json new file mode 100644 index 00000000..812b0009 --- /dev/null +++ b/jarhc/src/integrationTest/resources/maven-search-api-responses/9d920ed18833e7275ba688d88242af4c3711fbea.json @@ -0,0 +1,35 @@ +{ + "response": { + "docs": [{ + "p": "war", + "a": "test-jetty-webapp", + "v": "9.4.20.v20190813", + "g": "org.eclipse.jetty", + "id": "org.eclipse.jetty:test-jetty-webapp:9.4.20.v20190813", + "ec": [ + "-config.jar", + "-webbundle.jar", + ".war", + ".pom" + ], + "timestamp": 1565735169000 + }], + "numFound": 1, + "start": 0 + }, + "responseHeader": { + "QTime": 1, + "params": { + "q": "1:\"9d920ed18833e7275ba688d88242af4c3711fbea\"", + "core": "", + "indent": "off", + "fl": "id,g,a,v,p,ec,timestamp,tags", + "start": "", + "sort": "score desc,timestamp desc,g asc,a asc,v desc", + "rows": "20", + "wt": "json", + "version": "2.2" + }, + "status": 0 + } +} \ No newline at end of file diff --git a/jarhc/src/integrationTest/resources/maven-search-api-responses/b246c5e350d0aa1b310c07ec362755c34a1cc8cb.json b/jarhc/src/integrationTest/resources/maven-search-api-responses/b246c5e350d0aa1b310c07ec362755c34a1cc8cb.json new file mode 100644 index 00000000..61c6484a --- /dev/null +++ b/jarhc/src/integrationTest/resources/maven-search-api-responses/b246c5e350d0aa1b310c07ec362755c34a1cc8cb.json @@ -0,0 +1,40 @@ +{ + "response": { + "docs": [{ + "p": "jar", + "a": "jetty-io", + "v": "9.4.20.v20190813", + "g": "org.eclipse.jetty", + "id": "org.eclipse.jetty:jetty-io:9.4.20.v20190813", + "ec": [ + "-javadoc.jar", + "-sources.jar", + ".jar", + ".pom" + ], + "timestamp": 1565731754000, + "tags": [ + "project", + "jetty", + "eclipse" + ] + }], + "numFound": 1, + "start": 0 + }, + "responseHeader": { + "QTime": 2, + "params": { + "q": "1:\"b246c5e350d0aa1b310c07ec362755c34a1cc8cb\"", + "core": "", + "indent": "off", + "fl": "id,g,a,v,p,ec,timestamp,tags", + "start": "", + "sort": "score desc,timestamp desc,g asc,a asc,v desc", + "rows": "20", + "wt": "json", + "version": "2.2" + }, + "status": 0 + } +} \ No newline at end of file diff --git a/jarhc/src/integrationTest/resources/maven-search-api-responses/d4ee11134bca83db85919a1710fce022c67df3b7.json b/jarhc/src/integrationTest/resources/maven-search-api-responses/d4ee11134bca83db85919a1710fce022c67df3b7.json new file mode 100644 index 00000000..03a15f41 --- /dev/null +++ b/jarhc/src/integrationTest/resources/maven-search-api-responses/d4ee11134bca83db85919a1710fce022c67df3b7.json @@ -0,0 +1,43 @@ +{ + "response": { + "docs": [{ + "p": "jar", + "a": "jetty-server", + "v": "9.4.20.v20190813", + "g": "org.eclipse.jetty", + "id": "org.eclipse.jetty:jetty-server:9.4.20.v20190813", + "ec": [ + "-javadoc.jar", + "-sources.jar", + "-config.jar", + ".jar", + "-tests.jar", + ".pom" + ], + "timestamp": 1565731880000, + "tags": [ + "artifact", + "core", + "server", + "jetty" + ] + }], + "numFound": 1, + "start": 0 + }, + "responseHeader": { + "QTime": 3, + "params": { + "q": "1:\"d4ee11134bca83db85919a1710fce022c67df3b7\"", + "core": "", + "indent": "off", + "fl": "id,g,a,v,p,ec,timestamp,tags", + "start": "", + "sort": "score desc,timestamp desc,g asc,a asc,v desc", + "rows": "20", + "wt": "json", + "version": "2.2" + }, + "status": 0 + } +} \ No newline at end of file diff --git a/jarhc/src/integrationTest/resources/maven-search-api-responses/d74d4ba0dee443f68fb2dcb7fcdb945a2cd89912.json b/jarhc/src/integrationTest/resources/maven-search-api-responses/d74d4ba0dee443f68fb2dcb7fcdb945a2cd89912.json new file mode 100644 index 00000000..601935df --- /dev/null +++ b/jarhc/src/integrationTest/resources/maven-search-api-responses/d74d4ba0dee443f68fb2dcb7fcdb945a2cd89912.json @@ -0,0 +1,44 @@ +{ + "response": { + "docs": [{ + "p": "jar", + "a": "asm", + "v": "7.0", + "g": "org.ow2.asm", + "id": "org.ow2.asm:asm:7.0", + "ec": [ + "-javadoc.jar", + "-sources.jar", + ".jar", + ".pom" + ], + "timestamp": 1540647750000, + "tags": [ + "bytecode", + "java", + "fast", + "small", + "framework", + "manipulation", + "very" + ] + }], + "numFound": 1, + "start": 0 + }, + "responseHeader": { + "QTime": 1, + "params": { + "q": "1:\"d74d4ba0dee443f68fb2dcb7fcdb945a2cd89912\"", + "core": "", + "indent": "off", + "fl": "id,g,a,v,p,ec,timestamp,tags", + "start": "", + "sort": "score desc,timestamp desc,g asc,a asc,v desc", + "rows": "20", + "wt": "json", + "version": "2.2" + }, + "status": 0 + } +} \ No newline at end of file diff --git a/jarhc/src/integrationTest/resources/maven-search-api-responses/e024388db5ace49c7459e68b5c0e542ef55fd49b.json b/jarhc/src/integrationTest/resources/maven-search-api-responses/e024388db5ace49c7459e68b5c0e542ef55fd49b.json new file mode 100644 index 00000000..a2b65a8e --- /dev/null +++ b/jarhc/src/integrationTest/resources/maven-search-api-responses/e024388db5ace49c7459e68b5c0e542ef55fd49b.json @@ -0,0 +1,36 @@ +{ + "response": { + "docs": [{ + "p": "jar", + "a": "jetty-continuation", + "v": "9.4.20.v20190813", + "g": "org.eclipse.jetty", + "id": "org.eclipse.jetty:jetty-continuation:9.4.20.v20190813", + "ec": [ + "-sources.jar", + "-javadoc.jar", + ".jar", + ".pom" + ], + "timestamp": 1565732378000, + "tags": ["asynchronous"] + }], + "numFound": 1, + "start": 0 + }, + "responseHeader": { + "QTime": 4, + "params": { + "q": "1:\"e024388db5ace49c7459e68b5c0e542ef55fd49b\"", + "core": "", + "indent": "off", + "fl": "id,g,a,v,p,ec,timestamp,tags", + "start": "", + "sort": "score desc,timestamp desc,g asc,a asc,v desc", + "rows": "20", + "wt": "json", + "version": "2.2" + }, + "status": 0 + } +} \ No newline at end of file diff --git a/jarhc/src/integrationTest/resources/maven-search-api-responses/edda2fd904a881114aba79e2f881c6f4004e8148.json b/jarhc/src/integrationTest/resources/maven-search-api-responses/edda2fd904a881114aba79e2f881c6f4004e8148.json new file mode 100644 index 00000000..49cfd3f9 --- /dev/null +++ b/jarhc/src/integrationTest/resources/maven-search-api-responses/edda2fd904a881114aba79e2f881c6f4004e8148.json @@ -0,0 +1,41 @@ +{ + "response": { + "docs": [{ + "p": "jar", + "a": "jetty-http", + "v": "9.4.20.v20190813", + "g": "org.eclipse.jetty", + "id": "org.eclipse.jetty:jetty-http:9.4.20.v20190813", + "ec": [ + "-javadoc.jar", + "-sources.jar", + "-tests.jar", + ".jar", + ".pom" + ], + "timestamp": 1565731772000, + "tags": [ + "project", + "jetty", + "eclipse" + ] + }], + "numFound": 1, + "start": 0 + }, + "responseHeader": { + "QTime": 2, + "params": { + "q": "1:\"edda2fd904a881114aba79e2f881c6f4004e8148\"", + "core": "", + "indent": "off", + "fl": "id,g,a,v,p,ec,timestamp,tags", + "start": "", + "sort": "score desc,timestamp desc,g asc,a asc,v desc", + "rows": "20", + "wt": "json", + "version": "2.2" + }, + "status": 0 + } +} \ No newline at end of file