From e6672fdef49733fd39c93ea9d1d975a4f7bc84c0 Mon Sep 17 00:00:00 2001 From: Ramesh Reddy Date: Tue, 30 Apr 2019 11:35:14 -0500 Subject: [PATCH] OLINGO-1350: Updating fasterxml version 2.9.8 and removing the dependency on aalto-xml library --- .../client/core/edm/xml/ClientCsdlEdmx.java | 2 +- .../server/example/TripPinServiceTest.java | 3 +- lib/server-core/pom.xml | 7 +- .../MetadataDocumentXmlSerializerTest.java | 119 ++++++++++-------- .../xml/ServerErrorXmlSerializerTest.java | 4 +- .../xml/ServiceDocumentXmlSerializerTest.java | 4 +- .../serializer/xml/MetadataDocumentTest.java | 38 +++--- .../xml/ODataXmlSerializerTest.java | 16 +-- pom.xml | 3 +- 9 files changed, 107 insertions(+), 89 deletions(-) diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlEdmx.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlEdmx.java index 9c675b98b..5147a5c3c 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlEdmx.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlEdmx.java @@ -76,7 +76,7 @@ public class ClientCsdlEdmx extends CsdlAbstractEdmItem implements Serializable, final ClientCsdlEdmx edmx = new ClientCsdlEdmx(); - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { + for (; (jp.getCurrentToken() != null && jp.getCurrentToken() != JsonToken.END_OBJECT); jp.nextToken()) { final JsonToken token = jp.getCurrentToken(); if (token == JsonToken.FIELD_NAME) { if ("Version".equals(jp.getCurrentName())) { diff --git a/lib/server-core-ext/src/test/java/org/apache/olingo/server/example/TripPinServiceTest.java b/lib/server-core-ext/src/test/java/org/apache/olingo/server/example/TripPinServiceTest.java index fdc0e4a30..fa32eefa0 100644 --- a/lib/server-core-ext/src/test/java/org/apache/olingo/server/example/TripPinServiceTest.java +++ b/lib/server-core-ext/src/test/java/org/apache/olingo/server/example/TripPinServiceTest.java @@ -125,10 +125,11 @@ public class TripPinServiceTest { "" + "FM" + "Shanghai xxxAirlinexxx" - + "" + + "" + "" + "" +""; + System.out.println(actual); assertTrue(actual.endsWith(expected)); } diff --git a/lib/server-core/pom.xml b/lib/server-core/pom.xml index 4818ca39b..8815b3232 100644 --- a/lib/server-core/pom.xml +++ b/lib/server-core/pom.xml @@ -60,15 +60,10 @@ com.fasterxml.jackson.core jackson-databind - - - com.fasterxml - aalto-xml - - junit junit + test io.netty diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java index b6db975a4..97106772f 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java @@ -118,9 +118,9 @@ public class MetadataDocumentXmlSerializerTest { ServiceMetadata metadata = mock(ServiceMetadata.class); when(metadata.getEdm()).thenReturn(edm); - assertEquals("" + assertEquals("" + "" - + "", + + "", IOUtils.toString(serializer.metadataDocument(metadata).getContent())); } @@ -136,10 +136,10 @@ public class MetadataDocumentXmlSerializerTest { InputStream metadata = serializer.metadataDocument(serviceMetadata).getContent(); assertNotNull(metadata); - assertEquals("" + assertEquals("" + "" + "" - + "" + + "" + "" + "", IOUtils.toString(metadata)); @@ -262,41 +262,44 @@ public class MetadataDocumentXmlSerializerTest { final String metadataString = IOUtils.toString(metadata); // edmx reference assertTrue(metadataString.contains( - "")); + "")); assertTrue(metadataString.contains( "" + - "" + + "" + "")); assertTrue(metadataString.contains( "" + - "" + - "" + + "" + + "" + "")); assertTrue(metadataString.contains( "" + - "" + - "" + + "" + + "" + "")); assertTrue(metadataString.contains( - "" + - "" + - "" + - "" + - "" + - "")); + "" + + "" + + "" + + "" + + "" + + "")); assertTrue(metadataString.contains( "" + - "" + - "" + - "" + - "" + + "" + + "" + + "" + + "" + "" + - "" + + "TargetNamespace=\"TargetNS\">" + + "" + "")); } @@ -306,24 +309,25 @@ public class MetadataDocumentXmlSerializerTest { assertTrue(metadata.contains("")); assertTrue(metadata.contains("")); - assertTrue(metadata.contains("")); - assertTrue(metadata.contains("")); - assertTrue(metadata.contains("")); - assertTrue(metadata.contains("")); - assertTrue(metadata.contains("")); + assertTrue(metadata.contains("")); + assertTrue(metadata.contains("")); + assertTrue(metadata.contains("")); + assertTrue(metadata.contains("")); + assertTrue(metadata.contains("")); + "Function=\"Alias.UFNRTInt16\" IncludeInServiceDocument=\"true\">")); } @Test public void terms() throws Exception { String metadata = localMetadata(); - assertTrue(metadata.contains("")); + assertTrue(metadata.contains("")); assertTrue(metadata .contains("")); - assertTrue(metadata.contains("")); - assertTrue(metadata.contains("")); + + "MaxLength=\"1\" Precision=\"2\" Scale=\"3\">")); + assertTrue(metadata.contains("")); + assertTrue(metadata.contains("")); } @Test @@ -351,44 +355,55 @@ public class MetadataDocumentXmlSerializerTest { // All dynamic expressions // Logical expressions - assertTrue(metadata.contains("truefalse")); - assertTrue(metadata.contains("truefalse")); - assertTrue(metadata.contains("true")); + assertTrue(metadata.contains("truefalse" + + "")); + assertTrue(metadata.contains("truefalse" + + "")); + assertTrue(metadata.contains("true")); // Comparison expressions - assertTrue(metadata.contains("truefalse")); - assertTrue(metadata.contains("truefalse")); - assertTrue(metadata.contains("truefalse")); - assertTrue(metadata.contains("truefalse")); - assertTrue(metadata.contains("truefalse")); - assertTrue(metadata.contains("truefalse")); + assertTrue(metadata.contains("truefalse" + + "")); + assertTrue(metadata.contains("truefalse" + + "")); + assertTrue(metadata.contains("truefalse" + + "")); + assertTrue(metadata.contains("truefalse" + + "")); + assertTrue(metadata.contains("truefalse" + + "")); + assertTrue(metadata.contains("truefalse" + + "")); // Other assertTrue(metadata.contains("AnnoPathValue")); assertTrue(metadata - .contains("true")); + .contains("true" + + "")); assertTrue(metadata .contains("" - + "value")); + + "value")); assertTrue(metadata.contains("true" + "falseString")); assertTrue(metadata .contains("trueThen" - + "Else")); + + "Else")); assertTrue(metadata .contains("" - + "value")); + + "value")); assertTrue(metadata .contains("" - + "value")); + + "value")); assertTrue(metadata.contains("LabeledElementReferenceValue")); assertTrue(metadata.contains("NavigationPropertyPathValue")); assertTrue(metadata.contains("PathValue")); assertTrue(metadata.contains("PropertyPathValue")); assertTrue(metadata .contains("value" - + "")); - assertTrue(metadata.contains("URLRefValue")); + + "" + + "")); + assertTrue(metadata.contains("URLRefValue" + + "")); } @@ -451,8 +466,8 @@ public class MetadataDocumentXmlSerializerTest { InputStream metadataStream = serializer.metadataDocument(serviceMetadata).getContent(); String metadata = IOUtils.toString(metadataStream); assertTrue(metadata.contains("" - + "" - + "" + + "" + + "" + "")); } diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/ServerErrorXmlSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/ServerErrorXmlSerializerTest.java index 63c3b6a04..343026ecd 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/ServerErrorXmlSerializerTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/ServerErrorXmlSerializerTest.java @@ -46,7 +46,7 @@ public class ServerErrorXmlSerializerTest { error.setCode("Code").setMessage("ErrorMessage"); InputStream stream = ser.error(error).getContent(); String jsonString = IOUtils.toString(stream); - assertEquals("" + assertEquals("" + "" + "Code" + "ErrorMessage" @@ -72,7 +72,7 @@ public class ServerErrorXmlSerializerTest { InputStream stream = ser.error(error).getContent(); String jsonString = IOUtils.toString(stream); - assertEquals("" + assertEquals("" + "" + "code" + "err message" diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/ServiceDocumentXmlSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/ServiceDocumentXmlSerializerTest.java index befa441e2..dae3011aa 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/ServiceDocumentXmlSerializerTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/ServiceDocumentXmlSerializerTest.java @@ -63,7 +63,7 @@ public class ServiceDocumentXmlSerializerTest { ServiceMetadata metadata = mock(ServiceMetadata.class); when(metadata.getEdm()).thenReturn(edm); - assertEquals("" + assertEquals("" + " emptyList(), null); InputStream metadataStream = serializer.serviceDocument(serviceMetadata, "http://host/svc").getContent(); String metadata = IOUtils.toString(metadataStream); - assertEquals("" + assertEquals("" + "" - + "" + "")); + + "" + "")); assertThat(metadata, containsString("")); @@ -64,18 +64,20 @@ public class MetadataDocumentTest { assertThat(metadata, containsString("" + "" - + "" - + "" - + "" + + "" + + "" + + "" + + "" + "" + + "Type=\"Collection(Namespace1_Alias.ETAllPrim)\">" + "")); assertThat(metadata, containsString("" - + "" + + "" + "")); + System.out.println(metadata); assertThat(metadata, containsString("" + "" + "" @@ -83,20 +85,20 @@ public class MetadataDocumentTest { assertThat(metadata, containsString("" - + "")); + + "")); assertThat(metadata, containsString("" - + "")); + + "")); assertThat(metadata, containsString("" - + "" + + "" + "")); assertThat(metadata, containsString("" + "" + + "Type=\"Collection(Namespace1_Alias.ETAllPrim)\" Nullable=\"false\">" + "")); assertThat(metadata, @@ -107,8 +109,9 @@ public class MetadataDocumentTest { containsString("" + "" - + "")); + + "Nullable=\"false\">" + + "" + + "")); assertThat(metadata, containsString("")); @@ -123,10 +126,12 @@ public class MetadataDocumentTest { + "")); assertThat(metadata, - containsString("")); + containsString("" + + "")); assertThat(metadata, - containsString("")); + containsString("" + + "")); + containsString("")); assertThat(metadata, - containsString("")); + containsString("" + + "")); } } diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java index 7e1a963d1..2f977d1c5 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java @@ -437,7 +437,7 @@ public class ODataXmlSerializerTest { .count(countOption) .build()).getContent(); final String resultString = IOUtils.toString(result); - String prefix = "" + String prefix = "" + "" + "http://host/svc/ESCompAllPrim" + "4" - + "" + + "" + "" - + "ESCompAllPrim(32767)"; + + "ESCompAllPrim(32767)"; Assert.assertTrue(resultString.startsWith(prefix)); } @@ -2643,7 +2643,7 @@ public class ODataXmlSerializerTest { .build()) .build()).getContent()); - String expected = "" + String expected = "" + "" @@ -2667,7 +2667,7 @@ public class ODataXmlSerializerTest { .unicode(Boolean.TRUE) .build()).getContent()); - String expected = "" + String expected = "" + "" @@ -2687,11 +2687,11 @@ public class ODataXmlSerializerTest { .entitySet(edmEntitySet).keyPath("4242").navOrPropertyPath(edmProperty.getName()) .build()) .build()).getContent()); - String expected = "" + String expected = "" + ""; + + "m:null=\"true\">"; Assert.assertEquals(expected, response); } @@ -3319,7 +3319,7 @@ public class ODataXmlSerializerTest { .navOrPropertyPath("CollPropertyComp") .build()).select(selectOption) .build()).getContent()); - final String expectedResult = "" + final String expectedResult = "" + "2.5.3 4.2.6 4.2.5 - 2.7.8 + 2.9.8 0.9.10 4.1.1.4 @@ -580,6 +580,7 @@ **/ref/** **/server-ref/** **/dependency-reduced-pom.xml + **/.settings/**