You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2014/02/17 16:36:15 UTC
[28/29] [OLINGO-161] Refactored module names
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/PropertyCollectionBuilder.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/PropertyCollectionBuilder.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/PropertyCollectionBuilder.java
new file mode 100644
index 0000000..fa92ec4
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/PropertyCollectionBuilder.java
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.consumer.core.deserializer;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.olingo.odata4.consumer.api.deserializer.AnnotationProperty;
+import org.apache.olingo.odata4.consumer.api.deserializer.ComplexValue;
+import org.apache.olingo.odata4.consumer.api.deserializer.Entity;
+import org.apache.olingo.odata4.consumer.api.deserializer.NavigationProperty;
+import org.apache.olingo.odata4.consumer.api.deserializer.Property;
+import org.apache.olingo.odata4.consumer.api.deserializer.StructuralProperty;
+import org.apache.olingo.odata4.consumer.api.deserializer.Value;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+
+public class PropertyCollectionBuilder extends PropertyCollection {
+ private JsonParser parser;
+ private EntitySetImpl enclosingEntitySet;
+
+ public PropertyCollectionBuilder(final JsonParser parser) {
+ this.parser = parser;
+ }
+
+ private PropertyCollectionBuilder() {};
+
+ public PropertyCollectionBuilder(final JsonParser jp, final EntitySetImpl entitySet) {
+ this(jp);
+ enclosingEntitySet = entitySet;
+ }
+
+ public Entity buildEntity() {
+ Entity v = new EntityImpl(annotationProperties, navigationProperties, structuralProperties);
+ resetProperties();
+ return v;
+ }
+
+ public ComplexValue buildComplexValue() {
+ ComplexValue v = new ComplexValueImpl(annotationProperties, navigationProperties, structuralProperties);
+ resetProperties();
+ return v;
+ }
+
+ private void resetProperties() {
+ annotationProperties = new HashMap<String, AnnotationProperty>();
+ navigationProperties = new HashMap<String, NavigationProperty>();
+ structuralProperties = new HashMap<String, StructuralProperty>();
+ }
+
+ private PropertyCollectionBuilder next = null;
+
+ public boolean hasNext() throws JsonParseException, IOException {
+ if (parser.isClosed()) {
+ return false;
+ }
+ next = parseNextObject(parser, this);
+ return (next != null);
+ }
+
+ public boolean parseNext() {
+ try {
+ if (hasNext()) {
+ if (next != null) {
+ return true;
+ }
+
+ if (next == null) {
+ parser.close();
+ return false;
+ }
+ return true;
+ }
+ } catch (JsonParseException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return false;
+
+ }
+
+ /**
+ *
+ * @param jp
+ * @param builder
+ * @return
+ * @throws IOException
+ * @throws JsonParseException
+ */
+ private PropertyCollectionBuilder parseNextObject(final JsonParser jp, final PropertyCollectionBuilder builder)
+ throws JsonParseException, IOException {
+ boolean endReached = readToStartObjectOrEnd(jp);
+ if (endReached) {
+ return null;
+ }
+
+ //
+ String currentFieldName = null;
+ List<Value> values = null;
+
+ while (jp.nextToken() != null) {
+ JsonToken token = jp.getCurrentToken();
+ switch (token) {
+ case START_OBJECT:
+ if (currentFieldName != null) {
+ ComplexValue cvp = parseNextObject(jp, new PropertyCollectionBuilder()).buildComplexValue();
+ if (values == null) {
+ builder.addProperty(new StructuralPropertyImpl(currentFieldName, cvp));
+ } else {
+ values.add(cvp);
+ }
+ }
+ break;
+ case END_OBJECT:
+ return builder;
+ case START_ARRAY:
+ values = new ArrayList<Value>();
+ break;
+ case END_ARRAY:
+ if (values != null) {
+ builder.addProperty(new StructuralPropertyImpl(currentFieldName, values));
+ values = null;
+ }
+ break;
+ case FIELD_NAME:
+ currentFieldName = jp.getCurrentName();
+ break;
+ case NOT_AVAILABLE:
+ break;
+ case VALUE_EMBEDDED_OBJECT:
+ break;
+ case VALUE_NULL:
+ Property nullProperty = createProperty(jp.getCurrentName(), null);
+ builder.addProperty(nullProperty);
+ break;
+ case VALUE_FALSE:
+ case VALUE_NUMBER_FLOAT:
+ case VALUE_NUMBER_INT:
+ case VALUE_STRING:
+ case VALUE_TRUE:
+ if (values == null) {
+ Property property = createProperty(jp.getCurrentName(), jp.getValueAsString());
+ builder.addProperty(property);
+ } else {
+ PrimitiveValue value = new PrimitiveValue(jp.getValueAsString());
+ values.add(value);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ return null;
+ }
+
+ private boolean readToStartObjectOrEnd(final JsonParser jp) throws IOException, JsonParseException {
+ JsonToken endToken = JsonToken.START_OBJECT;
+ JsonToken token = jp.getCurrentToken() == null ? jp.nextToken() : jp.getCurrentToken();
+ while (token != null && token != endToken) {
+ if (enclosingEntitySet != null) {
+ switch (token) {
+ case VALUE_FALSE:
+ case VALUE_NUMBER_FLOAT:
+ case VALUE_NUMBER_INT:
+ case VALUE_TRUE:
+ case VALUE_STRING:
+ enclosingEntitySet.addAnnotation(jp.getCurrentName(), jp.getValueAsString());
+ break;
+ default:
+ break;
+ }
+ }
+ //
+ token = jp.nextToken();
+ }
+
+ return token == null;
+ }
+
+ private Property createProperty(final String name, final String value) {
+ if (name.contains("@")) {
+ return new NavigationPropertyImpl(name, value);
+ } else if (name.contains(".")) {
+ return new AnnotationPropertyImpl(name, value);
+ } else {
+ return new StructuralPropertyImpl(name, new PrimitiveValue(value));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/StructuralPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/StructuralPropertyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/StructuralPropertyImpl.java
new file mode 100644
index 0000000..5e88417
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/StructuralPropertyImpl.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.consumer.core.deserializer;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.odata4.consumer.api.deserializer.StructuralProperty;
+import org.apache.olingo.odata4.consumer.api.deserializer.Value;
+
+public class StructuralPropertyImpl implements StructuralProperty {
+
+ private final List<Value> values;
+ private final String name;
+ private final boolean containsCollection;
+
+ public StructuralPropertyImpl(final String name, final Value value) {
+ this(name, false, value);
+ }
+
+ public StructuralPropertyImpl(final String name, final List<Value> values) {
+ // XXX: ugly -> refactore
+ this(name, true, values.toArray(new Value[0]));
+ }
+
+ public StructuralPropertyImpl(final String name, final boolean asCollection, final Value... value) {
+ if (value == null || value.length == 0) {
+ throw new IllegalArgumentException("Missing or NULL value argument.");
+ }
+
+ containsCollection = asCollection;
+ this.name = name;
+ values = new ArrayList<Value>(value.length);
+ for (Value v : value) {
+ values.add(v);
+ }
+ }
+
+ @Override
+ public Value getValue() {
+ return values.get(0);
+ }
+
+ @Override
+ public List<Value> getValues() {
+ return Collections.unmodifiableList(values);
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public boolean containsCollection() {
+ return containsCollection;
+ }
+
+ @Override
+ public String toString() {
+ return "StructuralPropertyImpl [name=" + name + ", containsCollection=" + containsCollection
+ + ", values=" + values + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/ODataConsumerTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/ODataConsumerTest.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/ODataConsumerTest.java
new file mode 100644
index 0000000..bde0de5
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/ODataConsumerTest.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.consumer.core;
+
+import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
+import org.apache.olingo.odata4.consumer.api.ODataConsumer;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ODataConsumerTest {
+
+ private ODataConsumer consumer;
+
+ @Before
+ public void before() {
+ consumer = ODataConsumer.create();
+ }
+
+ @Test
+ public void edmtest() {
+ EdmProvider provider = null;
+ consumer.createEdm(provider);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReaderPerformance.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReaderPerformance.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReaderPerformance.java
new file mode 100644
index 0000000..e88c76a
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReaderPerformance.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.consumer.core.deserializer;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+
+import org.apache.olingo.odata4.consumer.api.deserializer.ComplexValue;
+import org.apache.olingo.odata4.consumer.api.deserializer.Property;
+import org.apache.olingo.odata4.consumer.api.deserializer.StructuralProperty;
+import org.apache.olingo.odata4.consumer.api.deserializer.Value;
+import org.apache.olingo.odata4.consumer.core.testutil.StringHelper;
+import org.junit.Test;
+
+public class JsonReaderPerformance {
+
+ @Test
+ public void testComplexPropertyPerformance() throws Exception {
+ JsonReader consumer = new JsonReader();
+ int runs = 1000; // * 100;
+
+ InputStream in = JsonReaderPerformance.class.getResourceAsStream("/complexProperty.json");
+ String content = StringHelper.inputStreamToString(in);
+
+// System.out.println("Started...");
+ ComplexValue complex = null;
+// long startTime = System.currentTimeMillis();
+ for (int i = 0; i < runs; i++) {
+ Property property = consumer.readProperty(StringHelper.encapsulate(content));
+ complex = (ComplexValue) ((StructuralProperty) property).getValue();
+ }
+// long endTime = System.currentTimeMillis();
+
+// long duration = endTime - startTime;
+// System.out.println("Duration: " + duration + " ms");
+// System.out.println("Duration per run: " + (duration / (float) runs) + " ms");
+
+ testComplexProperty(complex);
+ }
+
+ private void testComplexProperty(final Value value) {
+ assertNotNull(value);
+ assertTrue(value.isComplex());
+
+ ComplexValue complex = (ComplexValue) value;
+
+ assertEquals("Obere Str. 57", complex.getValue("Street").getContent());
+ assertEquals("Berlin", complex.getValue("City").getContent());
+ assertNull(complex.getValue("Region").getContent());
+ assertEquals("D-12209", complex.getValue("PostalCode").getContent());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReaderTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReaderTest.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReaderTest.java
new file mode 100644
index 0000000..978282e
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/deserializer/JsonReaderTest.java
@@ -0,0 +1,373 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.consumer.core.deserializer;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.olingo.odata4.consumer.api.deserializer.ComplexValue;
+import org.apache.olingo.odata4.consumer.api.deserializer.Entity;
+import org.apache.olingo.odata4.consumer.api.deserializer.EntitySet;
+import org.apache.olingo.odata4.consumer.api.deserializer.Property;
+import org.apache.olingo.odata4.consumer.api.deserializer.Reader;
+import org.apache.olingo.odata4.consumer.api.deserializer.StructuralProperty;
+import org.apache.olingo.odata4.consumer.api.deserializer.Value;
+import org.junit.Test;
+
+public class JsonReaderTest {
+
+ @Test
+ public void testEntitySet() throws Exception {
+ Reader consumer = new JsonReader();
+
+ EntitySet entitySet = consumer.readEntitySet(
+ JsonReaderTest.class.getResourceAsStream("/fullEntitySet.json"));
+
+ List<Entity> entities = entitySet.getEntities();
+ validateEntitySet(entitySet);
+ assertNotNull(entities);
+ Entity entity = entities.get(0);
+ assertNotNull(entity);
+ validateEntityAlfki(entity);
+
+ StructuralProperty structuralProperty = entity.getProperty("Address", StructuralProperty.class);
+ assertEquals("Address", structuralProperty.getName());
+
+ Value value = structuralProperty.getValue();
+ assertTrue(value.isComplex());
+ ComplexValue complexValue = (ComplexValue) value;
+ validateAddressBerlin(complexValue);
+ validateComplexValueNavigationLinks(complexValue);
+ }
+
+ @Test
+ public void testEntitySetWithTwoEntities() throws Exception {
+ Reader consumer = new JsonReader();
+
+ EntitySet entitySet = consumer.readEntitySet(getJson("/fullEntitySetWithTwoEntities.json"));
+
+ List<Entity> entities = entitySet.getEntities();
+ validateEntitySet(entitySet);
+ assertNotNull(entities);
+ assertEquals(2, entities.size());
+ //
+ Entity firstEntity = entities.get(0);
+ assertNotNull(firstEntity);
+ validateEntityAlfki(firstEntity);
+
+ StructuralProperty structuralProperty = firstEntity.getProperty("Address", StructuralProperty.class);
+ assertEquals("Address", structuralProperty.getName());
+
+ Value value = structuralProperty.getValue();
+ assertTrue(value.isComplex());
+ ComplexValue complexValue = (ComplexValue) value;
+ validateAddressBerlin(complexValue);
+ validateComplexValueNavigationLinks(complexValue);
+
+ //
+ Entity secondEntity = entities.get(1);
+ assertNotNull(secondEntity);
+ validateEntityMuski(secondEntity);
+
+ StructuralProperty addressMuster = secondEntity.getProperty("Address", StructuralProperty.class);
+ assertEquals("Address", addressMuster.getName());
+ validateAddressMuster((ComplexValue) addressMuster.getValue());
+ }
+
+ @Test
+ public void streamingTestForEntitySetWithTwoEntities() throws Exception {
+ Reader consumer = new JsonReader();
+
+ EntitySet entitySet = consumer.readEntitySet(getJson("/fullEntitySetWithTwoEntities.json"));
+ validateEntitySet(entitySet, false);
+
+ for (Entity entity : entitySet) {
+ if ("Customers('ALFKI')".equals(entity.getODataId())) {
+ validateEntityAlfki(entity);
+
+ StructuralProperty structuralProperty = entity.getProperty("Address", StructuralProperty.class);
+ assertEquals("Address", structuralProperty.getName());
+
+ Value value = structuralProperty.getValue();
+ assertTrue(value.isComplex());
+ ComplexValue complexValue = (ComplexValue) value;
+ validateAddressBerlin(complexValue);
+ validateComplexValueNavigationLinks(complexValue);
+ } else if ("Customers('MUSKI')".equals(entity.getODataId())) {
+ validateEntityMuski(entity);
+
+ StructuralProperty addressMuster = entity.getProperty("Address", StructuralProperty.class);
+ assertEquals("Address", addressMuster.getName());
+ validateAddressMuster((ComplexValue) addressMuster.getValue());
+ } else {
+ fail("Got unknown entity with id '" + entity.getODataId() + "'.");
+ }
+ }
+
+ validateEntitySet(entitySet, true);
+ }
+
+ @Test
+ public void iteratorTestForEntitySetWithTwoEntities() throws Exception {
+ Reader consumer = new JsonReader();
+
+ EntitySet entitySet = consumer.readEntitySet(getJson("/fullEntitySetWithTwoEntities.json"));
+ assertEquals(2, entitySet.getEntities().size());
+ validateEntitySet(entitySet, true);
+
+ for (Entity entity : entitySet) {
+ if ("Customers('ALFKI')".equals(entity.getODataId())) {
+ validateEntityAlfki(entity);
+
+ StructuralProperty structuralProperty = entity.getProperty("Address", StructuralProperty.class);
+ assertEquals("Address", structuralProperty.getName());
+
+ Value value = structuralProperty.getValue();
+ assertTrue(value.isComplex());
+ ComplexValue complexValue = (ComplexValue) value;
+ validateAddressBerlin(complexValue);
+ validateComplexValueNavigationLinks(complexValue);
+ } else if ("Customers('MUSKI')".equals(entity.getODataId())) {
+ validateEntityMuski(entity);
+
+ StructuralProperty addressMuster = entity.getProperty("Address", StructuralProperty.class);
+ assertEquals("Address", addressMuster.getName());
+ validateAddressMuster((ComplexValue) addressMuster.getValue());
+ } else {
+ fail("Got unknown entity with id '" + entity.getODataId() + "'.");
+ }
+ }
+ }
+
+ @Test
+ public void testEntity() throws Exception {
+ Reader consumer = new JsonReader();
+
+ Entity entity = consumer.readEntity(JsonReaderTest.class.getResourceAsStream("/fullEntity.json"));
+ validateEntityAlfki(entity);
+
+ StructuralProperty structuralProperty = entity.getProperty("Address", StructuralProperty.class);
+ assertEquals("Address", structuralProperty.getName());
+
+ Value value = structuralProperty.getValue();
+ assertTrue(value.isComplex());
+ ComplexValue complexValue = (ComplexValue) value;
+ validateAddressBerlin(complexValue);
+ validateComplexValueNavigationLinks(complexValue);
+ }
+
+ @Test
+ public void testComplexProperty() throws Exception {
+ Reader consumer = new JsonReader();
+
+ Property property = consumer.readProperty(getJson("/complexProperty.json"));
+ assertEquals("Address", property.getName());
+
+ assertTrue(property instanceof StructuralProperty);
+ StructuralProperty structuralProperty = (StructuralProperty) property;
+ Value value = structuralProperty.getValue();
+ assertTrue(value.isComplex());
+ ComplexValue complexValue = (ComplexValue) value;
+ validateAddressBerlin(complexValue);
+ validateAddressBerlin(complexValue);
+ }
+
+ @Test
+ public void testEntityWithCollectionOfComplexProperty() throws Exception {
+ Reader consumer = new JsonReader();
+
+ Entity entity = consumer.readEntity(getJson("/fullEntityWithCollectionOfComplexValues.json"));
+ StructuralProperty address = entity.getProperty("Address", StructuralProperty.class);
+ assertTrue(address.containsCollection());
+ assertEquals("Address", address.getName());
+
+ List<Value> values = address.getValues();
+ assertEquals(2, values.size());
+
+ Value value = values.get(0);
+ assertTrue(value.isComplex());
+ validateAddressBerlin((ComplexValue) value);
+ //
+ ComplexValue addressTwo = (ComplexValue) values.get(1);
+ validateAddressMuster(addressTwo);
+ }
+
+ @Test
+ public void testSetOfPrimitive() throws Exception {
+ Reader consumer = new JsonReader();
+
+ InputStream content = JsonReaderTest.class.getResourceAsStream("/setOfPrimitiveProperties.json");
+ Property property = consumer.readProperty(content);
+ assertEquals("EmailAddresses", property.getName());
+
+ assertTrue(property instanceof StructuralProperty);
+ StructuralProperty structuralProperty = (StructuralProperty) property;
+
+ assertTrue(structuralProperty.containsCollection());
+ Collection<Value> values = structuralProperty.getValues();
+ Iterator<Value> valueIt = values.iterator();
+ assertEquals("Julie@Swansworth.com", valueIt.next().getContent());
+ assertEquals("Julie.Swansworth@work.com", valueIt.next().getContent());
+ }
+
+ @Test
+ public void testSetOfComplex() throws Exception {
+ Reader consumer = new JsonReader();
+
+ InputStream content = JsonReaderTest.class.getResourceAsStream("/setOfComplexProperties.json");
+ Property property = consumer.readProperty(content);
+ Assert.assertEquals("PhoneNumbers", property.getName());
+ Assert.assertTrue(property instanceof StructuralProperty);
+
+ StructuralProperty structuralProperty = (StructuralProperty) property;
+ assertTrue(structuralProperty.containsCollection());
+ List<Value> values = structuralProperty.getValues();
+ assertEquals(2, values.size());
+
+ ComplexValue phoneNumberOne = (ComplexValue) values.get(0);
+ assertEquals("425-555-1212", phoneNumberOne.getValue("Number").getContent());
+ assertEquals("Home", phoneNumberOne.getValue("Type").getContent());
+ assertEquals(null, phoneNumberOne.getValue("Carrier"));
+ assertEquals(null, phoneNumberOne.getAnnotationProperties().get("odata.type"));
+
+ ComplexValue phoneNumberTwo = (ComplexValue) values.get(1);
+ assertEquals("425-555-0178", phoneNumberTwo.getValue("Number").getContent());
+ assertEquals("Cell", phoneNumberTwo.getValue("Type").getContent());
+ assertEquals("Sprint", phoneNumberTwo.getValue("Carrier").getContent());
+ assertEquals("#Model.CellPhoneNumber",
+ phoneNumberTwo.getAnnotationProperties().get("odata.type").getValue());
+
+ // ComplexValue complex = consumer.parseComplexValue(content);
+ //
+ // Value value = complex.getValue("PhoneNumbers");
+ // assertNotNull(value);
+ // assertTrue(value.isComplex());
+ // ComplexValue complexValue = (ComplexValue) value;
+ }
+
+ private void validateEntityAlfki(final Entity entity) {
+ assertNotNull(entity);
+
+ assertEquals("http://host/service/$metadata#Customers/$entity", entity.getODataContext());
+ assertEquals("Customers('ALFKI')", entity.getODataId());
+ assertEquals("W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"", entity.getODataETag());
+ assertEquals("Customers('ALFKI')", entity.getODataEditLink());
+
+ assertNotNull(entity.getNavigationProperties());
+ assertTrue(entity.getNavigationProperties().containsKey("Orders"));
+ assertEquals("Customers('ALFKI')/Orders",
+ entity.getNavigationProperties().get("Orders").getNavigationLink());
+
+ assertNotNull(entity.getNavigationProperties());
+ assertTrue(entity.getNavigationProperties().containsKey("Orders"));
+ assertEquals("Customers('ALFKI')/Orders/$ref",
+ entity.getNavigationProperties().get("Orders").getAssociationLink());
+
+ assertNotNull(entity.getPropertyContent("ID"));
+ assertEquals("ALFKI", entity.getPropertyContent("ID"));
+ assertEquals("Alfreds Futterkiste", entity.getPropertyContent("CompanyName"));
+ assertEquals("Maria Anders", entity.getPropertyContent("ContactName"));
+ assertEquals("Sales Representative", entity.getPropertyContent("ContactTitle"));
+ assertEquals("030-0074321", entity.getPropertyContent("Phone"));
+ assertEquals("030-0076545", entity.getPropertyContent("Fax"));
+ }
+
+ private void validateEntityMuski(final Entity entity) {
+ assertNotNull(entity);
+
+ assertEquals("http://host/service/$metadata#Customers/$entity", entity.getODataContext());
+ assertEquals("Customers('MUSKI')", entity.getODataId());
+ assertEquals("W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"", entity.getODataETag());
+ assertEquals("Customers('MUSKI')", entity.getODataEditLink());
+
+ assertNotNull(entity.getNavigationProperties());
+ assertTrue(entity.getNavigationProperties().containsKey("Orders"));
+ assertEquals("Customers('MUSKI')/Orders", entity.getNavigationProperties().get("Orders").getNavigationLink());
+
+ assertNotNull(entity.getNavigationProperties());
+ assertTrue(entity.getNavigationProperties().containsKey("Orders"));
+ assertEquals("Customers('MUSKI')/Orders/$ref",
+ entity.getNavigationProperties().get("Orders").getAssociationLink());
+
+ assertNotNull(entity.getPropertyContent("ID"));
+ assertEquals("MUSKI", entity.getPropertyContent("ID"));
+ assertEquals("Mustermanns Futterkiste", entity.getPropertyContent("CompanyName"));
+ assertEquals("Mustermann Max", entity.getPropertyContent("ContactName"));
+ assertEquals("Some Guy", entity.getPropertyContent("ContactTitle"));
+ assertEquals("030-002222", entity.getPropertyContent("Phone"));
+ assertEquals("030-004444", entity.getPropertyContent("Fax"));
+ }
+
+ private void validateAddressMuster(final ComplexValue addressTwo) {
+ assertEquals("Musterstrasse 42", addressTwo.getValue("Street").getContent());
+ assertEquals("Musterstadt", addressTwo.getValue("City").getContent());
+ assertEquals("SomeRegion", addressTwo.getValue("Region").getContent());
+ assertEquals("D-42042", addressTwo.getValue("PostalCode").getContent());
+ }
+
+ private void validateAddressBerlin(final ComplexValue complex) {
+ assertNotNull(complex);
+
+ assertEquals("Obere Str. 57", complex.getValue("Street").getContent());
+ assertEquals("Berlin", complex.getValue("City").getContent());
+ assertNull(complex.getValue("Region").getContent());
+ assertEquals("D-12209", complex.getValue("PostalCode").getContent());
+ }
+
+ private void validateComplexValueNavigationLinks(final ComplexValue complex) {
+ assertNotNull(complex.getNavigationProperties());
+ assertTrue(complex.getNavigationProperties().containsKey("Country"));
+ assertEquals("Customers('ALFKI')/Address/Country",
+ complex.getNavigationProperties().get("Country").getNavigationLink());
+
+ assertNotNull(complex.getNavigationProperties());
+ assertTrue(complex.getNavigationProperties().containsKey("Country"));
+ assertEquals("Customers('ALFKI')/Address/Country/$ref",
+ complex.getNavigationProperties().get("Country").getAssociationLink());
+ }
+
+ private void validateEntitySet(final EntitySet entitySet) {
+ validateEntitySet(entitySet, true);
+ }
+
+ private void validateEntitySet(final EntitySet entitySet, final boolean validateLinks) {
+ assertNotNull(entitySet);
+
+ assertEquals("http://host/service/$metadata#Customers/$entity", entitySet.getODataContext());
+ assertEquals(Long.valueOf(1), entitySet.getODataCount());
+ if (validateLinks) {
+ assertEquals("http://host/service/EntitySet?$skiptoken=342r89", entitySet.getODataNextLink());
+ assertNull(entitySet.getODataDeltaLink());
+ }
+ }
+
+ private InputStream getJson(final String filename) {
+ return JsonReaderTest.class.getResourceAsStream(filename);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/testutil/StringHelper.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/testutil/StringHelper.java b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/testutil/StringHelper.java
new file mode 100644
index 0000000..4344cad
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/java/org/apache/olingo/odata4/consumer/core/testutil/StringHelper.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.consumer.core.testutil;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+
+/**
+ * @author SAP AG
+ */
+public class StringHelper {
+
+ public static String inputStreamToString(final InputStream in, final boolean preserveLineBreaks) throws IOException {
+ final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in, Charset.forName("UTF-8")));
+ final StringBuilder stringBuilder = new StringBuilder();
+ String line = null;
+
+ while ((line = bufferedReader.readLine()) != null) {
+ stringBuilder.append(line);
+ if (preserveLineBreaks) {
+ stringBuilder.append("\n");
+ }
+ }
+
+ bufferedReader.close();
+
+ final String result = stringBuilder.toString();
+
+ return result;
+ }
+
+ public static String inputStreamToString(final InputStream in) throws IOException {
+ return inputStreamToString(in, false);
+ }
+
+ /**
+ * Encapsulate given content in an {@link InputStream} with charset <code>UTF-8</code>.
+ *
+ * @param content to encapsulate content
+ * @return content as stream
+ */
+ public static InputStream encapsulate(final String content) {
+ try {
+ return encapsulate(content, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ // we know that UTF-8 is supported
+ throw new RuntimeException("UTF-8 MUST be supported.", e);
+ }
+ }
+
+ /**
+ * Encapsulate given content in an {@link InputStream} with given charset.
+ *
+ * @param content to encapsulate content
+ * @param charset to be used charset
+ * @return content as stream
+ * @throws UnsupportedEncodingException if charset is not supported
+ */
+ public static InputStream encapsulate(final String content, final String charset)
+ throws UnsupportedEncodingException {
+ return new ByteArrayInputStream(content.getBytes(charset));
+ }
+
+ /**
+ * Generate a string with given length containing random upper case characters ([A-Z]).
+ *
+ * @param len length of to generated string
+ * @return random upper case characters ([A-Z]).
+ */
+ public static InputStream generateDataStream(final int len) {
+ return encapsulate(generateData(len));
+ }
+
+ /**
+ * Generate a string with given length containing random upper case characters ([A-Z]).
+ *
+ * @param len length of to generated string
+ * @return random upper case characters ([A-Z]).
+ */
+ public static String generateData(final int len) {
+ StringBuilder b = new StringBuilder(len);
+ for (int j = 0; j < len; j++) {
+ char c = (char) (Math.random() * 26 + 65);
+ b.append(c);
+ }
+ return b.toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-client-core/src/test/resources/complexProperty.json
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/resources/complexProperty.json b/odata4-lib/odata4-client-core/src/test/resources/complexProperty.json
new file mode 100644
index 0000000..53af94c
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/resources/complexProperty.json
@@ -0,0 +1,8 @@
+{
+ "Address": {
+ "Street": "Obere Str. 57",
+ "City": "Berlin",
+ "Region": null,
+ "PostalCode": "D-12209"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-client-core/src/test/resources/fullEntity.json
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/resources/fullEntity.json b/odata4-lib/odata4-client-core/src/test/resources/fullEntity.json
new file mode 100644
index 0000000..4d84995
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/resources/fullEntity.json
@@ -0,0 +1,22 @@
+{
+ "odata.context": "http://host/service/$metadata#Customers/$entity",
+ "odata.id": "Customers('ALFKI')",
+ "odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"",
+ "odata.editLink": "Customers('ALFKI')",
+ "Orders@odata.navigationLink": "Customers('ALFKI')/Orders",
+ "Orders@odata.associationLink": "Customers('ALFKI')/Orders/$ref",
+ "ID": "ALFKI",
+ "CompanyName": "Alfreds Futterkiste",
+ "ContactName": "Maria Anders",
+ "ContactTitle": "Sales Representative",
+ "Phone": "030-0074321",
+ "Fax": "030-0076545",
+ "Address": {
+ "Street": "Obere Str. 57",
+ "City": "Berlin",
+ "Region": null,
+ "PostalCode": "D-12209",
+ "Country@odata.navigationLink": "Customers('ALFKI')/Address/Country",
+ "Country@odata.associationLink":"Customers('ALFKI')/Address/Country/$ref"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-client-core/src/test/resources/fullEntitySet.json
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/resources/fullEntitySet.json b/odata4-lib/odata4-client-core/src/test/resources/fullEntitySet.json
new file mode 100644
index 0000000..b3ddf63
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/resources/fullEntitySet.json
@@ -0,0 +1,29 @@
+{
+"odata.context": "http://host/service/$metadata#Customers/$entity",
+"odata.count": 1,
+"value": [
+{
+"odata.context": "http://host/service/$metadata#Customers/$entity",
+"odata.id": "Customers('ALFKI')",
+"odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"",
+"odata.editLink": "Customers('ALFKI')",
+"Orders@odata.navigationLink": "Customers('ALFKI')/Orders",
+"Orders@odata.associationLink": "Customers('ALFKI')/Orders/$ref",
+"ID": "ALFKI",
+"CompanyName": "Alfreds Futterkiste",
+"ContactName": "Maria Anders",
+"ContactTitle": "Sales Representative",
+"Phone": "030-0074321",
+"Fax": "030-0076545",
+"Address": {
+ "Street": "Obere Str. 57",
+ "City": "Berlin",
+ "Region": null,
+ "PostalCode": "D-12209",
+ "Country@odata.navigationLink": "Customers('ALFKI')/Address/Country",
+ "Country@odata.associationLink":"Customers('ALFKI')/Address/Country/$ref"
+ }
+}
+],
+"odata.nextLink": "http://host/service/EntitySet?$skiptoken=342r89"
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-client-core/src/test/resources/fullEntitySetWithTwoEntities.json
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/resources/fullEntitySetWithTwoEntities.json b/odata4-lib/odata4-client-core/src/test/resources/fullEntitySetWithTwoEntities.json
new file mode 100644
index 0000000..96854ac
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/resources/fullEntitySetWithTwoEntities.json
@@ -0,0 +1,49 @@
+{
+"odata.context": "http://host/service/$metadata#Customers/$entity",
+"odata.count": 1,
+"value": [
+ {
+ "odata.context": "http://host/service/$metadata#Customers/$entity",
+ "odata.id": "Customers('ALFKI')",
+ "odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"",
+ "odata.editLink": "Customers('ALFKI')",
+ "Orders@odata.navigationLink": "Customers('ALFKI')/Orders",
+ "Orders@odata.associationLink": "Customers('ALFKI')/Orders/$ref",
+ "ID": "ALFKI",
+ "CompanyName": "Alfreds Futterkiste",
+ "ContactName": "Maria Anders",
+ "ContactTitle": "Sales Representative",
+ "Phone": "030-0074321",
+ "Fax": "030-0076545",
+ "Address": {
+ "Street": "Obere Str. 57",
+ "City": "Berlin",
+ "Region": null,
+ "PostalCode": "D-12209",
+ "Country@odata.navigationLink": "Customers('ALFKI')/Address/Country",
+ "Country@odata.associationLink":"Customers('ALFKI')/Address/Country/$ref"
+ }
+ },
+ {
+ "odata.context": "http://host/service/$metadata#Customers/$entity",
+ "odata.id": "Customers('MUSKI')",
+ "odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"",
+ "odata.editLink": "Customers('MUSKI')",
+ "Orders@odata.navigationLink": "Customers('MUSKI')/Orders",
+ "Orders@odata.associationLink": "Customers('MUSKI')/Orders/$ref",
+ "ID": "MUSKI",
+ "CompanyName": "Mustermanns Futterkiste",
+ "ContactName": "Mustermann Max",
+ "ContactTitle": "Some Guy",
+ "Phone": "030-002222",
+ "Fax": "030-004444",
+ "Address": {
+ "Street": "Musterstrasse 42",
+ "City": "Musterstadt",
+ "Region": "SomeRegion",
+ "PostalCode": "D-42042"
+ }
+ }
+],
+"odata.nextLink": "http://host/service/EntitySet?$skiptoken=342r89"
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-client-core/src/test/resources/fullEntityWithCollectionOfComplexValues.json
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/resources/fullEntityWithCollectionOfComplexValues.json b/odata4-lib/odata4-client-core/src/test/resources/fullEntityWithCollectionOfComplexValues.json
new file mode 100644
index 0000000..cbdfd1c
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/resources/fullEntityWithCollectionOfComplexValues.json
@@ -0,0 +1,28 @@
+{
+ "odata.context": "http://host/service/$metadata#Customers/$entity",
+ "odata.id": "Customers('ALFKI')",
+ "odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"",
+ "odata.editLink": "Customers('ALFKI')",
+ "Orders@odata.navigationLink": "Customers('ALFKI')/Orders",
+ "Orders@odata.associationLink": "Customers('ALFKI')/Orders/$ref",
+ "ID": "ALFKI",
+ "CompanyName": "Alfreds Futterkiste",
+ "ContactName": "Maria Anders",
+ "ContactTitle": "Sales Representative",
+ "Phone": "030-0074321",
+ "Fax": "030-0076545",
+ "Address": [ {
+ "Street": "Obere Str. 57",
+ "City": "Berlin",
+ "Region": null,
+ "PostalCode": "D-12209",
+ "Country@odata.navigationLink": "Customers('ALFKI')/Address/Country",
+ "Country@odata.associationLink":"Customers('ALFKI')/Address/Country/$ref"
+ }, {
+ "Street": "Musterstrasse 42",
+ "City": "Musterstadt",
+ "Region": "SomeRegion",
+ "PostalCode": "D-42042"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-client-core/src/test/resources/minimalEntity.json
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/resources/minimalEntity.json b/odata4-lib/odata4-client-core/src/test/resources/minimalEntity.json
new file mode 100644
index 0000000..abd9b9e
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/resources/minimalEntity.json
@@ -0,0 +1,16 @@
+{
+"odata.context": "http://host/service/$metadata#Customers/$entity", "odata.id": "Customers('ALFKI')",
+"odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"",
+"odata.editLink": "Customers('ALFKI')", "Orders@odata.navigationLink": "Customers('ALFKI')/Orders", "Orders@odata.associationLink": "Customers('ALFKI')/Orders/$ref", "ID": "ALFKI",
+"CompanyName": "Alfreds Futterkiste",
+"ContactName": "Maria Anders",
+"ContactTitle": "Sales Representative",
+"Phone": "030-0074321",
+"Fax": "030-0076545",
+"Address": {
+"Street": "Obere Str. 57",
+"City": "Berlin",
+"Region": null,
+"PostalCode": "D-12209",
+"Country@odata.navigationLink": "Customers('ALFKI')/Address/Country", "Country@odata.associationLink":"Customers('ALFKI')/Address/Country/$ref",
+} }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-client-core/src/test/resources/primitiveNullValue.json
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/resources/primitiveNullValue.json b/odata4-lib/odata4-client-core/src/test/resources/primitiveNullValue.json
new file mode 100644
index 0000000..5774413
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/resources/primitiveNullValue.json
@@ -0,0 +1,3 @@
+{
+ "NullValue" : null
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-client-core/src/test/resources/setOfComplexProperties.json
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/resources/setOfComplexProperties.json b/odata4-lib/odata4-client-core/src/test/resources/setOfComplexProperties.json
new file mode 100644
index 0000000..24ec160
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/resources/setOfComplexProperties.json
@@ -0,0 +1,13 @@
+{
+ "PhoneNumbers": [
+ {
+ "Number": "425-555-1212",
+ "Type": "Home"
+ }, {
+ "odata.type": "#Model.CellPhoneNumber",
+ "Number": "425-555-0178",
+ "Type": "Cell",
+ "Carrier": "Sprint"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-client-core/src/test/resources/setOfPrimitiveProperties.json
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/test/resources/setOfPrimitiveProperties.json b/odata4-lib/odata4-client-core/src/test/resources/setOfPrimitiveProperties.json
new file mode 100644
index 0000000..61b3d2c
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/test/resources/setOfPrimitiveProperties.json
@@ -0,0 +1,8 @@
+{
+ "odata.context": "http://host/service/$metadata#Customers/$entity",
+
+ "EmailAddresses": [
+ "Julie@Swansworth.com",
+ "Julie.Swansworth@work.com"
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-consumer-api/pom.xml
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/pom.xml b/odata4-lib/odata4-consumer-api/pom.xml
deleted file mode 100644
index d5beed7..0000000
--- a/odata4-lib/odata4-consumer-api/pom.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- 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
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>olingo-odata4-consumer-api-incubating</artifactId>
- <packaging>jar</packaging>
- <name>${project.artifactId}</name>
-
- <parent>
- <groupId>org.apache.olingo</groupId>
- <artifactId>olingo-odata4-lib-incubating</artifactId>
- <version>0.1.0-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>olingo-odata4-commons-api-incubating</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/ODataConsumer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/ODataConsumer.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/ODataConsumer.java
deleted file mode 100644
index abf6d30..0000000
--- a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/ODataConsumer.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * 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
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.consumer.api;
-
-import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
-
-//TODO: Exceptionhandling
-public abstract class ODataConsumer {
-
- private static final String IMPLEMENTATION = "org.apache.olingo.odata4.consumer.core.ODataConsumerImpl";
-
- public static ODataConsumer create() {
- ODataConsumer instance;
-
- try {
- final Class<?> clazz = Class.forName(ODataConsumer.IMPLEMENTATION);
-
- /*
- * We explicitly do not use the singleton pattern to keep the server state free
- * and avoid class loading issues also during hot deployment.
- */
- final Object object = clazz.newInstance();
- instance = (ODataConsumer) object;
-
- } catch (final Exception e) {
- throw new RuntimeException(e);
- }
- return instance;
- }
-
- public abstract Edm createEdm(EdmProvider provider);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/AnnotationProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/AnnotationProperty.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/AnnotationProperty.java
deleted file mode 100644
index 439066f..0000000
--- a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/AnnotationProperty.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * 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
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.consumer.api.deserializer;
-
-public interface AnnotationProperty extends Property {
- String getValue();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ComplexValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ComplexValue.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ComplexValue.java
deleted file mode 100644
index ab4455f..0000000
--- a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ComplexValue.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * 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
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.consumer.api.deserializer;
-
-import java.util.List;
-import java.util.Map;
-
-public interface ComplexValue extends Value {
-
- Value getValue(String name);
-
- List<Property> getProperties();
-
- Map<String, NavigationProperty> getNavigationProperties();
-
- Map<String, AnnotationProperty> getAnnotationProperties();
-
- Map<String, StructuralProperty> getStructuralProperties();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ConsumerException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ConsumerException.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ConsumerException.java
deleted file mode 100644
index def4636..0000000
--- a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ConsumerException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * 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
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.consumer.api.deserializer;
-
-public class ConsumerException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- public ConsumerException() {
- super();
- }
-
- public ConsumerException(final String message) {
- super(message);
- }
-
- public ConsumerException(final String message, final Throwable cause) {
- super(message, cause);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Entity.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Entity.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Entity.java
deleted file mode 100644
index 2d4c9b3..0000000
--- a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Entity.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * 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
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.consumer.api.deserializer;
-
-import java.util.List;
-import java.util.Map;
-
-public interface Entity {
-
- String getODataContext();
-
- String getODataMetaDataEtag();
-
- String getODataType();
-
- Long getODataCount();
-
- String getODataNextLink();
-
- String getODataDeltaLink();
-
- String getODataId();
-
- String getODataETag();
-
- String getODataEditLink();
-
- String getODataReadLink();
-
- List<Property> getProperties();
-
- Map<String, NavigationProperty> getNavigationProperties();
-
- Map<String, AnnotationProperty> getAnnotationProperties();
-
- Map<String, StructuralProperty> getStructuralProperties();
-
- Property getProperty(String name);
-
- <T extends Property> T getProperty(String name, Class<T> clazz);
-
- Object getPropertyContent(String name);
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/EntitySet.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/EntitySet.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/EntitySet.java
deleted file mode 100644
index 1efda67..0000000
--- a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/EntitySet.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * 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
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.consumer.api.deserializer;
-
-import java.util.List;
-
-public interface EntitySet extends Iterable<Entity> {
-
- String getODataContext();
-
- Long getODataCount();
-
- String getODataNextLink();
-
- String getODataDeltaLink();
-
- List<Entity> getEntities();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/NavigationProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/NavigationProperty.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/NavigationProperty.java
deleted file mode 100644
index 67067ea..0000000
--- a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/NavigationProperty.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * 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
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.consumer.api.deserializer;
-
-public interface NavigationProperty extends Property {
-
- public abstract String getAssociationLink();
-
- public abstract String getNavigationLink();
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Property.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Property.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Property.java
deleted file mode 100644
index 7092f72..0000000
--- a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Property.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * 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
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.consumer.api.deserializer;
-
-public interface Property {
- String getName();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Reader.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Reader.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Reader.java
deleted file mode 100644
index cf7b012..0000000
--- a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Reader.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * 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
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.consumer.api.deserializer;
-
-import java.io.InputStream;
-
-public interface Reader {
-
- public abstract EntitySet readEntitySet(InputStream in) throws ConsumerException;
-
- public abstract Entity readEntity(InputStream in) throws ConsumerException;
-
- public abstract Property readProperty(InputStream in) throws ConsumerException;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/StructuralProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/StructuralProperty.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/StructuralProperty.java
deleted file mode 100644
index 3cdc254..0000000
--- a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/StructuralProperty.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * 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
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.consumer.api.deserializer;
-
-import java.util.List;
-
-public interface StructuralProperty extends Property {
-
- boolean containsCollection();
-
- Value getValue();
-
- List<Value> getValues();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Value.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Value.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Value.java
deleted file mode 100644
index 7966c50..0000000
--- a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Value.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * 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
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.consumer.api.deserializer;
-
-public interface Value {
- boolean isComplex();
-
- Object getContent();
-
- <T> T getContentAs(T type);
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-consumer-core/pom.xml
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/pom.xml b/odata4-lib/odata4-consumer-core/pom.xml
deleted file mode 100644
index 7f11351..0000000
--- a/odata4-lib/odata4-consumer-core/pom.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- 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
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>olingo-odata4-consumer-core-incubating</artifactId>
- <packaging>jar</packaging>
- <name>${project.artifactId}</name>
-
- <parent>
- <groupId>org.apache.olingo</groupId>
- <artifactId>olingo-odata4-lib-incubating</artifactId>
- <version>0.1.0-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>olingo-odata4-consumer-api-incubating</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>olingo-odata4-commons-core-incubating</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/ODataConsumerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/ODataConsumerImpl.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/ODataConsumerImpl.java
deleted file mode 100644
index ec61bba..0000000
--- a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/ODataConsumerImpl.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * 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
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.consumer.core;
-
-import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
-import org.apache.olingo.odata4.commons.core.ODataCommonsCoreImpl;
-import org.apache.olingo.odata4.consumer.api.ODataConsumer;
-
-public class ODataConsumerImpl extends ODataConsumer {
-
- @Override
- public Edm createEdm(final EdmProvider provider) {
- return new ODataCommonsCoreImpl().createEdm(provider);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/AnnotationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/AnnotationPropertyImpl.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/AnnotationPropertyImpl.java
deleted file mode 100644
index f404f02..0000000
--- a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/AnnotationPropertyImpl.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * 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
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.consumer.core.deserializer;
-
-import org.apache.olingo.odata4.consumer.api.deserializer.AnnotationProperty;
-
-public class AnnotationPropertyImpl implements AnnotationProperty {
-
- private final String name;
- private final String value;
-
- public AnnotationPropertyImpl(final String name, final String value) {
- this.name = name;
- this.value = value;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getValue() {
- return value;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "AnnotationPropertyImpl [name=" + name + ", value=" + value + "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/c49ff803/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/ComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/ComplexValueImpl.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/ComplexValueImpl.java
deleted file mode 100644
index e50cecf..0000000
--- a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/ComplexValueImpl.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * 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
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ******************************************************************************/
-package org.apache.olingo.odata4.consumer.core.deserializer;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.olingo.odata4.consumer.api.deserializer.AnnotationProperty;
-import org.apache.olingo.odata4.consumer.api.deserializer.ComplexValue;
-import org.apache.olingo.odata4.consumer.api.deserializer.NavigationProperty;
-import org.apache.olingo.odata4.consumer.api.deserializer.StructuralProperty;
-import org.apache.olingo.odata4.consumer.api.deserializer.Value;
-
-public class ComplexValueImpl extends PropertyCollection implements ComplexValue {
-
- public ComplexValueImpl() {}
-
- public ComplexValueImpl(final Map<String, AnnotationProperty> annotationProperties,
- final Map<String, NavigationProperty> navigationProperties,
- final Map<String, StructuralProperty> structuralProperties) {
- super(annotationProperties, navigationProperties, structuralProperties);
- }
-
- @Override
- public Value getValue(final String name) {
- StructuralProperty property = structuralProperties.get(name);
- if (property == null) {
- return null;
- }
- return property.getValue();
- }
-
- @Override
- public Map<String, AnnotationProperty> getAnnotationProperties() {
- return Collections.unmodifiableMap(annotationProperties);
- }
-
- @Override
- public Map<String, NavigationProperty> getNavigationProperties() {
- return Collections.unmodifiableMap(navigationProperties);
- }
-
- @Override
- public boolean isComplex() {
- return true;
- }
-
- @Override
- public Map<String, StructuralProperty> getContent() {
- return Collections.unmodifiableMap(structuralProperties);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T> T getContentAs(final T type) {
- return (T) getContent();
- }
-
- @Override
- public String toString() {
- return "ComplexValueImpl [annotations=" + annotationProperties + ", navigationProperties=" + navigationProperties
- + ", properties=" + structuralProperties + "]";
- }
-}