http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java index 9721384..5d27aaf 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,14 +18,14 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; -import org.apache.olingo.commons.api.edm.EdmPrimitiveType; -import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.math.BigInteger; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import org.apache.olingo.commons.api.edm.EdmPrimitiveType; +import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; +import org.junit.Test; public class EdmSByteTest extends PrimitiveTypeBaseTest {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java index 1e400c2..5d34496 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,15 +18,15 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; -import org.apache.olingo.commons.api.edm.EdmPrimitiveType; -import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.math.BigDecimal; import java.math.BigInteger; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import org.apache.olingo.commons.api.edm.EdmPrimitiveType; +import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; +import org.junit.Test; public class EdmSingleTest extends PrimitiveTypeBaseTest { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java index 5aa95d8..b5f2a89 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,12 +18,12 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; +import static org.junit.Assert.assertEquals; + import org.apache.olingo.commons.api.edm.EdmPrimitiveType; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class EdmStringTest extends PrimitiveTypeBaseTest { private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java index 917814d..bdd45a2 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,14 +18,14 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; -import org.apache.olingo.commons.api.edm.EdmPrimitiveType; -import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; -import org.junit.Test; +import static org.junit.Assert.assertEquals; import java.util.Calendar; import java.util.TimeZone; -import static org.junit.Assert.assertEquals; +import org.apache.olingo.commons.api.edm.EdmPrimitiveType; +import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; +import org.junit.Test; public class EdmTimeOfDayTest extends PrimitiveTypeBaseTest { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/PrimitiveTypeBaseTest.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/PrimitiveTypeBaseTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/PrimitiveTypeBaseTest.java index e4a75a6..7022f73 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/PrimitiveTypeBaseTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/PrimitiveTypeBaseTest.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java index d95699d..42b473f 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,12 +18,12 @@ */ package org.apache.olingo.commons.core.edm.primitivetype; -import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; -import org.junit.Test; - import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; +import org.junit.Test; + public class UInt7Test extends PrimitiveTypeBaseTest { @Test http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/AtomDeserializerTest.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/AtomDeserializerTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/AtomDeserializerTest.java index 2c5087b..c1226b2 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/AtomDeserializerTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/AtomDeserializerTest.java @@ -6,9 +6,9 @@ * to you 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 @@ -34,292 +34,292 @@ public class AtomDeserializerTest { @Test public void emptyInlineEntityOlingo540() throws Exception { - final String content = "" + + final String content = "" + "<entry xmlns=\"http://www.w3.org/2005/Atom\" " - + "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" " - + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" " + + "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" " + + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" " + "xmlns:georss=\"http://www.georss.org/georss\" xmlns:gml=\"http://www.opengis.net/gml\" " - + "xml:base=\"http://services.odata.org/V3/OData/OData.svc/\">\r\n" + - " <id>http://services.odata.org/V3/OData/OData.svc/Products(3)</id>\r\n" + + + "xml:base=\"http://services.odata.org/V3/OData/OData.svc/\">\r\n" + + " <id>http://services.odata.org/V3/OData/OData.svc/Products(3)</id>\r\n" + " <category term=\"ODataDemo.Product\" " - + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" + - " \r\n" + - " <link rel=\"edit\" title=\"Product\" href=\"Products\" />\r\n" + + + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" + + " \r\n" + + " <link rel=\"edit\" title=\"Product\" href=\"Products\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Categories\" " - + "type=\"application/atom+xml;type=feed\" title=\"Categories\" href=\"Products(3)/Categories\" />\r\n" + + + "type=\"application/atom+xml;type=feed\" title=\"Categories\" href=\"Products(3)/Categories\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Supplier\" " - + "type=\"application/atom+xml;type=entry\" title=\"Supplier\" href=\"Products(3)/Supplier\">\r\n" + - " <metadata:inline>\r\n" + - " </metadata:inline>\r\n" + - " </link>\r\n" + + + "type=\"application/atom+xml;type=entry\" title=\"Supplier\" href=\"Products(3)/Supplier\">\r\n" + + " <metadata:inline>\r\n" + + " </metadata:inline>\r\n" + + " </link>\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/related/ProductDetail\"" + " type=\"application/atom+xml;type=entry\" title=\"ProductDetail\" " - + "href=\"Products(3)/ProductDetail\" />\r\n" + - " <title type=\"text\">Havina Cola</title>\r\n" + - " <summary type=\"text\">The Original Key Lime Cola</summary>\r\n" + - " <updated>2015-01-26T08:57:02Z</updated>\r\n" + - " <author>\r\n" + - " <name />\r\n" + - " </author>\r\n" + + + "href=\"Products(3)/ProductDetail\" />\r\n" + + " <title type=\"text\">Havina Cola</title>\r\n" + + " <summary type=\"text\">The Original Key Lime Cola</summary>\r\n" + + " <updated>2015-01-26T08:57:02Z</updated>\r\n" + + " <author>\r\n" + + " <name />\r\n" + + " </author>\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Categories\" " - + "type=\"application/xml\" title=\"Categories\" href=\"Products(3)/$links/Categories\" />\r\n" + + + "type=\"application/xml\" title=\"Categories\" href=\"Products(3)/$links/Categories\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Supplier\" " - + "type=\"application/xml\" title=\"Supplier\" href=\"Products(3)/$links/Supplier\" />\r\n" + + + "type=\"application/xml\" title=\"Supplier\" href=\"Products(3)/$links/Supplier\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/ProductDetail\"" - + " type=\"application/xml\" title=\"ProductDetail\" href=\"Products(3)/$links/ProductDetail\" />\r\n" + - " <content type=\"application/xml\">\r\n" + - " <metadata:properties>\r\n" + - " <data:ID metadata:type=\"Edm.Int32\">3</data:ID>\r\n" + - " <data:ReleaseDate metadata:type=\"Edm.DateTime\">2005-10-01T00:00:00</data:ReleaseDate>\r\n" + - " <data:DiscontinuedDate metadata:type=\"Edm.DateTime\">2006-10-01T00:00:00</data:DiscontinuedDate>\r\n" + - " <data:Rating metadata:type=\"Edm.Int16\">3</data:Rating>\r\n" + - " <data:Price metadata:type=\"Edm.Double\">19.9</data:Price>\r\n" + - " </metadata:properties>\r\n" + - " </content>\r\n" + + + " type=\"application/xml\" title=\"ProductDetail\" href=\"Products(3)/$links/ProductDetail\" />\r\n" + + " <content type=\"application/xml\">\r\n" + + " <metadata:properties>\r\n" + + " <data:ID metadata:type=\"Edm.Int32\">3</data:ID>\r\n" + + " <data:ReleaseDate metadata:type=\"Edm.DateTime\">2005-10-01T00:00:00</data:ReleaseDate>\r\n" + + " <data:DiscontinuedDate metadata:type=\"Edm.DateTime\">2006-10-01T00:00:00</data:DiscontinuedDate>\r\n" + + " <data:Rating metadata:type=\"Edm.Int16\">3</data:Rating>\r\n" + + " <data:Price metadata:type=\"Edm.Double\">19.9</data:Price>\r\n" + + " </metadata:properties>\r\n" + + " </content>\r\n" + " </entry>"; final AtomDeserializer deserializer = new AtomDeserializer(); final InputStream in = new ByteArrayInputStream(content.getBytes("UTF-8")); final ResWrap<Entity> entity = deserializer.toEntity(in); - + assertNotNull(entity); assertNull(entity.getPayload().getNavigationLink("Supplier").getInlineEntitySet()); } - + @Test public void filledInlineEntity() throws Exception { - final String content = "" + + final String content = "" + "<entry xmlns=\"http://www.w3.org/2005/Atom\" " + "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" " + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" " + "xmlns:georss=\"http://www.georss.org/georss\" " + "xmlns:gml=\"http://www.opengis.net/gml\" " - + "xml:base=\"http://services.odata.org/V4/OData/OData.svc/\">\r\n" + - " <id>http://services.odata.org/V4/OData/OData.svc/Products(3)</id>\r\n" + + + "xml:base=\"http://services.odata.org/V4/OData/OData.svc/\">\r\n" + + " <id>http://services.odata.org/V4/OData/OData.svc/Products(3)</id>\r\n" + " <category term=\"#ODataDemo.Product\" " - + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" + - " \r\n" + - " <link rel=\"edit\" title=\"Product\" href=\"Products\" />\r\n" + + + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" + + " \r\n" + + " <link rel=\"edit\" title=\"Product\" href=\"Products\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Categories\" " - + "type=\"application/atom+xml;type=feed\" title=\"Categories\" href=\"Products(3)/Categories\" />\r\n" + + + "type=\"application/atom+xml;type=feed\" title=\"Categories\" href=\"Products(3)/Categories\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Supplier\" " - + "type=\"application/atom+xml;type=entry\" title=\"Supplier\" href=\"Products(3)/Supplier\">\r\n" + - " <metadata:inline>\r\n" + - " <entry>\r\n" + - " <id>http://services.odata.org/V4/OData/OData.svc/Suppliers(0)</id>\r\n" + + + "type=\"application/atom+xml;type=entry\" title=\"Supplier\" href=\"Products(3)/Supplier\">\r\n" + + " <metadata:inline>\r\n" + + " <entry>\r\n" + + " <id>http://services.odata.org/V4/OData/OData.svc/Suppliers(0)</id>\r\n" + " <category term=\"ODataDemo.Supplier\" " - + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" + - " <link rel=\"edit\" title=\"Supplier\" href=\"Suppliers(0)\" />\r\n" + + + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" + + " <link rel=\"edit\" title=\"Supplier\" href=\"Suppliers(0)\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Products\" " - + "type=\"application/atom+xml;type=feed\" title=\"Products\" href=\"Suppliers(0)/Products\" />\r\n" + - " <title type=\"text\">Exotic Liquids</title>\r\n" + - " <updated>2015-01-26T08:57:02Z</updated>\r\n" + - " <author>\r\n" + - " <name />\r\n" + - " </author>\r\n" + + + "type=\"application/atom+xml;type=feed\" title=\"Products\" href=\"Suppliers(0)/Products\" />\r\n" + + " <title type=\"text\">Exotic Liquids</title>\r\n" + + " <updated>2015-01-26T08:57:02Z</updated>\r\n" + + " <author>\r\n" + + " <name />\r\n" + + " </author>\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Products\" " - + "type=\"application/xml\" title=\"Products\" href=\"Suppliers(0)/$links/Products\" />\r\n" + - " <content type=\"application/xml\">\r\n" + - " <metadata:properties>\r\n" + - " <data:ID metadata:type=\"Edm.Int32\">0</data:ID>\r\n" + - " <data:Name>Exotic Liquids</data:Name>\r\n" + - " <data:Address metadata:type=\"ODataDemo.Address\">\r\n" + - " <data:Street>NE 228th</data:Street>\r\n" + - " <data:City>Sammamish</data:City>\r\n" + - " <data:State>WA</data:State>\r\n" + - " <data:ZipCode>98074</data:ZipCode>\r\n" + - " <data:Country>USA</data:Country>\r\n" + - " </data:Address>\r\n" + - " <data:Location metadata:type=\"Edm.GeographyPoint\">\r\n" + - " <gml:Point gml:srsName=\"http://www.opengis.net/def/crs/EPSG/0/4326\">\r\n" + - " <gml:pos>47.6316604614258 -122.03547668457</gml:pos>\r\n" + - " </gml:Point>\r\n" + - " </data:Location>\r\n" + - " <data:Concurrency metadata:type=\"Edm.Int32\">0</data:Concurrency>\r\n" + - " </metadata:properties>\r\n" + - " </content>\r\n" + - " </entry>" + - " </metadata:inline>\r\n" + - " </link>\r\n" + + + "type=\"application/xml\" title=\"Products\" href=\"Suppliers(0)/$links/Products\" />\r\n" + + " <content type=\"application/xml\">\r\n" + + " <metadata:properties>\r\n" + + " <data:ID metadata:type=\"Edm.Int32\">0</data:ID>\r\n" + + " <data:Name>Exotic Liquids</data:Name>\r\n" + + " <data:Address metadata:type=\"ODataDemo.Address\">\r\n" + + " <data:Street>NE 228th</data:Street>\r\n" + + " <data:City>Sammamish</data:City>\r\n" + + " <data:State>WA</data:State>\r\n" + + " <data:ZipCode>98074</data:ZipCode>\r\n" + + " <data:Country>USA</data:Country>\r\n" + + " </data:Address>\r\n" + + " <data:Location metadata:type=\"Edm.GeographyPoint\">\r\n" + + " <gml:Point gml:srsName=\"http://www.opengis.net/def/crs/EPSG/0/4326\">\r\n" + + " <gml:pos>47.6316604614258 -122.03547668457</gml:pos>\r\n" + + " </gml:Point>\r\n" + + " </data:Location>\r\n" + + " <data:Concurrency metadata:type=\"Edm.Int32\">0</data:Concurrency>\r\n" + + " </metadata:properties>\r\n" + + " </content>\r\n" + + " </entry>" + + " </metadata:inline>\r\n" + + " </link>\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/related/ProductDetail\" " + "type=\"application/atom+xml;type=entry\" " - + "title=\"ProductDetail\" href=\"Products(3)/ProductDetail\" />\r\n" + - " <title type=\"text\">Havina Cola</title>\r\n" + - " <summary type=\"text\">The Original Key Lime Cola</summary>\r\n" + - " <updated>2015-01-26T08:57:02Z</updated>\r\n" + - " <author>\r\n" + - " <name />\r\n" + - " </author>\r\n" + + + "title=\"ProductDetail\" href=\"Products(3)/ProductDetail\" />\r\n" + + " <title type=\"text\">Havina Cola</title>\r\n" + + " <summary type=\"text\">The Original Key Lime Cola</summary>\r\n" + + " <updated>2015-01-26T08:57:02Z</updated>\r\n" + + " <author>\r\n" + + " <name />\r\n" + + " </author>\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Categories\" " - + "type=\"application/xml\" title=\"Categories\" href=\"Products(3)/$links/Categories\" />\r\n" + + + "type=\"application/xml\" title=\"Categories\" href=\"Products(3)/$links/Categories\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Supplier\" " - + "type=\"application/xml\" title=\"Supplier\" href=\"Products(3)/$links/Supplier\" />\r\n" + + + "type=\"application/xml\" title=\"Supplier\" href=\"Products(3)/$links/Supplier\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/ProductDetail\" " - + "type=\"application/xml\" title=\"ProductDetail\" href=\"Products(3)/$links/ProductDetail\" />\r\n" + - " <content type=\"application/xml\">\r\n" + - " <metadata:properties>\r\n" + - " <data:ID metadata:type=\"Edm.Int32\">3</data:ID>\r\n" + - " <data:ReleaseDate metadata:type=\"Edm.DateTime\">2005-10-01T00:00:00</data:ReleaseDate>\r\n" + - " <data:DiscontinuedDate metadata:type=\"Edm.DateTime\">2006-10-01T00:00:00</data:DiscontinuedDate>\r\n" + - " <data:Rating metadata:type=\"Edm.Int16\">3</data:Rating>\r\n" + - " <data:Price metadata:type=\"Edm.Double\">19.9</data:Price>\r\n" + - " </metadata:properties>\r\n" + - " </content>\r\n" + + + "type=\"application/xml\" title=\"ProductDetail\" href=\"Products(3)/$links/ProductDetail\" />\r\n" + + " <content type=\"application/xml\">\r\n" + + " <metadata:properties>\r\n" + + " <data:ID metadata:type=\"Edm.Int32\">3</data:ID>\r\n" + + " <data:ReleaseDate metadata:type=\"Edm.DateTime\">2005-10-01T00:00:00</data:ReleaseDate>\r\n" + + " <data:DiscontinuedDate metadata:type=\"Edm.DateTime\">2006-10-01T00:00:00</data:DiscontinuedDate>\r\n" + + " <data:Rating metadata:type=\"Edm.Int16\">3</data:Rating>\r\n" + + " <data:Price metadata:type=\"Edm.Double\">19.9</data:Price>\r\n" + + " </metadata:properties>\r\n" + + " </content>\r\n" + " </entry>"; final AtomDeserializer deserializer = new AtomDeserializer(); final InputStream in = new ByteArrayInputStream(content.getBytes("UTF-8")); final ResWrap<Entity> entity = deserializer.toEntity(in); - + assertNotNull(entity); final Entity inlineEntity = entity.getPayload().getNavigationLink("Supplier").getInlineEntity(); assertNotNull(inlineEntity); - + assertEquals(new Integer(0), inlineEntity.getProperty("ID").getValue()); assertEquals("Exotic Liquids", inlineEntity.getProperty("Name").getValue()); } - + @Test public void emptyInlineEntityCollection() throws Exception { - final String content = "" + + final String content = "" + "<entry xmlns=\"http://www.w3.org/2005/Atom\" " + "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" " + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" " + "xmlns:georss=\"http://www.georss.org/georss\" xmlns:gml=\"http://www.opengis.net/gml\" " - + "xml:base=\"http://services.odata.org/V3/OData/OData.svc/\">\r\n" + - " <id>http://services.odata.org/V3/OData/OData.svc/Products(3)</id>\r\n" + + + "xml:base=\"http://services.odata.org/V3/OData/OData.svc/\">\r\n" + + " <id>http://services.odata.org/V3/OData/OData.svc/Products(3)</id>\r\n" + " <category term=\"ODataDemo.Product\" " - + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" + - " \r\n" + - " <link rel=\"edit\" title=\"Product\" href=\"Products(3)\" />\r\n" + + + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" + + " \r\n" + + " <link rel=\"edit\" title=\"Product\" href=\"Products(3)\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Categories\" " - + "type=\"application/atom+xml;type=feed\" title=\"Categories\" href=\"Products(3)/Categories\" />\r\n" + + + "type=\"application/atom+xml;type=feed\" title=\"Categories\" href=\"Products(3)/Categories\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Supplier\" " - + "type=\"application/atom+xml;type=feed\" title=\"Supplier\" href=\"Products(3)/Supplier\">\r\n" + - " <metadata:inline>\r\n" + - " <feed>\r\n" + - " </feed>\r\n" + - " </metadata:inline>\r\n" + - " </link>\r\n" + + + "type=\"application/atom+xml;type=feed\" title=\"Supplier\" href=\"Products(3)/Supplier\">\r\n" + + " <metadata:inline>\r\n" + + " <feed>\r\n" + + " </feed>\r\n" + + " </metadata:inline>\r\n" + + " </link>\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/related/ProductDetail\" " + "type=\"application/atom+xml;type=entry\" " - + "title=\"ProductDetail\" href=\"Products(3)/ProductDetail\" />\r\n" + - " <title type=\"text\">Havina Cola</title>\r\n" + - " <summary type=\"text\">The Original Key Lime Cola</summary>\r\n" + - " <updated>2015-01-26T08:57:02Z</updated>\r\n" + - " <author>\r\n" + - " <name />\r\n" + - " </author>\r\n" + + + "title=\"ProductDetail\" href=\"Products(3)/ProductDetail\" />\r\n" + + " <title type=\"text\">Havina Cola</title>\r\n" + + " <summary type=\"text\">The Original Key Lime Cola</summary>\r\n" + + " <updated>2015-01-26T08:57:02Z</updated>\r\n" + + " <author>\r\n" + + " <name />\r\n" + + " </author>\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Categories\" " - + "type=\"application/xml\" title=\"Categories\" href=\"Products(3)/$links/Categories\" />\r\n" + + + "type=\"application/xml\" title=\"Categories\" href=\"Products(3)/$links/Categories\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Supplier\" " - + "type=\"application/xml\" title=\"Supplier\" href=\"Products(3)/$links/Supplier\" />\r\n" + + + "type=\"application/xml\" title=\"Supplier\" href=\"Products(3)/$links/Supplier\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/ProductDetail\" " - + "type=\"application/xml\" title=\"ProductDetail\" href=\"Products(3)/$links/ProductDetail\" />\r\n" + - " <content type=\"application/xml\">\r\n" + - " <metadata:properties>\r\n" + - " <data:ID metadata:type=\"Edm.Int32\">3</data:ID>\r\n" + - " <data:ReleaseDate metadata:type=\"Edm.DateTime\">2005-10-01T00:00:00</data:ReleaseDate>\r\n" + - " <data:DiscontinuedDate metadata:type=\"Edm.DateTime\">2006-10-01T00:00:00</data:DiscontinuedDate>\r\n" + - " <data:Rating metadata:type=\"Edm.Int16\">3</data:Rating>\r\n" + - " <data:Price metadata:type=\"Edm.Double\">19.9</data:Price>\r\n" + - " </metadata:properties>\r\n" + - " </content>\r\n" + + + "type=\"application/xml\" title=\"ProductDetail\" href=\"Products(3)/$links/ProductDetail\" />\r\n" + + " <content type=\"application/xml\">\r\n" + + " <metadata:properties>\r\n" + + " <data:ID metadata:type=\"Edm.Int32\">3</data:ID>\r\n" + + " <data:ReleaseDate metadata:type=\"Edm.DateTime\">2005-10-01T00:00:00</data:ReleaseDate>\r\n" + + " <data:DiscontinuedDate metadata:type=\"Edm.DateTime\">2006-10-01T00:00:00</data:DiscontinuedDate>\r\n" + + " <data:Rating metadata:type=\"Edm.Int16\">3</data:Rating>\r\n" + + " <data:Price metadata:type=\"Edm.Double\">19.9</data:Price>\r\n" + + " </metadata:properties>\r\n" + + " </content>\r\n" + " </entry>"; final AtomDeserializer deserializer = new AtomDeserializer(); final InputStream in = new ByteArrayInputStream(content.getBytes("UTF-8")); final ResWrap<Entity> entity = deserializer.toEntity(in); - + assertNotNull(entity); final EntityCollection inlineEntitySet = entity.getPayload().getNavigationLink("Supplier").getInlineEntitySet(); assertNotNull(inlineEntitySet); assertEquals(0, inlineEntitySet.getEntities().size()); } - + @Test public void filledInlineEntityCollection() throws Exception { - final String content = "" + + final String content = "" + "<entry xmlns=\"http://www.w3.org/2005/Atom\" " + "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" " + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" " + "xmlns:georss=\"http://www.georss.org/georss\" xmlns:gml=\"http://www.opengis.net/gml\" " - + "xml:base=\"http://services.odata.org/V3/OData/OData.svc/\">\r\n" + - " <id>http://services.odata.org/V3/OData/OData.svc/Products(3)</id>\r\n" + + + "xml:base=\"http://services.odata.org/V3/OData/OData.svc/\">\r\n" + + " <id>http://services.odata.org/V3/OData/OData.svc/Products(3)</id>\r\n" + " <category term=\"ODataDemo.Product\" " - + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" + - " \r\n" + - " <link rel=\"edit\" title=\"Product\" href=\"Products(3)\" />\r\n" + + + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" + + " \r\n" + + " <link rel=\"edit\" title=\"Product\" href=\"Products(3)\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Categories\" " - + "type=\"application/atom+xml;type=feed\" title=\"Categories\" href=\"Products(3)/Categories\" />\r\n" + + + "type=\"application/atom+xml;type=feed\" title=\"Categories\" href=\"Products(3)/Categories\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Supplier\" " - + "type=\"application/atom+xml;type=feed\" title=\"Supplier\" href=\"Products(3)/Supplier\">\r\n" + - " <metadata:inline>\r\n" + - " <feed>\r\n" + - " <entry>\r\n" + - " <id>http://services.odata.org/V3/OData/OData.svc/Suppliers(0)</id>\r\n" + + + "type=\"application/atom+xml;type=feed\" title=\"Supplier\" href=\"Products(3)/Supplier\">\r\n" + + " <metadata:inline>\r\n" + + " <feed>\r\n" + + " <entry>\r\n" + + " <id>http://services.odata.org/V3/OData/OData.svc/Suppliers(0)</id>\r\n" + " <category term=\"ODataDemo.Supplier\" " - + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" + - " <link rel=\"edit\" title=\"Supplier\" href=\"Suppliers(0)\" />\r\n" + + + "scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" />\r\n" + + " <link rel=\"edit\" title=\"Supplier\" href=\"Suppliers(0)\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/related/Products\" " - + "type=\"application/atom+xml;type=feed\" title=\"Products\" href=\"Suppliers(0)/Products\" />\r\n" + - " <title type=\"text\">Exotic Liquids</title>\r\n" + - " <updated>2015-01-26T08:57:02Z</updated>\r\n" + - " <author>\r\n" + - " <name />\r\n" + - " </author>\r\n" + + + "type=\"application/atom+xml;type=feed\" title=\"Products\" href=\"Suppliers(0)/Products\" />\r\n" + + " <title type=\"text\">Exotic Liquids</title>\r\n" + + " <updated>2015-01-26T08:57:02Z</updated>\r\n" + + " <author>\r\n" + + " <name />\r\n" + + " </author>\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Products\" " - + "type=\"application/xml\" title=\"Products\" href=\"Suppliers(0)/$links/Products\" />\r\n" + - " <content type=\"application/xml\">\r\n" + - " <metadata:properties>\r\n" + - " <data:ID metadata:type=\"Edm.Int32\">0</data:ID>\r\n" + - " <data:Name>Exotic Liquids</data:Name>\r\n" + - " <data:Address metadata:type=\"ODataDemo.Address\">\r\n" + - " <data:Street>NE 228th</data:Street>\r\n" + - " <data:City>Sammamish</data:City>\r\n" + - " <data:State>WA</data:State>\r\n" + - " <data:ZipCode>98074</data:ZipCode>\r\n" + - " <data:Country>USA</data:Country>\r\n" + - " </data:Address>\r\n" + - " <data:Location metadata:type=\"Edm.GeographyPoint\">\r\n" + - " <gml:Point gml:srsName=\"http://www.opengis.net/def/crs/EPSG/0/4326\">\r\n" + - " <gml:pos>47.6316604614258 -122.03547668457</gml:pos>\r\n" + - " </gml:Point>\r\n" + - " </data:Location>\r\n" + - " <data:Concurrency metadata:type=\"Edm.Int32\">0</data:Concurrency>\r\n" + - " </metadata:properties>\r\n" + - " </content>\r\n" + + + "type=\"application/xml\" title=\"Products\" href=\"Suppliers(0)/$links/Products\" />\r\n" + + " <content type=\"application/xml\">\r\n" + + " <metadata:properties>\r\n" + + " <data:ID metadata:type=\"Edm.Int32\">0</data:ID>\r\n" + + " <data:Name>Exotic Liquids</data:Name>\r\n" + + " <data:Address metadata:type=\"ODataDemo.Address\">\r\n" + + " <data:Street>NE 228th</data:Street>\r\n" + + " <data:City>Sammamish</data:City>\r\n" + + " <data:State>WA</data:State>\r\n" + + " <data:ZipCode>98074</data:ZipCode>\r\n" + + " <data:Country>USA</data:Country>\r\n" + + " </data:Address>\r\n" + + " <data:Location metadata:type=\"Edm.GeographyPoint\">\r\n" + + " <gml:Point gml:srsName=\"http://www.opengis.net/def/crs/EPSG/0/4326\">\r\n" + + " <gml:pos>47.6316604614258 -122.03547668457</gml:pos>\r\n" + + " </gml:Point>\r\n" + + " </data:Location>\r\n" + + " <data:Concurrency metadata:type=\"Edm.Int32\">0</data:Concurrency>\r\n" + + " </metadata:properties>\r\n" + + " </content>\r\n" + " </entry>\r\n" + - " </feed>\r\n" + - " </metadata:inline>\r\n" + - " </link>\r\n" + + " </feed>\r\n" + + " </metadata:inline>\r\n" + + " </link>\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/related/ProductDetail\" " + "type=\"application/atom+xml;type=entry\" " - + "title=\"ProductDetail\" href=\"Products(3)/ProductDetail\" />\r\n" + - " <title type=\"text\">Havina Cola</title>\r\n" + - " <summary type=\"text\">The Original Key Lime Cola</summary>\r\n" + - " <updated>2015-01-26T08:57:02Z</updated>\r\n" + - " <author>\r\n" + - " <name />\r\n" + - " </author>\r\n" + + + "title=\"ProductDetail\" href=\"Products(3)/ProductDetail\" />\r\n" + + " <title type=\"text\">Havina Cola</title>\r\n" + + " <summary type=\"text\">The Original Key Lime Cola</summary>\r\n" + + " <updated>2015-01-26T08:57:02Z</updated>\r\n" + + " <author>\r\n" + + " <name />\r\n" + + " </author>\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Categories\" " - + "type=\"application/xml\" title=\"Categories\" href=\"Products(3)/$links/Categories\" />\r\n" + + + "type=\"application/xml\" title=\"Categories\" href=\"Products(3)/$links/Categories\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/Supplier\" " - + "type=\"application/xml\" title=\"Supplier\" href=\"Products(3)/$links/Supplier\" />\r\n" + + + "type=\"application/xml\" title=\"Supplier\" href=\"Products(3)/$links/Supplier\" />\r\n" + " <link rel=\"http://docs.oasis-open.org/odata/ns/relatedlinks/ProductDetail\" " - + "type=\"application/xml\" title=\"ProductDetail\" href=\"Products(3)/$links/ProductDetail\" />\r\n" + - " <content type=\"application/xml\">\r\n" + - " <metadata:properties>\r\n" + - " <data:ID metadata:type=\"Edm.Int32\">3</data:ID>\r\n" + - " <data:ReleaseDate metadata:type=\"Edm.DateTime\">2005-10-01T00:00:00</data:ReleaseDate>\r\n" + - " <data:DiscontinuedDate metadata:type=\"Edm.DateTime\">2006-10-01T00:00:00</data:DiscontinuedDate>\r\n" + - " <data:Rating metadata:type=\"Edm.Int16\">3</data:Rating>\r\n" + - " <data:Price metadata:type=\"Edm.Double\">19.9</data:Price>\r\n" + - " </metadata:properties>\r\n" + - " </content>\r\n" + + + "type=\"application/xml\" title=\"ProductDetail\" href=\"Products(3)/$links/ProductDetail\" />\r\n" + + " <content type=\"application/xml\">\r\n" + + " <metadata:properties>\r\n" + + " <data:ID metadata:type=\"Edm.Int32\">3</data:ID>\r\n" + + " <data:ReleaseDate metadata:type=\"Edm.DateTime\">2005-10-01T00:00:00</data:ReleaseDate>\r\n" + + " <data:DiscontinuedDate metadata:type=\"Edm.DateTime\">2006-10-01T00:00:00</data:DiscontinuedDate>\r\n" + + " <data:Rating metadata:type=\"Edm.Int16\">3</data:Rating>\r\n" + + " <data:Price metadata:type=\"Edm.Double\">19.9</data:Price>\r\n" + + " </metadata:properties>\r\n" + + " </content>\r\n" + " </entry>"; final AtomDeserializer deserializer = new AtomDeserializer(); final InputStream in = new ByteArrayInputStream(content.getBytes("UTF-8")); final ResWrap<Entity> entity = deserializer.toEntity(in); - + assertNotNull(entity); final EntityCollection inlineEntitySet = entity.getPayload().getNavigationLink("Supplier").getInlineEntitySet(); assertNotNull(inlineEntitySet); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/ContextURLParserTest.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/ContextURLParserTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/ContextURLParserTest.java index 1375ab2..7c401e1 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/ContextURLParserTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/ContextURLParserTest.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,16 +18,16 @@ */ package org.apache.olingo.commons.core.serialization; -import org.apache.olingo.commons.api.data.ContextURL; -import org.junit.Test; - -import java.net.URI; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import java.net.URI; + +import org.apache.olingo.commons.api.data.ContextURL; +import org.junit.Test; + public class ContextURLParserTest { @Test @@ -74,7 +74,7 @@ public class ContextURLParserTest { assertTrue(contextURL.isEntity()); contextURL = ContextURLParser.parse( - URI.create("http://host/service/$metadata#Users('user')/Messages('message')/Attachments/$entity")); + URI.create("http://host/service/$metadata#Users('user')/Messages('message')/Attachments/$entity")); assertEquals("Users/Messages/Attachments", contextURL.getEntitySetOrSingletonOrType()); assertNull(contextURL.getDerivedEntity()); @@ -106,7 +106,7 @@ public class ContextURLParserTest { @Test public void collectionOfDerivedEntities() { final ContextURL contextURL = ContextURLParser.parse( - URI.create("http://host/service/$metadata#Customers/Model.VipCustomer")); + URI.create("http://host/service/$metadata#Customers/Model.VipCustomer")); assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType()); assertEquals("Model.VipCustomer", contextURL.getDerivedEntity()); @@ -118,7 +118,7 @@ public class ContextURLParserTest { @Test public void derivedEntity() { final ContextURL contextURL = ContextURLParser.parse( - URI.create("http://host/service/$metadata#Customers/Model.VipCustomer/$entity")); + URI.create("http://host/service/$metadata#Customers/Model.VipCustomer/$entity")); assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType()); assertEquals("Model.VipCustomer", contextURL.getDerivedEntity()); @@ -130,7 +130,7 @@ public class ContextURLParserTest { @Test public void collectionOfProjectedEntities() { final ContextURL contextURL = ContextURLParser.parse( - URI.create("http://host/service/$metadata#Customers(Address,Orders)")); + URI.create("http://host/service/$metadata#Customers(Address,Orders)")); assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType()); assertNull(contextURL.getDerivedEntity()); @@ -142,7 +142,7 @@ public class ContextURLParserTest { @Test public void projectedEntity() { ContextURL contextURL = ContextURLParser.parse( - URI.create("http://host/service/$metadata#Customers(Name,Rating)/$entity")); + URI.create("http://host/service/$metadata#Customers(Name,Rating)/$entity")); assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType()); assertNull(contextURL.getDerivedEntity()); @@ -151,7 +151,7 @@ public class ContextURLParserTest { assertTrue(contextURL.isEntity()); contextURL = ContextURLParser.parse( - URI.create("http://host/service/$metadata#Customers(Name,Address/Country)")); + URI.create("http://host/service/$metadata#Customers(Name,Address/Country)")); assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType()); assertNull(contextURL.getDerivedEntity()); @@ -163,8 +163,8 @@ public class ContextURLParserTest { @Test public void collectionOfProjectedExpandedEntities() { final ContextURL contextURL = ContextURLParser.parse( - URI.create("http://host/service/$metadata#Employees/" - + "Sales.Manager(DirectReports,DirectReports+(FirstName,LastName))")); + URI.create("http://host/service/$metadata#Employees/" + + "Sales.Manager(DirectReports,DirectReports+(FirstName,LastName))")); assertEquals("Employees", contextURL.getEntitySetOrSingletonOrType()); assertEquals("Sales.Manager", contextURL.getDerivedEntity()); @@ -176,7 +176,7 @@ public class ContextURLParserTest { @Test public void propertyValue() { final ContextURL contextURL = ContextURLParser.parse( - URI.create("http://host/service/$metadata#Customers(1)/Addresses")); + URI.create("http://host/service/$metadata#Customers(1)/Addresses")); assertEquals("Customers", contextURL.getEntitySetOrSingletonOrType()); assertNull(contextURL.getDerivedEntity()); @@ -188,7 +188,7 @@ public class ContextURLParserTest { @Test public void CollectionOfComplexOrPrimitiveTypes() { final ContextURL contextURL = ContextURLParser.parse( - URI.create("http://host/service/$metadata#Collection(Edm.String)")); + URI.create("http://host/service/$metadata#Collection(Edm.String)")); assertEquals("Collection(Edm.String)", contextURL.getEntitySetOrSingletonOrType()); assertNull(contextURL.getDerivedEntity()); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-api/src/main/java/org/apache/olingo/server/api/ClientServerError.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ClientServerError.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ClientServerError.java index af91875..8af0ec7 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ClientServerError.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ClientServerError.java @@ -6,9 +6,9 @@ * to you 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 @@ -46,7 +46,7 @@ public class ClientServerError extends ODataError { * Sets the locale. * @return this for method chaining */ - public ClientServerError setLocale(Locale locale) { + public ClientServerError setLocale(final Locale locale) { this.locale = locale; return this; } @@ -63,7 +63,7 @@ public class ClientServerError extends ODataError { * Sets the exception. * @return this for method chaining */ - public ClientServerError setException(Exception exception) { + public ClientServerError setException(final Exception exception) { this.exception = exception; return this; } @@ -81,7 +81,7 @@ public class ClientServerError extends ODataError { * @param statusCode the status code which this error results in * @return this for method chaining */ - public ClientServerError setStatusCode(int statusCode) { + public ClientServerError setStatusCode(final int statusCode) { this.statusCode = statusCode; return this; } @@ -92,7 +92,8 @@ public class ClientServerError extends ODataError { * for the HTTP error code specified in the response. MAY be null. * @return this for method chaining */ - public ClientServerError setCode(String code) { + @Override + public ClientServerError setCode(final String code) { super.setCode(code); return this; } @@ -102,7 +103,8 @@ public class ClientServerError extends ODataError { * language-dependent representation of the error. MUST not be null. * @return this for method chaining */ - public ClientServerError setMessage(String message) { + @Override + public ClientServerError setMessage(final String message) { super.setMessage(message); return this; } @@ -112,7 +114,8 @@ public class ClientServerError extends ODataError { * property in error). MAY be null. * @return this for method chaining */ - public ClientServerError setTarget(String target) { + @Override + public ClientServerError setTarget(final String target) { super.setTarget(target); return this; } @@ -121,7 +124,8 @@ public class ClientServerError extends ODataError { * Sets error details. * @return this for method chaining. */ - public ClientServerError setDetails(List<ODataErrorDetail> details) { + @Override + public ClientServerError setDetails(final List<ODataErrorDetail> details) { super.setDetails(details); return this; } @@ -130,7 +134,8 @@ public class ClientServerError extends ODataError { * Sets server defined key-value pairs for debug environment only. * @return this for method chaining. */ - public ClientServerError setInnerError(Map<String, String> innerError) { + @Override + public ClientServerError setInnerError(final Map<String, String> innerError) { super.setInnerError(innerError); return this; } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java index 767dd19..43cd3d1 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java @@ -6,9 +6,9 @@ * to you 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 @@ -79,7 +79,7 @@ public abstract class OData { * Deserializers are used in Processor implementations. */ public abstract FixedFormatDeserializer createFixedFormatDeserializer(); - + /** * Creates a new ODataHttpHandler for handling OData requests in an HTTP context. * @@ -108,7 +108,7 @@ public abstract class OData { * @param format any format supported by Olingo (XML, JSON ...) */ public abstract ODataDeserializer createDeserializer(ODataFormat format) throws DeserializerException; - + /** * @param kind * @return a {@link EdmPrimitiveType} instance for the type kind http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java index 6dda314..db27121 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java @@ -6,9 +6,9 @@ * to you 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 @@ -36,9 +36,9 @@ public class ODataApplicationException extends ODataException { /** * Exception in an OData service implementation. - * @param msg the text of the exception + * @param msg the text of the exception * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error - * @param locale a {@link Locale} to enable translation of error messages + * @param locale a {@link Locale} to enable translation of error messages * @see ODataException * @see HttpStatusCode */ @@ -50,9 +50,9 @@ public class ODataApplicationException extends ODataException { /** * Exception in an OData service implementation. - * @param msg the text of the exception - * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error - * @param locale a {@link Locale} to enable translation of error messages + * @param msg the text of the exception + * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error + * @param locale a {@link Locale} to enable translation of error messages * @param oDataErrorCode the error code of the exception as defined by the OData standard * @see ODataException * @see HttpStatusCode @@ -65,10 +65,10 @@ public class ODataApplicationException extends ODataException { /** * Exception in an OData service implementation. - * @param msg the text of the exception + * @param msg the text of the exception * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error - * @param locale a {@link Locale} to enable translation of error messages - * @param cause the cause of this exception + * @param locale a {@link Locale} to enable translation of error messages + * @param cause the cause of this exception * @see ODataException * @see HttpStatusCode * @see Throwable#getCause() @@ -82,10 +82,10 @@ public class ODataApplicationException extends ODataException { /** * Exception in an OData service implementation. - * @param msg the text of the exception - * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error - * @param locale a {@link Locale} to enable translation of error messages - * @param cause the cause of this exception + * @param msg the text of the exception + * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error + * @param locale a {@link Locale} to enable translation of error messages + * @param cause the cause of this exception * @param oDataErrorCode the error code of the exception as defined by the OData standard * @see ODataException * @see HttpStatusCode http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java index 8e4f257..70ca15e 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,12 +18,12 @@ */ package org.apache.olingo.server.api; -import org.apache.olingo.server.api.processor.Processor; -import org.apache.olingo.server.api.serializer.CustomContentTypeSupport; - import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.olingo.server.api.processor.Processor; +import org.apache.olingo.server.api.serializer.CustomContentTypeSupport; + /** * Handles HTTP requests as OData requests. */ http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java index 03e2936..d18f67e 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,14 +18,14 @@ */ package org.apache.olingo.server.api; -import org.apache.olingo.commons.api.http.HttpMethod; - import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.olingo.commons.api.http.HttpMethod; + /** * Request object to carry HTTP information optimized for and required to handle OData requests only. */ http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java index d629112..493e794 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java @@ -6,9 +6,9 @@ * to you 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 @@ -34,7 +34,6 @@ public class ODataResponse { private Map<String, String> headers = new HashMap<String, String>(); private InputStream content; - /** * Sets the status code. * @see HttpStatusCode http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataTranslatedException.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataTranslatedException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataTranslatedException.java index 4336456..09c2e7b 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataTranslatedException.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataTranslatedException.java @@ -6,9 +6,9 @@ * to you 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 @@ -49,14 +49,16 @@ public abstract class ODataTranslatedException extends ODataException { private MessageKey messageKey; private Object[] parameters; - protected ODataTranslatedException(String developmentMessage, MessageKey messageKey, String... parameters) { + protected ODataTranslatedException(final String developmentMessage, final MessageKey messageKey, + final String... parameters) { super(developmentMessage); this.messageKey = messageKey; this.parameters = parameters; } - protected ODataTranslatedException(String developmentMessage, Throwable cause, MessageKey messageKey, - String... parameters) { + protected ODataTranslatedException(final String developmentMessage, final Throwable cause, + final MessageKey messageKey, + final String... parameters) { super(developmentMessage, cause); this.messageKey = messageKey; this.parameters = parameters; @@ -112,7 +114,7 @@ public abstract class ODataTranslatedException extends ODataException { } } - private ODataErrorMessage buildMessage(ResourceBundle bundle, Locale locale) { + private ODataErrorMessage buildMessage(final ResourceBundle bundle, final Locale locale) { String message = null; try { @@ -141,7 +143,7 @@ public abstract class ODataTranslatedException extends ODataException { public ODataErrorMessage(final String message, final Locale usedLocale) { this.message = message; - this.locale = usedLocale; + locale = usedLocale; } /** Gets the message text. */ http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-api/src/main/java/org/apache/olingo/server/api/ServiceMetadata.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ServiceMetadata.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ServiceMetadata.java index dc06b94..e850dbd 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ServiceMetadata.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ServiceMetadata.java @@ -6,9 +6,9 @@ * to you 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 @@ -18,11 +18,11 @@ */ package org.apache.olingo.server.api; +import java.util.List; + import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.server.api.edmx.EdmxReference; import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; - -import java.util.List; +import org.apache.olingo.server.api.edmx.EdmxReference; /** * Metadata of an OData service like the Entity Data Model. http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java index 6a151e0..5ac3c84 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java @@ -6,9 +6,9 @@ * to you 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 @@ -17,50 +17,50 @@ * under the License. */package org.apache.olingo.server.api.batch; -import org.apache.olingo.server.api.ODataRequest; -import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.batch.exception.BatchDeserializerException; -import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart; -import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart; + import org.apache.olingo.server.api.ODataRequest; + import org.apache.olingo.server.api.ODataResponse; + import org.apache.olingo.server.api.batch.exception.BatchDeserializerException; + import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart; + import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart; -/** - * Provides methods to process {@link ODataRequest} and {@link BatchRequestPart}. - * - * Within a {@link org.apache.olingo.server.api.processor.BatchProcessor} implementation BatchRequestsParts - * should be passed to {@link BatchFacade#handleBatchRequest(BatchRequestPart)}. - * If only if the BatchRequests part represents a change set, the request will be delegated to - * {@link org.apache.olingo.server.api.processor.BatchProcessor#processChangeSet(BatchFacade, java.util.List)}. - * Otherwise the requests will be directly executed. - * - * The processor implementation could use {@link BatchFacade#handleODataRequest(ODataRequest)} to processes - * requests in a change set. - */ -public interface BatchFacade { - /** - * Executes a ODataRequest, which must be a part of a change set. - * Each requests must have a Content-Id header field, which holds an id that is unique in the whole batch request. - * - * @param request ODataRequest to process - * @return Corresponding ODataResult to the given request + /** + * Provides methods to process {@link ODataRequest} and {@link BatchRequestPart}. + * + * Within a {@link org.apache.olingo.server.api.processor.BatchProcessor} implementation BatchRequestsParts + * should be passed to {@link BatchFacade#handleBatchRequest(BatchRequestPart)}. + * If only if the BatchRequests part represents a change set, the request will be delegated to + * {@link org.apache.olingo.server.api.processor.BatchProcessor#processChangeSet(BatchFacade, java.util.List)}. + * Otherwise the requests will be directly executed. + * + * The processor implementation could use {@link BatchFacade#handleODataRequest(ODataRequest)} to processes + * requests in a change set. + */ + public interface BatchFacade { + /** + * Executes a ODataRequest, which must be a part of a change set. + * Each requests must have a Content-Id header field, which holds an id that is unique in the whole batch request. + * + * @param request ODataRequest to process + * @return Corresponding ODataResult to the given request * @throws BatchDeserializerException - */ - public ODataResponse handleODataRequest(ODataRequest request) throws BatchDeserializerException; - + */ + public ODataResponse handleODataRequest(ODataRequest request) throws BatchDeserializerException; + /** - * Handles a BatchRequestPart. - * - * @param request Request to process - * @return Corresponding {@link ODataResponsePart} - * @throws BatchDeserializerException - */ - public ODataResponsePart handleBatchRequest(BatchRequestPart request) throws BatchDeserializerException; - + * Handles a BatchRequestPart. + * + * @param request Request to process + * @return Corresponding {@link ODataResponsePart} + * @throws BatchDeserializerException + */ + public ODataResponsePart handleBatchRequest(BatchRequestPart request) throws BatchDeserializerException; + /** - * Extracts the boundary of a multipart/mixed header. + * Extracts the boundary of a multipart/mixed header. * See RFC 2046#5.1 - * - * @param contentType Content Type - * @return Boundary - */ - public String extractBoundaryFromContentType(String contentType) throws BatchDeserializerException; -} + * + * @param contentType Content Type + * @return Boundary + */ + public String extractBoundaryFromContentType(String contentType) throws BatchDeserializerException; + } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchDeserializerException.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchDeserializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchDeserializerException.java index eeb11d6..b00ae53 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchDeserializerException.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchDeserializerException.java @@ -6,9 +6,9 @@ * to you 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 @@ -52,7 +52,7 @@ public class BatchDeserializerException extends DeserializerException { private static final long serialVersionUID = -907752788975531134L; - public BatchDeserializerException(final String developmentMessage, final MessageKey messageKey, + public BatchDeserializerException(final String developmentMessage, final MessageKey messageKey, final int lineNumber) { this(developmentMessage, messageKey, "" + lineNumber); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchSerializerException.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchSerializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchSerializerException.java index 03b1f14..9a645a1 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchSerializerException.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchSerializerException.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java index 1989df1..d8d17dc 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java @@ -6,9 +6,9 @@ * to you 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 @@ -29,25 +29,38 @@ public class DeserializerException extends ODataTranslatedException { public static enum MessageKeys implements MessageKey { NOT_IMPLEMENTED, IO_EXCEPTION, - /** parameter: format */ UNSUPPORTED_FORMAT, - JSON_SYNTAX_EXCEPTION, - /** parameter: propertyName */ INVALID_NULL_PROPERTY, - /** parameter: keyName */ UNKOWN_CONTENT, - /** parameter: propertyName */ INVALID_VALUE_FOR_PROPERTY, - /** parameter: propertyName */ INVALID_JSON_TYPE_FOR_PROPERTY, - VALUE_ARRAY_NOT_PRESENT, - VALUE_TAG_MUST_BE_AN_ARRAY, - INVALID_ENTITY, - /** parameter: navigationPropertyName */INVALID_VALUE_FOR_NAVIGATION_PROPERTY, - DUPLICATE_PROPERTY, - DUPLICATE_JSON_PROPERTY, - /** parameters: primitiveTypeName, propertyName */ UNKNOWN_PRIMITIVE_TYPE, - /** parameter: navigationPropertyName */NAVIGATION_PROPERTY_NOT_FOUND, - /** parameter: annotationName */INVALID_ANNOTATION_TYPE, - /** parameter: annotationName */INVALID_NULL_ANNOTATION, - /** parameter: binding link */INVALID_ENTITY_BINDING_LINK, - /** parameter: action parameter name */INVALID_ACTION_PARAMETER_TYPE, - /** parameter: parameterName */ INVALID_NULL_PARAMETER; + /** parameter: format */ + UNSUPPORTED_FORMAT, + JSON_SYNTAX_EXCEPTION, + /** parameter: propertyName */ + INVALID_NULL_PROPERTY, + /** parameter: keyName */ + UNKOWN_CONTENT, + /** parameter: propertyName */ + INVALID_VALUE_FOR_PROPERTY, + /** parameter: propertyName */ + INVALID_JSON_TYPE_FOR_PROPERTY, + VALUE_ARRAY_NOT_PRESENT, + VALUE_TAG_MUST_BE_AN_ARRAY, + INVALID_ENTITY, + /** parameter: navigationPropertyName */ + INVALID_VALUE_FOR_NAVIGATION_PROPERTY, + DUPLICATE_PROPERTY, + DUPLICATE_JSON_PROPERTY, + /** parameters: primitiveTypeName, propertyName */ + UNKNOWN_PRIMITIVE_TYPE, + /** parameter: navigationPropertyName */ + NAVIGATION_PROPERTY_NOT_FOUND, + /** parameter: annotationName */ + INVALID_ANNOTATION_TYPE, + /** parameter: annotationName */ + INVALID_NULL_ANNOTATION, + /** parameter: binding link */ + INVALID_ENTITY_BINDING_LINK, + /** parameter: action parameter name */ + INVALID_ACTION_PARAMETER_TYPE, + /** parameter: parameterName */ + INVALID_NULL_PARAMETER; @Override public String getKey() { @@ -58,8 +71,8 @@ public class DeserializerException extends ODataTranslatedException { /** * Creates deserializer exception. * @param developmentMessage message text as fallback and for debugging purposes - * @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle - * @param parameters parameters for the exception text + * @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle + * @param parameters parameters for the exception text */ public DeserializerException(final String developmentMessage, final MessageKey messageKey, final String... parameters) { @@ -69,9 +82,9 @@ public class DeserializerException extends ODataTranslatedException { /** * Creates deserializer exception. * @param developmentMessage message text as fallback and for debugging purposes - * @param cause the cause of this exception - * @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle - * @param parameters parameters for the exception text + * @param cause the cause of this exception + * @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle + * @param parameters parameters for the exception text */ public DeserializerException(final String developmentMessage, final Throwable cause, final MessageKey messageKey, final String... parameters) { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerResult.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerResult.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerResult.java index c58612a..3c6a3ee 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerResult.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerResult.java @@ -6,9 +6,9 @@ * to you 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 @@ -49,7 +49,7 @@ public interface DeserializerResult { * @return an {@link ExpandOption} or null */ ExpandOption getExpandTree(); - + /** * Returns the deserialized action-parameters of an {@link Entity} object. * @return a collection {@link Parameter} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java index 0182d6d..6ad10eb 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java @@ -6,9 +6,9 @@ * to you 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 http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java index c6ba000..41eb60b 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java @@ -6,9 +6,9 @@ * to you 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 @@ -20,8 +20,6 @@ package org.apache.olingo.server.api.deserializer; import java.io.InputStream; -import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.edm.EdmAction; import org.apache.olingo.commons.api.edm.EdmEntityType; import org.apache.olingo.commons.api.edm.EdmProperty; @@ -32,9 +30,10 @@ import org.apache.olingo.commons.api.edm.EdmProperty; public interface ODataDeserializer { /** - * Deserializes an entity stream into an {@link Entity} object. + * Deserializes an entity stream into an {@link org.apache.olingo.commons.api.data.Entity} object. * Validates: property types, no double properties, correct json types - * Returns a deserialized {@link Entity} object and an {@link ExpandOption} object + * Returns a deserialized {@link org.apache.olingo.commons.api.data.Entity} object and an + * {@link org.apache.olingo.server.api.uri.queryoption.ExpandOption} object * @param stream * @param edmEntityType * @return {@link DeserializerResult#getEntity()} and {@link DeserializerResult#getExpandTree()} @@ -43,7 +42,7 @@ public interface ODataDeserializer { DeserializerResult entity(InputStream stream, EdmEntityType edmEntityType) throws DeserializerException; /** - * Deserializes an entity collection stream into an {@link EntityCollection} object. + * Deserializes an entity collection stream into an {@link org.apache.olingo.commons.api.data.EntityCollection} object * @param stream * @param edmEntityType * @return {@link DeserializerResult#getEntityCollection()} @@ -52,7 +51,7 @@ public interface ODataDeserializer { DeserializerResult entityCollection(InputStream stream, EdmEntityType edmEntityType) throws DeserializerException; /** - * Deserializes an action-parameters stream into an {@link Entity} object. + * Deserializes an action-parameters stream into an {@link org.apache.olingo.commons.api.data.Entity} object. * Validates: parameter types, no double parameters, correct json types. * @param stream * @param edmAction @@ -74,7 +73,7 @@ public interface ODataDeserializer { * Read entity references from the provided document * @param stream * @param keys - * @return {@link DeserializerResult#getEntityReferences()}} + * @return {@link DeserializerResult#getEntityReferences()} * @throws DeserializerException */ DeserializerResult entityReferences(InputStream stream) throws DeserializerException; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java index 28309a5..0873e23 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java @@ -20,20 +20,21 @@ package org.apache.olingo.server.api.deserializer.batch; /** * Options for the batch deserializer. - * See {@link org.apache.olingo.server.api.deserializer.FixedFormatDeserializer - * #parseBatchRequest(java.io.InputStream, String, BatchOptions)} + * See + * {@link org.apache.olingo.server.api.deserializer.FixedFormatDeserializer + * #parseBatchRequest(java.io.InputStream, String, BatchOptions)} */ public class BatchOptions { private boolean isStrict = true; private String rawBaseUri = ""; private String rawServiceResolutionUri = ""; - - private BatchOptions() { } - + + private BatchOptions() {} + /** * Returns if the batch parsing is strict. * Default is true - * + * * @return true if parsing is strict */ public boolean isStrict() { @@ -46,61 +47,61 @@ public class BatchOptions { public String getRawBaseUri() { return rawBaseUri; } - + /** * See {@link org.apache.olingo.server.api.ODataRequest#getRawServiceResolutionUri()} */ public String getRawServiceResolutionUri() { return rawServiceResolutionUri; } - + /** * Creates a new BatchOptions builder - * + * * @return new BatchOptions builder instance */ public static Builder with() { return new Builder(); } - + /** * BatchOptions builder */ public static class Builder { private BatchOptions options; - + /** Initializes the options builder. */ public Builder() { options = new BatchOptions(); } - + /** * See {@link BatchOptions#isStrict()} */ - public Builder isStrict(boolean isStrict) { + public Builder isStrict(final boolean isStrict) { options.isStrict = isStrict; return this; } - + /** * See {@link org.apache.olingo.server.api.ODataRequest#getRawBaseUri()} */ - public Builder rawBaseUri(String baseUri) { + public Builder rawBaseUri(final String baseUri) { options.rawBaseUri = baseUri; return this; } - + /** * See {@link org.apache.olingo.server.api.ODataRequest#getRawServiceResolutionUri()} */ - public Builder rawServiceResolutionUri(String serviceResolutionUri) { + public Builder rawServiceResolutionUri(final String serviceResolutionUri) { options.rawServiceResolutionUri = serviceResolutionUri; return this; } - + /** * Creates a new BatchOptions instance - * + * * @return new BatchOptions instance */ public BatchOptions build() {
