From 7f645ee76c3cca5582b15b1bdba733555c985433 Mon Sep 17 00:00:00 2001 From: Gcolon021 <34667267+Gcolon021@users.noreply.github.com> Date: Wed, 29 Nov 2023 11:30:54 -0500 Subject: [PATCH 1/4] [ALS-5422] Add persistence.xml to visualization resource (#161) (#162) The visualization resource is failing to start due to an error injecting persistence unit into CDI managed bean. It is unable to find a persistence unit named ''. --- .../src/main/resources/META-INF/persistence.xml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 pic-sure-resources/pic-sure-visualization-resource/src/main/resources/META-INF/persistence.xml diff --git a/pic-sure-resources/pic-sure-visualization-resource/src/main/resources/META-INF/persistence.xml b/pic-sure-resources/pic-sure-visualization-resource/src/main/resources/META-INF/persistence.xml new file mode 100644 index 00000000..307ff002 --- /dev/null +++ b/pic-sure-resources/pic-sure-visualization-resource/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,7 @@ + + + + + From 86275ce1e773657c56f2c9d4c15d98186d083cd2 Mon Sep 17 00:00:00 2001 From: Gcolon021 <34667267+Gcolon021@users.noreply.github.com> Date: Fri, 8 Dec 2023 16:19:29 -0500 Subject: [PATCH 2/4] Sync new Release/0008 with Master (#168) * [ALS-5422] Add persistence.xml to visualization resource (#161) The visualization resource is failing to start due to an error injecting persistence unit into CDI managed bean. It is unable to find a persistence unit named ''. * [ALS-0000] Fix aggregate resource - Very confused as to how this was working before * [ALS-5422] Add persistence.xml to visualization resource (#161) (#162) (#163) The visualization resource is failing to start due to an error injecting persistence unit into CDI managed bean. It is unable to find a persistence unit named ''. --------- Co-authored-by: Luke Sikina --- .../hms/dbmi/avillach/AggregateDataSharingResourceRS.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pic-sure-resources/pic-sure-aggregate-data-sharing-resource/src/main/java/edu/harvard/hms/dbmi/avillach/AggregateDataSharingResourceRS.java b/pic-sure-resources/pic-sure-aggregate-data-sharing-resource/src/main/java/edu/harvard/hms/dbmi/avillach/AggregateDataSharingResourceRS.java index 46c5a89e..60b62b5c 100644 --- a/pic-sure-resources/pic-sure-aggregate-data-sharing-resource/src/main/java/edu/harvard/hms/dbmi/avillach/AggregateDataSharingResourceRS.java +++ b/pic-sure-resources/pic-sure-aggregate-data-sharing-resource/src/main/java/edu/harvard/hms/dbmi/avillach/AggregateDataSharingResourceRS.java @@ -228,7 +228,8 @@ public Response querySync(QueryRequest queryRequest) { Set allowedResultTypes = Set.of( "COUNT", "CROSS_COUNT", "INFO_COLUMN_LISTING", "OBSERVATION_COUNT", - "OBSERVATION_CROSS_COUNT", "CATEGORICAL_CROSS_COUNT", "CONTINUOUS_CROSS_COUNT" + "OBSERVATION_CROSS_COUNT", "CATEGORICAL_CROSS_COUNT", "CONTINUOUS_CROSS_COUNT", + "VARIANT_COUNT_FOR_QUERY", "AGGREGATE_VCF_EXCERPT", "VCF_EXCERPT" ); if (!allowedResultTypes.contains(expectedResultType)) { From 6adfc96db43d18f1506bfaf28373f89a2e42d555 Mon Sep 17 00:00:00 2001 From: Gcolon021 <34667267+Gcolon021@users.noreply.github.com> Date: Fri, 15 Dec 2023 10:20:28 -0500 Subject: [PATCH 3/4] [ALS-5061] Remove HSAPIResource (#166) [ALS-5061] Remove HSAPIResource (#166) --- pic-sure-api-wildfly/pom.xml | 6 - .../dbmi/avillach/HSAPIResourceIT.java | 209 ------- .../pic-sure-hsapi-resource/README.md | 58 -- .../pic-sure-hsapi-resource/pom.xml | 69 --- .../hms/dbmi/avillach/HSAPIResourceRS.java | 225 -------- .../hms/dbmi/avillach/JAXRSConfiguration.java | 26 - .../resources/webapp/META-INF/context.xml | 3 - .../main/resources/webapp/WEB-INF/beans.xml | 6 - .../wildflyConfiguration/standalone.xml | 519 ------------------ pic-sure-resources/pom.xml | 1 - 10 files changed, 1122 deletions(-) delete mode 100644 pic-sure-api-wildfly/src/test/java/edu/harvard/dbmi/avillach/HSAPIResourceIT.java delete mode 100644 pic-sure-resources/pic-sure-hsapi-resource/README.md delete mode 100644 pic-sure-resources/pic-sure-hsapi-resource/pom.xml delete mode 100644 pic-sure-resources/pic-sure-hsapi-resource/src/main/java/edu/harvard/hms/dbmi/avillach/HSAPIResourceRS.java delete mode 100755 pic-sure-resources/pic-sure-hsapi-resource/src/main/java/edu/harvard/hms/dbmi/avillach/JAXRSConfiguration.java delete mode 100755 pic-sure-resources/pic-sure-hsapi-resource/src/main/resources/webapp/META-INF/context.xml delete mode 100755 pic-sure-resources/pic-sure-hsapi-resource/src/main/resources/webapp/WEB-INF/beans.xml delete mode 100644 pic-sure-resources/pic-sure-hsapi-resource/src/main/resources/wildflyConfiguration/standalone.xml diff --git a/pic-sure-api-wildfly/pom.xml b/pic-sure-api-wildfly/pom.xml index 8b8dc576..6d0e0b58 100644 --- a/pic-sure-api-wildfly/pom.xml +++ b/pic-sure-api-wildfly/pom.xml @@ -35,12 +35,6 @@ classes ${project.version} - - edu.harvard.hms.dbmi.avillach - pic-sure-hsapi-resource - classes - ${project.version} - edu.harvard.hms.dbmi.avillach pic-sure-resource-api diff --git a/pic-sure-api-wildfly/src/test/java/edu/harvard/dbmi/avillach/HSAPIResourceIT.java b/pic-sure-api-wildfly/src/test/java/edu/harvard/dbmi/avillach/HSAPIResourceIT.java deleted file mode 100644 index b4d174af..00000000 --- a/pic-sure-api-wildfly/src/test/java/edu/harvard/dbmi/avillach/HSAPIResourceIT.java +++ /dev/null @@ -1,209 +0,0 @@ -package edu.harvard.dbmi.avillach; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import edu.harvard.dbmi.avillach.domain.QueryRequest; -import edu.harvard.dbmi.avillach.util.exception.ApplicationException; -import edu.harvard.dbmi.avillach.util.exception.ProtocolException; -import org.apache.commons.io.IOUtils; -import org.apache.http.Header; -import org.apache.http.HttpResponse; -import org.junit.Test; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static edu.harvard.dbmi.avillach.util.HttpClientUtil.*; -import static org.junit.Assert.*; - -public class HSAPIResourceIT extends BaseIT { - - private final String targetURL = "http://localhost:8079"; - private Header[] headers; - - @Test - public void testStatus() throws UnsupportedOperationException { - HttpResponse response = retrieveGetResponse(composeURL(hsapiEndpointUrl,"pic-sure/hsapi/status"), headers); - assertEquals("Status should return a 200", 200, response.getStatusLine().getStatusCode()); - } - - @Test - public void testInfo() throws UnsupportedOperationException, IOException { - QueryRequest request = new GeneralQueryRequest(); - - String body = objectMapper.writeValueAsString(request); - HttpResponse response = retrievePostResponse(composeURL(hsapiEndpointUrl,"pic-sure/hsapi/info"), headers, body); - assertEquals("Request should return a 200",200, response.getStatusLine().getStatusCode()); - JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent()); - assertNotNull("Response should not be null", responseNode); - assertNotNull("Response should have a name", responseNode.get("name")); - ArrayNode queryFormats = (ArrayNode) responseNode.get("queryFormats"); - assertNotNull("Response should have data in queryFormats", queryFormats); - assertEquals("Response should have 3 queryFormats", 3, queryFormats.size()); - JsonNode firstFormat = queryFormats.get(0); - assertNotNull("QueryFormat should have specifications", firstFormat.get("specification")); - - } - - @Test - public void testSearch() throws UnsupportedOperationException, IOException { - QueryRequest queryRequest = new GeneralQueryRequest(); - - String body = objectMapper.writeValueAsString(queryRequest); - - HttpResponse response = retrievePostResponse(composeURL(hsapiEndpointUrl,"pic-sure/hsapi/search"), headers, body); - assertEquals("Search should return a 501",501, response.getStatusLine().getStatusCode()); - JsonNode responseMessage = objectMapper.readTree(response.getEntity().getContent()); - assertNotNull("Response message should not be null", responseMessage); - String errorMessage = responseMessage.get("message").asText(); - assertEquals("Error message should be 'Search is not implemented for this resource'", "Search is not implemented for this resource", errorMessage); - } - - @Test - public void testQuery() throws UnsupportedOperationException, IOException { - QueryRequest queryRequest = new GeneralQueryRequest(); - - String body = objectMapper.writeValueAsString(queryRequest); - - HttpResponse response = retrievePostResponse(composeURL(hsapiEndpointUrl,"pic-sure/hsapi/query"), headers, body); - assertEquals("Search should return a 501",501, response.getStatusLine().getStatusCode()); - JsonNode responseMessage = objectMapper.readTree(response.getEntity().getContent()); - assertNotNull("Response message should not be null", responseMessage); - String errorMessage = responseMessage.get("message").asText(); - assertEquals("Error message should be 'Query is not implemented in this resource. Please use query/sync'", "Query is not implemented in this resource. Please use query/sync", errorMessage); - } - - //These tests will throw a 404 unless we have a valid queryId which can't really be gotten just for a test.... - /*@Test - public void testQueryStatus() throws UnsupportedOperationException, IOException { - } - - @Test - public void testRequest() throws UnsupportedOperationException, IOException { - }*/ - - @Test - public void testQuerySync() throws UnsupportedOperationException, IOException { - Map resourceResponse = new HashMap<>(); - List> results = new ArrayList<>(); - Map firstResult = new HashMap<>(); - firstResult.put("resource_id", "123abc"); - firstResult.put("url", "http://aUrl.org/path/contents/file.csv"); - results.add(firstResult); - resourceResponse.put("results", results); - - wireMockRule.stubFor(any(urlPathMatching("/resource")) - .willReturn(aResponse() - .withStatus(200) - .withBody(objectMapper.writeValueAsString(resourceResponse)))); - - wireMockRule.stubFor(any(urlPathMatching("/resource/.*/files")) - .willReturn(aResponse() - .withStatus(200) - .withBody(objectMapper.writeValueAsString(resourceResponse)))); - - wireMockRule.stubFor(any(urlPathMatching("/resource/.*/files/.*")) - .willReturn(aResponse() - .withStatus(200) - .withBody(objectMapper.writeValueAsString(resourceResponse)))); - - QueryRequest queryRequest = new GeneralQueryRequest(); - String body = objectMapper.writeValueAsString(queryRequest); - - //Should throw an error if missing query object - HttpResponse response = retrievePostResponse(composeURL(hsapiEndpointUrl,"pic-sure/hsapi/query/sync"), headers, body); - assertEquals("Missing query object should return a 500",500, response.getStatusLine().getStatusCode()); - JsonNode responseMessage = objectMapper.readTree(response.getEntity().getContent()); - assertNotNull("Response message should not be null", responseMessage); - String errorMessage = responseMessage.get("message").asText(); - System.out.println("Response message is: " + responseMessage); - assertTrue("Error message should be " + ProtocolException.MISSING_DATA, errorMessage.contains(ProtocolException.MISSING_DATA)); - - //Should throw an error if missing targetURL - Map queryNode = new HashMap<>(); - queryRequest.setQuery(queryNode); -// body = objectMapper.writeValueAsString(queryRequest); -// response = retrievePostResponse(composeURL(hsapiEndpointUrl,"pic-sure/hsapi/query/sync"), headers, body); -// assertEquals("Missing target URL should return 500",500, response.getStatusLine().getStatusCode()); -// responseMessage = objectMapper.readTree(response.getEntity().getContent()); -// assertNotNull("Response message should not be null", responseMessage); -// errorMessage = responseMessage.get("message").asText(); -// assertTrue("Error message should be " + ApplicationException.MISSING_TARGET_URL, errorMessage.contains(ApplicationException.MISSING_TARGET_URL)); - - //Should throw error if no 'entity' included - body = objectMapper.writeValueAsString(queryRequest); - response = retrievePostResponse(composeURL(hsapiEndpointUrl,"pic-sure/hsapi/query/sync"), headers, body); - assertEquals("Missing entity should return 500",500, response.getStatusLine().getStatusCode()); - responseMessage = objectMapper.readTree(response.getEntity().getContent()); - assertNotNull("Response message should not be null", responseMessage); - errorMessage = responseMessage.get("message").asText(); - assertTrue("Error message should be 'Entity required'", errorMessage.contains("Entity required")); - - queryNode.put("entity", "nonentity"); - body = objectMapper.writeValueAsString(queryRequest); - response = retrievePostResponse(composeURL(hsapiEndpointUrl,"pic-sure/hsapi/query/sync"), headers, body); - assertEquals("Incorrect entity should return 500",500, response.getStatusLine().getStatusCode()); - responseMessage = objectMapper.readTree(response.getEntity().getContent()); - assertNotNull("Response message should not be null", responseMessage); - errorMessage = responseMessage.get("message").asText(); - //TODO Should we do something different instead? - assertTrue("Error message should be '404 NOT FOUND'", errorMessage.toUpperCase().contains("404 NOT FOUND")); - - //Ok this one should work - queryNode.put("entity", "resource"); - body = objectMapper.writeValueAsString(queryRequest); - response = retrievePostResponse(composeURL(hsapiEndpointUrl,"pic-sure/hsapi/query/sync"), headers, body); - assertEquals(200, response.getStatusLine().getStatusCode()); - - //Need to get an id to use - JsonNode result = objectMapper.readTree(response.getEntity().getContent()); - assertNotNull("Results should not be null", result.get("results")); - String id = result.get("results").get(0).get("resource_id").asText(); - - //This skips over the required id - queryNode.put("subentity", "files"); - body = objectMapper.writeValueAsString(queryRequest); - response = retrievePostResponse(composeURL(hsapiEndpointUrl,"pic-sure/hsapi/query/sync"), headers, body); - assertEquals("Incorrect entity should return 500",500, response.getStatusLine().getStatusCode()); - responseMessage = objectMapper.readTree(response.getEntity().getContent()); - assertNotNull("Response message should not be null", responseMessage); - errorMessage = responseMessage.get("message").asText(); - assertTrue("Error message should be 'Cannot have subentity without an id'", errorMessage.contains("Cannot have subentity without an id")); - - queryNode.put("id", id); - body = objectMapper.writeValueAsString(queryRequest); - response = retrievePostResponse(composeURL(hsapiEndpointUrl,"pic-sure/hsapi/query/sync"), headers, body); - assertEquals(200, response.getStatusLine().getStatusCode()); - - //Need to get a pathname to use - result = objectMapper.readTree(response.getEntity().getContent()); - assertNotNull("Results should not be null", result.get("results")); - - String pathname = result.get("results").get(0).get("url").asText(); - pathname = pathname.substring(pathname.lastIndexOf("/")); - queryNode.put("pathname", pathname); - queryNode.put("subentity", "files"); - body = objectMapper.writeValueAsString(queryRequest); - response = retrievePostResponse(composeURL(hsapiEndpointUrl,"pic-sure/hsapi/query/sync"), headers, body); - assertEquals(200, response.getStatusLine().getStatusCode()); - - //Should fail with a page where it isn't allowed - queryNode.put("page", "2"); - body = objectMapper.writeValueAsString(queryRequest); - response = retrievePostResponse(composeURL(hsapiEndpointUrl,"pic-sure/hsapi/query/sync"), headers, body); - assertEquals(500, response.getStatusLine().getStatusCode()); - - //But should work with a page for this one - queryNode.remove("pathname"); - body = objectMapper.writeValueAsString(queryRequest); - response = retrievePostResponse(composeURL(hsapiEndpointUrl,"pic-sure/hsapi/query/sync"), headers, body); - assertEquals(200, response.getStatusLine().getStatusCode()); - result = objectMapper.readTree(response.getEntity().getContent()); - assertNotNull("Response message should not be null", result.get("results")); - - } -} diff --git a/pic-sure-resources/pic-sure-hsapi-resource/README.md b/pic-sure-resources/pic-sure-hsapi-resource/README.md deleted file mode 100644 index ed78b6d4..00000000 --- a/pic-sure-resources/pic-sure-hsapi-resource/README.md +++ /dev/null @@ -1,58 +0,0 @@ -### HSAPI Commons Resource - -This resource queries the [CommonsShare API](https://beta.commonsshare.org/) - -The following endpoints are supported: -* /hsapi/resource/ -* /haspi/resource/{id} -* /hsapi/resource/{id}/files/ -* /hsapi/resource/{id}/files/{pathname}/ -* /hsapi/resource/{id}/folders/{pathname}/ - -`resource` is the entity being queried; `files` and `folders` are the subentities. - -Sample resource query: -``` -{ "resourceUUID" : "${HSAPI-RESOURCE-ID}", - "query": - { - "entity": "resource - } -} -``` - -Sample resource query by page: -``` -{ "resourceUUID" : "${HSAPI-RESOURCE-ID}", - "query": - { - "entity": "resource, - "page": "2" - } -} -``` - -Sample files query: -``` -{ "resourceUUID" : "${HSAPI-RESOURCE-ID}", - "query": - { - "entity": "resource, - "id": "123-abc", - "subentity": "files" - } -} -``` - -Sample single file query: -``` -{ "resourceUUID" : "${HSAPI-RESOURCE-ID}", - "query": - { - "entity": "resource, - "id": "123-abc", - "subentity": "files", - "pathname": "/content/filename.csv" - } -} -``` \ No newline at end of file diff --git a/pic-sure-resources/pic-sure-hsapi-resource/pom.xml b/pic-sure-resources/pic-sure-hsapi-resource/pom.xml deleted file mode 100644 index c5505a8e..00000000 --- a/pic-sure-resources/pic-sure-hsapi-resource/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - 4.0.0 - - edu.harvard.hms.dbmi.avillach - pic-sure-resources - 2.1.0-SNAPSHOT - - pic-sure-hsapi-resource - pic-sure-hsapi-resource - war - http://maven.apache.org - - 13.0.0.Final - ${project.build.directory}/wildfly-${wildfly.version} - UTF-8 - - - - edu.harvard.hms.dbmi.avillach - pic-sure-resource-api - ${project.version} - - - javax - javaee-api - provided - - - org.apache.httpcomponents - httpclient - 4.5.13 - - - com.fasterxml.jackson.core - jackson-databind - - - commons-io - commons-io - 2.7 - - - org.jboss.resteasy - resteasy-jaxb-provider - 3.0.8.Final - - - edu.harvard.hms.dbmi.avillach - pic-sure-util - ${project.version} - - - org.apache.commons - commons-lang3 - 3.7 - - - org.hibernate.javax.persistence - hibernate-jpa-2.1-api - - - org.hibernate - hibernate-annotations - - - diff --git a/pic-sure-resources/pic-sure-hsapi-resource/src/main/java/edu/harvard/hms/dbmi/avillach/HSAPIResourceRS.java b/pic-sure-resources/pic-sure-hsapi-resource/src/main/java/edu/harvard/hms/dbmi/avillach/HSAPIResourceRS.java deleted file mode 100644 index 58d94262..00000000 --- a/pic-sure-resources/pic-sure-hsapi-resource/src/main/java/edu/harvard/hms/dbmi/avillach/HSAPIResourceRS.java +++ /dev/null @@ -1,225 +0,0 @@ -package edu.harvard.hms.dbmi.avillach; - -import java.io.IOException; -import java.util.*; - -import javax.ws.rs.*; -import javax.ws.rs.core.Response; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import edu.harvard.dbmi.avillach.domain.*; -import edu.harvard.dbmi.avillach.util.exception.ApplicationException; -import edu.harvard.dbmi.avillach.util.exception.ProtocolException; -import edu.harvard.dbmi.avillach.util.exception.ResourceInterfaceException; -import org.apache.http.Header; -import org.apache.http.HttpResponse; - -import edu.harvard.dbmi.avillach.service.IResourceRS; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static edu.harvard.dbmi.avillach.util.HttpClientUtil.*; - - -@Path("/hsapi") -@Produces("application/json") -@Consumes("application/json") -public class HSAPIResourceRS implements IResourceRS -{ - private final static ObjectMapper json = new ObjectMapper(); - private ResourceInfo HSAPIresourceInfo = new ResourceInfo(); - private Header[] headers; - private Logger logger = LoggerFactory.getLogger(this.getClass()); - - public static String targetURL = System.getenv("HSAPI_TARGET_URL"); - - public HSAPIResourceRS() { - //This only needs to be done once - List queryFormats = new ArrayList<>(); - - // /hsapi/resource/ - QueryFormat resource = new QueryFormat().setName("Resource List").setDescription("List existing resources"); - Map specification = new HashMap<>(); - specification.put("entity", "The type of entity you wish to retrieve or explore - e.g. resource or user"); - specification.put("page", "Optional - A page number within the paginated result set"); - resource.setSpecification(specification); - - Map example = new HashMap<>(); - example.put("entity", "resource"); - List> examples = new ArrayList<>(); - examples.add(example); - - Map example2 = new HashMap<>(); - example2.put("entity", "resource"); - example2.put("page", "2"); - examples.add(example2); - - resource.setExamples(examples); - queryFormats.add(resource); - - // /hsapi/resource/{id}/files/ - QueryFormat files = new QueryFormat().setName("File List").setDescription("Get a listing of files within a resource"); - specification.put("entity", "The type of entity you wish to retrieve or explore - e.g. resource or user"); - specification.put("id", "The id of the specific entity to retrieve or explore"); - specification.put("subentity", "A type of entity within the main entity - e.g. file (under resource)"); - specification.put("page", "Optional - A page number within the paginated result set"); - files.setSpecification(specification); - - example = new HashMap<>(); - example.put("entity", "resource"); - example.put("id", "a1b23c"); - example.put("subentity", "files"); - examples = new ArrayList<>(); - examples.add(example); - - example2 = new HashMap<>(); - example2.put("entity", "resource"); - example2.put("id", "a1b23c"); - example2.put("subentity", "files"); - example2.put("page", "2"); - examples.add(example2); - files.setExamples(examples); - queryFormats.add(files); - - // /hsapi/resource/{id}/files/{pathname}/ - QueryFormat filePath = new QueryFormat().setName("Get File").setDescription("Retrieve a resource file"); - - specification.put("entity", "The type of entity you wish to retrieve or explore - e.g. resource or user"); - specification.put("id", "The id of the specific entity to retrieve or explore"); - specification.put("subentity", "A type of entity within the main entity - e.g. file (under resource)"); - specification.put("pathname", "The name or path of the specific subentity you are looking for"); - files.setSpecification(specification); - - example = new HashMap<>(); - example.put("entity", "resource"); - example.put("id", "a1b23c"); - example.put("subentity", "files"); - example.put("pathname", "abc.csv"); - examples = new ArrayList<>(); - examples.add(example); - filePath.setExamples(examples); - queryFormats.add(filePath); - - HSAPIresourceInfo.setQueryFormats(queryFormats); - } - - @GET - @Path("/status") - public Response status() { - return Response.ok().build(); - } - - @POST - @Path("/info") - @Override - public ResourceInfo info(QueryRequest queryRequest) { - logger.debug("Calling HSAPI Resource info()"); - HSAPIresourceInfo.setName("HSAPI Resource : " + targetURL); - return HSAPIresourceInfo; - } - - @POST - @Path("/search") - @Override - public SearchResults search(QueryRequest searchJson) { - logger.debug("Calling HSAPI Resource search()"); - throw new UnsupportedOperationException("Search is not implemented for this resource"); - } - - @POST - @Path("/query") - @Override - public QueryStatus query(QueryRequest queryJson) { - logger.debug("Calling HSAPI Resource query()"); - throw new UnsupportedOperationException("Query is not implemented in this resource. Please use query/sync"); - } - - @POST - @Path("/query/{resourceQueryId}/status") - @Override - public QueryStatus queryStatus(@PathParam("resourceQueryId") UUID queryId, QueryRequest statusQuery) { - logger.debug("calling HSAPI Resource queryStatus() for query {}", queryId); - throw new UnsupportedOperationException("Query status is not implemented in this resource. Please use query/sync"); - - } - - @POST - @Path("/query/{resourceQueryId}/result") - @Override - public Response queryResult(@PathParam("resourceQueryId") UUID queryId, QueryRequest statusQuery) { - logger.debug("calling HSAPI Resource queryResult() for query {}", queryId); - throw new UnsupportedOperationException("Query result is not implemented in this resource. Please use query/sync"); - } - - @POST - @Path("/query/sync") - @Override - public Response querySync(QueryRequest resultRequest) { - logger.debug("calling HSAPI Resource querySync()"); - if (targetURL == null || targetURL.isEmpty()){ - throw new ApplicationException(ApplicationException.MISSING_TARGET_URL); - } - - if (resultRequest == null){ - throw new ProtocolException(ProtocolException.MISSING_DATA); - } - - Object queryObject = resultRequest.getQuery(); - if (queryObject == null) { - throw new ProtocolException(ProtocolException.MISSING_DATA); - } - - String path = buildPath(resultRequest); - - HttpResponse response = retrieveGetResponse(path, headers); - if (response.getStatusLine().getStatusCode() != 200) { - logger.error(targetURL + " did not return a 200: {} {}", response.getStatusLine().getStatusCode(), response.getStatusLine().getReasonPhrase()); - throwResponseError(response, targetURL); - } - try { - return Response.ok(response.getEntity().getContent()).build(); - } catch (IOException e){ - throw new ResourceInterfaceException("Unable to read the resource response: " + e.getMessage()); - } - } - - private String buildPath (QueryRequest request){ - JsonNode node = json.valueToTree(request.getQuery()); - - if (!node.has("entity")){ - throw new ProtocolException("Entity required"); - } - String path = node.get("entity").asText(); - - //Alert user if their request is ill-formed - if (node.has("id")) { - path += "/" + node.get("id").asText(); - } - - if (node.has("subentity")) { - if (!node.has("id")) { - throw new ProtocolException("Cannot have subentity without an id"); - } - path += "/" + node.get("subentity").asText(); - } - - if (node.has("pathname")){ - if (!node.has("subentity")) { - throw new ProtocolException("Cannot have pathname without subentity"); - } - path += "/" + node.get("pathname").asText(); - } - - if (node.has("page")){ - if (node.has("pathname") || (node.has("id") && !node.has("subentity"))){ - throw new ProtocolException("Page can only be included at the end of entities or subentities"); - } - String query = "/?page=" + node.get("page").asText(); - return composeURL(targetURL, path, query); - } - - return composeURL(targetURL, path); - } - -} diff --git a/pic-sure-resources/pic-sure-hsapi-resource/src/main/java/edu/harvard/hms/dbmi/avillach/JAXRSConfiguration.java b/pic-sure-resources/pic-sure-hsapi-resource/src/main/java/edu/harvard/hms/dbmi/avillach/JAXRSConfiguration.java deleted file mode 100755 index 8a8c4932..00000000 --- a/pic-sure-resources/pic-sure-hsapi-resource/src/main/java/edu/harvard/hms/dbmi/avillach/JAXRSConfiguration.java +++ /dev/null @@ -1,26 +0,0 @@ -package edu.harvard.hms.dbmi.avillach; - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import javax.servlet.annotation.WebListener; -import javax.ws.rs.ApplicationPath; -import javax.ws.rs.core.Application; - -@ApplicationPath("pic-sure") -@WebListener -public class JAXRSConfiguration extends Application implements ServletContextListener { - - @Override - public void contextInitialized(ServletContextEvent event) { - ServletContext servletContext = event.getServletContext(); - servletContext.setInitParameter("resteasy.resources", "org.jboss.resteasy.plugins.stats.RegistryStatsResource"); - } - - @Override - public void contextDestroyed(ServletContextEvent event) { - // NOOP. - } - - -} diff --git a/pic-sure-resources/pic-sure-hsapi-resource/src/main/resources/webapp/META-INF/context.xml b/pic-sure-resources/pic-sure-hsapi-resource/src/main/resources/webapp/META-INF/context.xml deleted file mode 100755 index 9f4aa7fd..00000000 --- a/pic-sure-resources/pic-sure-hsapi-resource/src/main/resources/webapp/META-INF/context.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/pic-sure-resources/pic-sure-hsapi-resource/src/main/resources/webapp/WEB-INF/beans.xml b/pic-sure-resources/pic-sure-hsapi-resource/src/main/resources/webapp/WEB-INF/beans.xml deleted file mode 100755 index 9a692dbe..00000000 --- a/pic-sure-resources/pic-sure-hsapi-resource/src/main/resources/webapp/WEB-INF/beans.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - \ No newline at end of file diff --git a/pic-sure-resources/pic-sure-hsapi-resource/src/main/resources/wildflyConfiguration/standalone.xml b/pic-sure-resources/pic-sure-hsapi-resource/src/main/resources/wildflyConfiguration/standalone.xml deleted file mode 100644 index 9e2a698e..00000000 --- a/pic-sure-resources/pic-sure-hsapi-resource/src/main/resources/wildflyConfiguration/standalone.xml +++ /dev/null @@ -1,519 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE - h2 - - sa - sa - - - - jdbc:h2:mem:picsure;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE - h2 - - sa - sa - - - - - org.h2.jdbcx.JdbcDataSource - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${jboss.bind.address:127.0.0.1} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pic-sure-resources/pom.xml b/pic-sure-resources/pom.xml index 2770f877..8ad1f885 100644 --- a/pic-sure-resources/pom.xml +++ b/pic-sure-resources/pom.xml @@ -12,7 +12,6 @@ pic-sure-resource-api pic-sure-ga4gh-dos - pic-sure-hsapi-resource pic-sure-passthrough-resource pic-sure-aggregate-data-sharing-resource pic-sure-visualization-resource From 31c7f9c43cb6c87da61920655f8c77134d3367bd Mon Sep 17 00:00:00 2001 From: Gcolon021 <34667267+Gcolon021@users.noreply.github.com> Date: Tue, 19 Dec 2023 17:58:53 -0500 Subject: [PATCH 4/4] [ALS-3978] Update version handling in multiple pom.xml files (#167) * [ALS-3978] Update version handling in multiple pom.xml files This commit removes hardcoded versions of dependencies from individual pom.xml files and introduces them into the root pom.xml's properties section. This centralizes the control of dependency versions to prevent inconsistencies and makes future updates more straightforward. This change covers several libraries including Guava, JUnit Jupiter, Mockito, and others. * Update library versions and clean up pom.xml Upgraded dependencies including Jackson, Guava, JUnit, Hibernate, HttpClient, and Commons-IO. Also, improved the management of versions via property variables and cleaned up inconsistent formatting. Removed an unnecessary comment related to Mockito version compatibility. * Remove specific version references in pom.xml files The changes encompass the removal of explicit version references in the project's pom.xml files. By relying on property variables, this maintenance update enhances dependency management flexibility. Specific version comments also have been removed to eliminate clutter and improve overall file readability. * Update pom.xml to use property variables for versions The changes primarily involve updating the pom.xml file to use property variables instead of hardcoding the version numbers. This is a better approach as it improves the flexibility in managing dependencies. This change also results in cleaner and more readable code by removing unnecessary explicit version references. * Downgrade Spring version in pom.xml The Spring version has been downgraded in the pom.xml file from 6.1.1 to 5.3.31. This is due to java version requirement of 17+ for 6.x --- pic-sure-api-data/pom.xml | 1 - pic-sure-api-war/pom.xml | 2 - pic-sure-initializer/pom.xml | 7 - .../pom.xml | 4 - pic-sure-resources/pic-sure-ga4gh-dos/pom.xml | 4 - .../pic-sure-passthrough-resource/pom.xml | 8 -- .../pic-sure-resource-api/pom.xml | 4 +- .../pic-sure-visualization-resource/pom.xml | 17 +-- pic-sure-resources/pom.xml | 1 - pic-sure-util/pom.xml | 7 - pom.xml | 130 ++++++++++++++++-- 11 files changed, 120 insertions(+), 65 deletions(-) diff --git a/pic-sure-api-data/pom.xml b/pic-sure-api-data/pom.xml index 55b6eecd..beed91bd 100755 --- a/pic-sure-api-data/pom.xml +++ b/pic-sure-api-data/pom.xml @@ -40,7 +40,6 @@ io.swagger.core.v3 swagger-annotations - 2.2.8 diff --git a/pic-sure-api-war/pom.xml b/pic-sure-api-war/pom.xml index b2c3ae41..9d476c96 100755 --- a/pic-sure-api-war/pom.xml +++ b/pic-sure-api-war/pom.xml @@ -32,7 +32,6 @@ com.github.tomakehurst wiremock-jre8 - 2.27.2 test @@ -69,7 +68,6 @@ org.apache.cxf cxf-rt-frontend-jaxrs - 3.4.1 test diff --git a/pic-sure-initializer/pom.xml b/pic-sure-initializer/pom.xml index c17e7f4a..24162e53 100644 --- a/pic-sure-initializer/pom.xml +++ b/pic-sure-initializer/pom.xml @@ -7,16 +7,12 @@ edu.harvard.hms.dbmi.avillach 2.0.0-SNAPSHOT - pic-sure-initializer - pic-sure-initializer - commons-io commons-io - 2.7 edu.harvard.hms.dbmi.avillach @@ -26,19 +22,16 @@ junit junit - 4.11 test org.apache.httpcomponents httpclient - 4.5.13 compile commons-cli commons-cli - 1.4 diff --git a/pic-sure-resources/pic-sure-aggregate-data-sharing-resource/pom.xml b/pic-sure-resources/pic-sure-aggregate-data-sharing-resource/pom.xml index 69fec0d2..47ac0ff4 100644 --- a/pic-sure-resources/pic-sure-aggregate-data-sharing-resource/pom.xml +++ b/pic-sure-resources/pic-sure-aggregate-data-sharing-resource/pom.xml @@ -40,7 +40,6 @@ org.apache.httpcomponents httpclient - 4.5.13 org.apache.httpcomponents @@ -53,12 +52,10 @@ commons-io commons-io - 2.7 org.jboss.resteasy resteasy-jaxb-provider - 3.0.8.Final edu.harvard.hms.dbmi.avillach @@ -68,7 +65,6 @@ org.apache.commons commons-lang3 - 3.7 org.hibernate.javax.persistence diff --git a/pic-sure-resources/pic-sure-ga4gh-dos/pom.xml b/pic-sure-resources/pic-sure-ga4gh-dos/pom.xml index fb9694f7..2bc99fa9 100644 --- a/pic-sure-resources/pic-sure-ga4gh-dos/pom.xml +++ b/pic-sure-resources/pic-sure-ga4gh-dos/pom.xml @@ -31,7 +31,6 @@ org.apache.httpcomponents httpclient - 4.5.13 com.fasterxml.jackson.core @@ -40,12 +39,10 @@ commons-io commons-io - 2.7 org.jboss.resteasy resteasy-jaxb-provider - 3.0.8.Final edu.harvard.hms.dbmi.avillach @@ -55,7 +52,6 @@ org.apache.commons commons-lang3 - 3.7 org.hibernate.javax.persistence diff --git a/pic-sure-resources/pic-sure-passthrough-resource/pom.xml b/pic-sure-resources/pic-sure-passthrough-resource/pom.xml index ff591ceb..e4eec756 100644 --- a/pic-sure-resources/pic-sure-passthrough-resource/pom.xml +++ b/pic-sure-resources/pic-sure-passthrough-resource/pom.xml @@ -14,10 +14,6 @@ 13.0.0.Final ${project.build.directory}/wildfly-${wildfly.version} UTF-8 - 25.1-jre - 5.6.2 - 3.5.10 - 3.5.10 @@ -54,24 +50,20 @@ com.google.guava guava - ${guava.version} org.junit.jupiter junit-jupiter - ${junit-jupiter.version} test org.mockito mockito-core - ${mockito-core.version} test org.mockito mockito-junit-jupiter - ${mockito-junit-jupiter.version} test diff --git a/pic-sure-resources/pic-sure-resource-api/pom.xml b/pic-sure-resources/pic-sure-resource-api/pom.xml index edcd0e62..cae79567 100755 --- a/pic-sure-resources/pic-sure-resource-api/pom.xml +++ b/pic-sure-resources/pic-sure-resource-api/pom.xml @@ -59,18 +59,16 @@ io.swagger.core.v3 swagger-annotations - 2.2.8 org.junit.vintage junit-vintage-engine - 5.9.3 test edu.harvard.hms.dbmi.avillach pic-sure-api-data - 2.1.0-SNAPSHOT + ${project.version} diff --git a/pic-sure-resources/pic-sure-visualization-resource/pom.xml b/pic-sure-resources/pic-sure-visualization-resource/pom.xml index 500b4386..164e002f 100644 --- a/pic-sure-resources/pic-sure-visualization-resource/pom.xml +++ b/pic-sure-resources/pic-sure-visualization-resource/pom.xml @@ -19,60 +19,49 @@ org.apache.commons commons-math3 - 3.6.1 com.fasterxml.jackson.core jackson-core - 2.13.1 com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider - 2.13.1 org.springframework spring-core - 5.3.15 org.springframework spring-web - 5.3.15 org.junit.jupiter junit-jupiter-api - 5.9.0 test org.mockito mockito-junit-jupiter - 4.6.1 test org.projectlombok lombok - 1.18.22 org.knowm.xchart xchart - 3.8.1 javax javaee-api - 8.0 provided org.slf4j slf4j-api - 1.7.36 com.fasterxml.jackson.core @@ -85,28 +74,24 @@ edu.harvard.hms.dbmi.avillach pic-sure-resource-api - 2.1.0-SNAPSHOT + ${project.version} compile org.jboss.resteasy resteasy-jaxb-provider - 3.0.8.Final org.reactivestreams reactive-streams - 1.0.4 org.glassfish.jersey.core jersey-common - 2.39.1 org.apache.cxf cxf-rt-transports-http - 3.4.1 compile diff --git a/pic-sure-resources/pom.xml b/pic-sure-resources/pom.xml index 8ad1f885..f6c59db2 100644 --- a/pic-sure-resources/pom.xml +++ b/pic-sure-resources/pom.xml @@ -25,7 +25,6 @@ org.slf4j slf4j-jdk14 - 1.7.32 diff --git a/pic-sure-util/pom.xml b/pic-sure-util/pom.xml index 12dc3f87..22470efb 100644 --- a/pic-sure-util/pom.xml +++ b/pic-sure-util/pom.xml @@ -8,11 +8,8 @@ 2.1.0-SNAPSHOT 4.0.0 - pic-sure-util - - com.fasterxml.jackson.core jackson-core @@ -31,14 +28,11 @@ org.slf4j slf4j-api - org.slf4j slf4j-jdk14 - 1.7.32 - org.apache.httpcomponents httpcore @@ -52,5 +46,4 @@ commons-io - diff --git a/pom.xml b/pom.xml index 48c0b29c..4283a1e7 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,16 @@ - 2.10.5 + 2.16.0 + 32.1.3-jre + 5.6.2 + 3.5.10 + 3.5.10 + 5.3.31 + 6.4.0.Final + 4.5.13 + 2.15.1 + 1.18.30 @@ -50,8 +59,8 @@ 2.22.0 - --illegal-access=permit - + --illegal-access=permit + @@ -61,7 +70,7 @@ junit junit - 4.13.1 + 4.13.2 test @@ -75,7 +84,7 @@ com.fasterxml.jackson.core jackson-databind - 2.10.5.1 + ${jackson.version} com.fasterxml.jackson.core @@ -157,10 +166,9 @@ org.hibernate hibernate-core - 3.5.6-Final + ${hibernate-core.version} provided - org.apache.httpcomponents httpcore @@ -169,12 +177,12 @@ org.apache.httpcomponents httpclient - 4.5.13 + ${httpclient.version} commons-io commons-io - 2.7 + ${commons-io.version} com.github.tomakehurst @@ -185,18 +193,18 @@ org.glassfish.jersey.core jersey-common - 2.26 + 2.39.1 test org.jboss.resteasy resteasy-jaxb-provider - 3.15.1 + 3.0.8.Final org.mockito mockito-core - 2.23.4 + ${mockito-core.version} test @@ -220,6 +228,104 @@ swagger-annotations 2.2.8 + + org.apache.cxf + cxf-rt-frontend-jaxrs + 3.4.1 + test + + + com.github.tomakehurst + wiremock-jre8 + 2.27.2 + test + + + com.google.guava + guava + ${guava.version} + + + org.junit.jupiter + junit-jupiter + ${junit-jupiter.version} + test + + + org.mockito + mockito-junit-jupiter + ${mockito-junit-jupiter.version} + test + + + commons-cli + commons-cli + 1.4 + + + org.slf4j + slf4j-jdk14 + 1.7.32 + + + junit + junit + 4.13.1 + test + + + org.junit.vintage + junit-vintage-engine + 5.9.3 + test + + + org.reactivestreams + reactive-streams + 1.0.4 + + + org.projectlombok + lombok + ${lombok.version} + + + org.knowm.xchart + xchart + 3.8.1 + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + 2.13.1 + + + org.springframework + spring-core + ${spring.version} + + + org.springframework + spring-web + ${spring.version} + + + org.junit.jupiter + junit-jupiter-api + 5.9.0 + test + + + org.apache.commons + commons-math3 + 3.6.1 + + + org.apache.cxf + cxf-rt-transports-http + 3.4.1 + compile +