From ff83a903815a73dc1f7edd21decb25567b0db793 Mon Sep 17 00:00:00 2001 From: Dylan Hall Date: Tue, 12 Mar 2024 07:59:22 -0400 Subject: [PATCH] Support for Translator 3.7.1 (#40) * Support for Translator 3.7.1 * clean up comment --- pom.xml | 16 +++++++++-- .../FormatFailureException.java | 6 ++-- .../FormatterResource.java | 22 +++++++-------- .../bonnie/cqlTranslationServer/Main.java | 4 +-- .../TranslationFailureException.java | 6 ++-- .../TranslationResource.java | 28 +++++++++---------- .../FormatterResourceTest.java | 14 +++++----- .../TranslationResourceTest.java | 28 +++++++++++-------- 8 files changed, 69 insertions(+), 55 deletions(-) diff --git a/pom.xml b/pom.xml index 968a8da..b6ddcaa 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,7 @@ org.glassfish.jaxb jaxb-runtime - 2.4.0-b180830.0438 + 3.1.0-M1 runtime @@ -121,6 +121,16 @@ xpp3 1.1.6 + + jakarta.validation + jakarta.validation-api + 3.1.0-M1 + + + jakarta.xml.bind + jakarta.xml.bind-api + 3.0.1 + @@ -184,8 +194,8 @@ - 3.3.2 - 2.41 + 3.7.1 + 3.0.12 UTF-8 diff --git a/src/main/java/org/mitre/bonnie/cqlTranslationServer/FormatFailureException.java b/src/main/java/org/mitre/bonnie/cqlTranslationServer/FormatFailureException.java index 2ffd668..f7da435 100644 --- a/src/main/java/org/mitre/bonnie/cqlTranslationServer/FormatFailureException.java +++ b/src/main/java/org/mitre/bonnie/cqlTranslationServer/FormatFailureException.java @@ -1,9 +1,9 @@ package org.mitre.bonnie.cqlTranslationServer; import java.util.List; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; public class FormatFailureException extends WebApplicationException { diff --git a/src/main/java/org/mitre/bonnie/cqlTranslationServer/FormatterResource.java b/src/main/java/org/mitre/bonnie/cqlTranslationServer/FormatterResource.java index a363049..0326977 100644 --- a/src/main/java/org/mitre/bonnie/cqlTranslationServer/FormatterResource.java +++ b/src/main/java/org/mitre/bonnie/cqlTranslationServer/FormatterResource.java @@ -3,17 +3,17 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.ResponseBuilder; -import javax.ws.rs.core.UriInfo; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.HeaderParam; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.ResponseBuilder; +import jakarta.ws.rs.core.UriInfo; import org.cqframework.cql.tools.formatter.CqlFormatterVisitor; import org.cqframework.cql.tools.formatter.CqlFormatterVisitor.FormatResult; import org.glassfish.jersey.media.multipart.FormDataBodyPart; diff --git a/src/main/java/org/mitre/bonnie/cqlTranslationServer/Main.java b/src/main/java/org/mitre/bonnie/cqlTranslationServer/Main.java index f4a681a..f2a1335 100644 --- a/src/main/java/org/mitre/bonnie/cqlTranslationServer/Main.java +++ b/src/main/java/org/mitre/bonnie/cqlTranslationServer/Main.java @@ -3,8 +3,8 @@ import java.io.IOException; import java.net.URI; -import javax.ws.rs.core.Feature; -import javax.ws.rs.core.FeatureContext; +import jakarta.ws.rs.core.Feature; +import jakarta.ws.rs.core.FeatureContext; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; diff --git a/src/main/java/org/mitre/bonnie/cqlTranslationServer/TranslationFailureException.java b/src/main/java/org/mitre/bonnie/cqlTranslationServer/TranslationFailureException.java index 7ece83f..15008e1 100644 --- a/src/main/java/org/mitre/bonnie/cqlTranslationServer/TranslationFailureException.java +++ b/src/main/java/org/mitre/bonnie/cqlTranslationServer/TranslationFailureException.java @@ -5,9 +5,9 @@ */ package org.mitre.bonnie.cqlTranslationServer; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; /** * diff --git a/src/main/java/org/mitre/bonnie/cqlTranslationServer/TranslationResource.java b/src/main/java/org/mitre/bonnie/cqlTranslationServer/TranslationResource.java index 90a2e73..091aaab 100644 --- a/src/main/java/org/mitre/bonnie/cqlTranslationServer/TranslationResource.java +++ b/src/main/java/org/mitre/bonnie/cqlTranslationServer/TranslationResource.java @@ -5,20 +5,20 @@ import java.util.Arrays; import java.io.File; import java.io.IOException; -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedHashMap; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.ResponseBuilder; -import javax.ws.rs.core.Response.Status; -import javax.ws.rs.core.UriInfo; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.HeaderParam; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.MultivaluedHashMap; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.ResponseBuilder; +import jakarta.ws.rs.core.Response.Status; +import jakarta.ws.rs.core.UriInfo; import org.cqframework.cql.cql2elm.CqlCompilerOptions; import org.cqframework.cql.cql2elm.CqlTranslator; diff --git a/src/test/java/org/mitre/bonnie/cqlTranslationServer/FormatterResourceTest.java b/src/test/java/org/mitre/bonnie/cqlTranslationServer/FormatterResourceTest.java index a760bba..723ddad 100644 --- a/src/test/java/org/mitre/bonnie/cqlTranslationServer/FormatterResourceTest.java +++ b/src/test/java/org/mitre/bonnie/cqlTranslationServer/FormatterResourceTest.java @@ -3,13 +3,13 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; import org.glassfish.grizzly.http.server.HttpServer; import org.glassfish.jersey.media.multipart.FormDataMultiPart; diff --git a/src/test/java/org/mitre/bonnie/cqlTranslationServer/TranslationResourceTest.java b/src/test/java/org/mitre/bonnie/cqlTranslationServer/TranslationResourceTest.java index 8b298a5..6ed7c70 100644 --- a/src/test/java/org/mitre/bonnie/cqlTranslationServer/TranslationResourceTest.java +++ b/src/test/java/org/mitre/bonnie/cqlTranslationServer/TranslationResourceTest.java @@ -13,17 +13,17 @@ import java.util.Iterator; import java.util.Map; -import javax.json.Json; -import javax.json.JsonArray; -import javax.json.JsonObject; -import javax.json.JsonReader; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; +import jakarta.json.Json; +import jakarta.json.JsonArray; +import jakarta.json.JsonObject; +import jakarta.json.JsonReader; +import jakarta.ws.rs.client.Client; +import jakarta.ws.rs.client.ClientBuilder; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.client.WebTarget; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; import javax.xml.namespace.NamespaceContext; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -216,7 +216,11 @@ public void testValidLibraryAsJson() { JsonArray defs = library.getJsonObject("statements").getJsonArray("def"); assertEquals(2, defs.size()); assertFalse(defs.getJsonObject(1).containsKey("resultTypeName")); - assertFalse(defs.getJsonObject(1).containsKey("annotation")); + // assertFalse(defs.getJsonObject(1).containsKey("annotation")); + // As of translator 3.7.1 the annotation property is present but empty + assertTrue(defs.getJsonObject(1).containsKey("annotation")); + JsonArray subannotations = defs.getJsonObject(1).getJsonArray("annotation"); + assertTrue(subannotations.isEmpty()); } @Test