You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/02/10 16:07:42 UTC

[01/35] git commit: [OLINGO-83] Added more javadoc

Updated Branches:
  refs/heads/master 7c281ff77 -> 16106f603


[OLINGO-83] Added more javadoc


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/f294302f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/f294302f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/f294302f

Branch: refs/heads/master
Commit: f294302fa84c9d88993f8af28c92f6b5967560c3
Parents: e4ebe86
Author: Michael Bolz <mi...@apache.org>
Authored: Wed Jan 8 14:33:03 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Mon Jan 13 15:10:21 2014 +0100

----------------------------------------------------------------------
 .../annotation/processor/api/package-info.java  | 25 ++++++++++++++++++
 .../odata2/api/annotation/edm/package-info.java | 27 ++++++++++++++++++++
 .../api/annotation/edmx/package-info.java       | 23 +++++++++++++++++
 3 files changed, 75 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/f294302f/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/package-info.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/package-info.java b/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/package-info.java
new file mode 100644
index 0000000..fd4dbcb
--- /dev/null
+++ b/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/package-info.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+/**
+ * <h1>Annotations-API for Entity Data Model definition</h1>
+ * <p>The core API package contains contains the AnnotationServiceFactory as entry point
+ * to an implementation (core) of the Annotations-API for Entity Data Model definition.</p>
+ */
+package org.apache.olingo.odata2.annotation.processor.api;
+

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/f294302f/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/package-info.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/package-info.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/package-info.java
new file mode 100644
index 0000000..4a11181
--- /dev/null
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/package-info.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+/**
+ * <h1>Annotations-API for Entity Data Model definition</h1>
+ * <p>The edm package contains all annotations necessary for definition
+ * of the Entity Data Model (as described in the OData protocol specification
+ * as well as in the Conceptual Schema Definition for the OData Protocol which
+ * both can be found at <a href="http://www.odata.org/">http://www.odata.org/</a>).</p>
+ */
+package org.apache.olingo.odata2.api.annotation.edm;
+

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/f294302f/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edmx/package-info.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edmx/package-info.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edmx/package-info.java
new file mode 100644
index 0000000..e836ab7
--- /dev/null
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edmx/package-info.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+/**
+ * The edmx package contains annotations necessary for EDMX definition.
+ */
+package org.apache.olingo.odata2.api.annotation.edmx;
+


[33/35] git commit: [OLINGO-117] Added JSON implementation

Posted by sk...@apache.org.
[OLINGO-117] Added JSON implementation


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/b6696a6d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/b6696a6d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/b6696a6d

Branch: refs/heads/master
Commit: b6696a6d9b386354788ff5b6e0361a18179c8bcb
Parents: 459a1b2
Author: Michael Bolz <mi...@apache.org>
Authored: Fri Jan 24 13:41:27 2014 +0100
Committer: Michael Bolz <mi...@apache.org>
Committed: Fri Jan 24 13:49:04 2014 +0100

----------------------------------------------------------------------
 .../odata2/core/ep/JsonEntityProvider.java      |   2 +-
 .../core/ep/consumer/JsonEntityConsumer.java    |   9 +-
 .../core/ep/consumer/JsonEntryConsumer.java     | 101 ++++++++--
 .../core/ep/consumer/JsonFeedConsumer.java      |  16 +-
 .../odata2/core/ep/feed/JsonFeedEntry.java      |  62 ++++++
 .../JsonDeletedEntryEntityProducer.java         |   3 +-
 .../olingo/odata2/core/ep/util/FormatJson.java  |   3 +
 .../olingo/odata2/core/ep/util/JsonUtils.java   |   4 +
 .../odata2/core/ep/ProviderFacadeImplTest.java  |  36 ++++
 .../core/ep/consumer/JsonFeedConsumerTest.java  | 196 ++++++++++++++++++-
 .../test/resources/JsonWithDeletedEntries.json  |  30 +++
 11 files changed, 441 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b6696a6d/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java
index 442e273..d8efe36 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java
@@ -338,7 +338,7 @@ public class JsonEntityProvider implements ContentTypeBasedEntityProvider {
   @Override
   public ODataDeltaFeed readDeltaFeed(final EdmEntitySet entitySet, final InputStream content,
       final EntityProviderReadProperties properties) throws EntityProviderException {
-    return null;
+    return new JsonEntityConsumer().readDeltaFeed(entitySet, content, properties);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b6696a6d/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntityConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntityConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntityConsumer.java
index 6824808..efbcbb9 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntityConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntityConsumer.java
@@ -30,6 +30,7 @@ import org.apache.olingo.odata2.api.edm.EdmProperty;
 import org.apache.olingo.odata2.api.ep.EntityProviderException;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.ep.feed.ODataDeltaFeed;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.core.ep.aggregator.EntityInfoAggregator;
 
@@ -76,6 +77,12 @@ public class JsonEntityConsumer {
 
   public ODataFeed readFeed(final EdmEntitySet entitySet, final InputStream content,
       final EntityProviderReadProperties readProperties) throws EntityProviderException {
+    return readDeltaFeed(entitySet, content, readProperties);
+  }
+
+  public ODataDeltaFeed readDeltaFeed(final EdmEntitySet entitySet, final InputStream content,
+      final EntityProviderReadProperties readProperties) throws EntityProviderException {
+
     JsonReader reader = null;
     EntityProviderException cachedException = null;
 
@@ -84,7 +91,7 @@ public class JsonEntityConsumer {
       reader = createJsonReader(content);
 
       JsonFeedConsumer jfc = new JsonFeedConsumer(reader, eia, readProperties);
-      ODataFeed result = jfc.readFeedStandalone();
+      ODataDeltaFeed result = jfc.readFeedStandalone();
 
       return result;
     } catch (UnsupportedEncodingException e) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b6696a6d/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java
index e1fe75f..9f452e4 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java
@@ -19,6 +19,7 @@
 package org.apache.olingo.odata2.core.ep.consumer;
 
 import java.io.IOException;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -26,8 +27,10 @@ import java.util.Map;
 import org.apache.olingo.odata2.api.edm.Edm;
 import org.apache.olingo.odata2.api.edm.EdmEntitySet;
 import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmLiteralKind;
 import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
 import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.edm.EdmSimpleTypeException;
 import org.apache.olingo.odata2.api.ep.EntityProviderException;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
 import org.apache.olingo.odata2.api.ep.callback.OnReadInlineContent;
@@ -36,12 +39,15 @@ import org.apache.olingo.odata2.api.ep.callback.ReadFeedResult;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.api.exception.ODataApplicationException;
+import org.apache.olingo.odata2.core.edm.EdmDateTimeOffset;
 import org.apache.olingo.odata2.core.ep.aggregator.EntityInfoAggregator;
 import org.apache.olingo.odata2.core.ep.aggregator.EntityPropertyInfo;
 import org.apache.olingo.odata2.core.ep.aggregator.NavigationPropertyInfo;
+import org.apache.olingo.odata2.core.ep.entry.DeletedEntryMetadataImpl;
 import org.apache.olingo.odata2.core.ep.entry.EntryMetadataImpl;
 import org.apache.olingo.odata2.core.ep.entry.MediaMetadataImpl;
 import org.apache.olingo.odata2.core.ep.entry.ODataEntryImpl;
+import org.apache.olingo.odata2.core.ep.feed.JsonFeedEntry;
 import org.apache.olingo.odata2.core.ep.util.FormatJson;
 import org.apache.olingo.odata2.core.uri.ExpandSelectTreeNodeImpl;
 
@@ -53,15 +59,18 @@ import com.google.gson.stream.JsonToken;
  */
 public class JsonEntryConsumer {
 
-  private final Map<String, Object> properties = new HashMap<String, Object>();
-  private final MediaMetadataImpl mediaMetadata = new MediaMetadataImpl();
-  private final EntryMetadataImpl entryMetadata = new EntryMetadataImpl();
-  private final ExpandSelectTreeNodeImpl expandSelectTree = new ExpandSelectTreeNodeImpl();
   private final Map<String, Object> typeMappings;
   private final EntityInfoAggregator eia;
   private final JsonReader reader;
   private final EntityProviderReadProperties readProperties;
-  private final ODataEntryImpl entryResult;
+
+  private ODataEntryImpl resultEntry;
+  private Map<String, Object> properties;
+  private MediaMetadataImpl mediaMetadata;
+  private EntryMetadataImpl entryMetadata;
+  private ExpandSelectTreeNodeImpl expandSelectTree;
+
+  private DeletedEntryMetadataImpl resultDeletedEntry;
 
   public JsonEntryConsumer(final JsonReader reader, final EntityInfoAggregator eia,
       final EntityProviderReadProperties readProperties) {
@@ -69,7 +78,6 @@ public class JsonEntryConsumer {
     this.eia = eia;
     this.readProperties = readProperties;
     this.reader = reader;
-    entryResult = new ODataEntryImpl(properties, mediaMetadata, entryMetadata, expandSelectTree);
   }
 
   public ODataEntry readSingleEntry() throws EntityProviderException {
@@ -101,14 +109,19 @@ public class JsonEntryConsumer {
           .getSimpleName()), e);
     }
 
-    return entryResult;
+    return resultEntry;
   }
 
-  public ODataEntry readFeedEntry() throws EdmException, EntityProviderException, IOException {
+  public JsonFeedEntry readFeedEntry() throws EdmException, EntityProviderException, IOException {
     reader.beginObject();
     readEntryContent();
     reader.endObject();
-    return entryResult;
+
+    if (resultDeletedEntry == null) {
+      return new JsonFeedEntry(resultEntry);
+    } else {
+      return new JsonFeedEntry(resultDeletedEntry);
+    }
   }
 
   private void readEntryContent() throws IOException, EdmException, EntityProviderException {
@@ -118,11 +131,41 @@ public class JsonEntryConsumer {
     }
   }
 
+  /**
+   * Ensure that instance field {@link #resultEntry} exists.
+   * If it not already exists create an instance (as well as all other necessary objects like:
+   * {@link #properties}, {@link #mediaMetadata}, {@link #entryMetadata}, {@link #expandSelectTree}).
+   */
+  private void ensureODataEntryExists() {
+    if (resultEntry == null) {
+      properties = new HashMap<String, Object>();
+      mediaMetadata = new MediaMetadataImpl();
+      entryMetadata = new EntryMetadataImpl();
+      expandSelectTree = new ExpandSelectTreeNodeImpl();
+
+      resultEntry = new ODataEntryImpl(properties, mediaMetadata, entryMetadata, expandSelectTree);
+    }
+  }
+
+  /**
+   * Ensure that instance field {@link #resultDeletedEntry} exists.
+   * If it not already exists create an instance.
+   */
+  private void ensureDeletedEntryMetadataExists() {
+    if (resultDeletedEntry == null) {
+      resultDeletedEntry = new DeletedEntryMetadataImpl();
+    }
+  }
+
   private void handleName(final String name) throws IOException, EdmException, EntityProviderException {
     if (FormatJson.METADATA.equals(name)) {
+      ensureODataEntryExists();
       readMetadata();
       validateMetadata();
+    } else if (FormatJson.ODATA_CONTEXT.equals(name)) {
+      readODataContext();
     } else {
+      ensureODataEntryExists();
       EntityPropertyInfo propertyInfo = eia.getPropertyInfo(name);
       if (propertyInfo != null) {
         JsonPropertyConsumer jpc = new JsonPropertyConsumer();
@@ -137,6 +180,38 @@ public class JsonEntryConsumer {
     }
   }
 
+  private void readODataContext() throws IOException, EntityProviderException {
+    String contextValue = reader.nextString();
+    if (contextValue == null) {
+      throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent(FormatJson.ODATA_CONTEXT)
+          .addContent(FormatJson.RESULTS));
+    }
+
+    if (contextValue.startsWith(FormatJson.DELTA_CONTEXT_PREFIX)
+        && contextValue.endsWith(FormatJson.DELTA_CONTEXT_POSTFIX)) {
+      while (reader.hasNext()) {
+        ensureDeletedEntryMetadataExists();
+        String name = reader.nextName();
+        String value = reader.nextString();
+        if (FormatJson.ID.equals(name)) {
+          resultDeletedEntry.setUri(value);
+        } else if (FormatJson.DELTA_WHEN.equals(name)) {
+          Date when = parseWhen(value);
+          resultDeletedEntry.setWhen(when);
+        }
+      }
+    }
+  }
+
+  private Date parseWhen(final String value) throws EntityProviderException {
+    try {
+      return EdmDateTimeOffset.getInstance().valueOfString(value, EdmLiteralKind.JSON, null, Date.class);
+    } catch (EdmSimpleTypeException e) {
+      throw new EntityProviderException(EntityProviderException.INVALID_DELETED_ENTRY_METADATA
+          .addContent("Unparsable format for when field value."));
+    }
+  }
+
   private void readMetadata() throws IOException, EdmException, EntityProviderException {
     String name = null;
     String value = null;
@@ -240,7 +315,7 @@ public class JsonEntryConsumer {
             updateExpandSelectTree(navigationPropertyName, feed);
             if (callback == null) {
               properties.put(navigationPropertyName, feed);
-              entryResult.setContainsInlineEntry(true);
+              resultEntry.setContainsInlineEntry(true);
             } else {
               ReadFeedResult result = new ReadFeedResult(inlineReadProperties, navigationProperty, feed);
               callback.handleReadFeed(result);
@@ -251,7 +326,7 @@ public class JsonEntryConsumer {
             updateExpandSelectTree(navigationPropertyName, entry);
             if (callback == null) {
               properties.put(navigationPropertyName, entry);
-              entryResult.setContainsInlineEntry(true);
+              resultEntry.setContainsInlineEntry(true);
             } else {
               ReadEntryResult result = new ReadEntryResult(inlineReadProperties, navigationProperty, entry);
               callback.handleReadEntry(result);
@@ -286,7 +361,7 @@ public class JsonEntryConsumer {
       updateExpandSelectTree(navigationPropertyName, feed);
       if (callback == null) {
         properties.put(navigationPropertyName, feed);
-        entryResult.setContainsInlineEntry(true);
+        resultEntry.setContainsInlineEntry(true);
       } else {
         ReadFeedResult result = new ReadFeedResult(inlineReadProperties, navigationProperty, feed);
         try {
@@ -321,7 +396,7 @@ public class JsonEntryConsumer {
     handleName(name);
     // consume the rest of the entry content
     readEntryContent();
-    return entryResult;
+    return resultEntry;
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b6696a6d/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java
index 856eb1f..f607286 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java
@@ -25,10 +25,13 @@ import java.util.List;
 import org.apache.olingo.odata2.api.edm.EdmException;
 import org.apache.olingo.odata2.api.ep.EntityProviderException;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
+import org.apache.olingo.odata2.api.ep.entry.DeletedEntryMetadata;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.ep.feed.ODataDeltaFeed;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.core.ep.aggregator.EntityInfoAggregator;
 import org.apache.olingo.odata2.core.ep.feed.FeedMetadataImpl;
+import org.apache.olingo.odata2.core.ep.feed.JsonFeedEntry;
 import org.apache.olingo.odata2.core.ep.feed.ODataDeltaFeedImpl;
 import org.apache.olingo.odata2.core.ep.util.FormatJson;
 
@@ -43,6 +46,7 @@ public class JsonFeedConsumer {
   private JsonReader reader;
   private EntityInfoAggregator eia;
   private EntityProviderReadProperties readProperties;
+  private List<DeletedEntryMetadata> deletedEntries = new ArrayList<DeletedEntryMetadata>();
   private List<ODataEntry> entries = new ArrayList<ODataEntry>();
   private FeedMetadataImpl feedMetadata = new FeedMetadataImpl();
   private boolean resultsArrayPresent = false;
@@ -54,7 +58,7 @@ public class JsonFeedConsumer {
     this.readProperties = readProperties;
   }
 
-  public ODataFeed readFeedStandalone() throws EntityProviderException {
+  public ODataDeltaFeed readFeedStandalone() throws EntityProviderException {
     try {
       readFeed();
 
@@ -74,7 +78,7 @@ public class JsonFeedConsumer {
       throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
           .getSimpleName()), e);
     }
-    return new ODataDeltaFeedImpl(entries, feedMetadata);
+    return new ODataDeltaFeedImpl(entries, feedMetadata, deletedEntries);
   }
 
   private void readFeed() throws IOException, EdmException, EntityProviderException {
@@ -145,8 +149,12 @@ public class JsonFeedConsumer {
   private void readArrayContent() throws IOException, EdmException, EntityProviderException {
     reader.beginArray();
     while (reader.hasNext()) {
-      final ODataEntry entry = new JsonEntryConsumer(reader, eia, readProperties).readFeedEntry();
-      entries.add(entry);
+      final JsonFeedEntry entry = new JsonEntryConsumer(reader, eia, readProperties).readFeedEntry();
+      if (entry.isODataEntry()) {
+        entries.add(entry.getODataEntry());
+      } else {
+        deletedEntries.add(entry.getDeletedEntryMetadata());
+      }
     }
     reader.endArray();
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b6696a6d/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/JsonFeedEntry.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/JsonFeedEntry.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/JsonFeedEntry.java
new file mode 100644
index 0000000..8b963c2
--- /dev/null
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/JsonFeedEntry.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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.odata2.core.ep.feed;
+
+import org.apache.olingo.odata2.api.ep.entry.DeletedEntryMetadata;
+import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+
+/**
+ * Simple wrapper for {@link ODataEntry} or {@link DeletedEntryMetadata} object.
+ * Currently used in Json consumer (Entry and Feed).
+ */
+public class JsonFeedEntry {
+  private final ODataEntry oDataEntry;
+  private final DeletedEntryMetadata deletedEntryMetadata;
+
+  public JsonFeedEntry(final ODataEntry entry) {
+    oDataEntry = entry;
+    deletedEntryMetadata = null;
+  }
+
+  public JsonFeedEntry(final DeletedEntryMetadata entry) {
+    deletedEntryMetadata = entry;
+    oDataEntry = null;
+  }
+
+  public boolean isODataEntry() {
+    return oDataEntry != null;
+  }
+
+  public ODataEntry getODataEntry() {
+    return oDataEntry;
+  }
+
+  public boolean isDeletedEntry() {
+    return deletedEntryMetadata != null;
+  }
+
+  public DeletedEntryMetadata getDeletedEntryMetadata() {
+    return deletedEntryMetadata;
+  }
+
+  @Override
+  public String toString() {
+    return "JsonFeedEntry [oDataEntry=" + oDataEntry + ", deletedEntryMetadata=" + deletedEntryMetadata + "]";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b6696a6d/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
index 598f710..872159f 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
@@ -28,6 +28,7 @@ import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
 import org.apache.olingo.odata2.core.ep.aggregator.EntityInfoAggregator;
 import org.apache.olingo.odata2.core.ep.util.FormatJson;
 import org.apache.olingo.odata2.core.ep.util.JsonStreamWriter;
+import org.apache.olingo.odata2.core.ep.util.JsonUtils;
 
 public class JsonDeletedEntryEntityProducer {
 
@@ -48,7 +49,7 @@ public class JsonDeletedEntryEntityProducer {
         for (Map<String, Object> deletedEntry : deletedEntries) {
           jsonStreamWriter.beginObject();
 
-          String odataContextValue = "$metadata#" + entityInfo.getEntitySetName() + "/$deletedEntity";
+          String odataContextValue = JsonUtils.createODataContextValueForTombstone(entityInfo.getEntitySetName());
           String selfLink = AtomEntryEntityProducer.createSelfLink(entityInfo, deletedEntry, null);
           String idValue = properties.getServiceRoot().toASCIIString() + selfLink;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b6696a6d/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/FormatJson.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/FormatJson.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/FormatJson.java
index 4d108b7..f1010c0 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/FormatJson.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/FormatJson.java
@@ -51,4 +51,7 @@ public class FormatJson {
   public static final String INNER_ERROR = "innererror";
   public static final String DELTA = "__delta";
   public static final String ODATA_CONTEXT = "@odata.context";
+  public static final String DELTA_CONTEXT_PREFIX = "$metadata#";
+  public static final String DELTA_CONTEXT_POSTFIX = "/$deletedEntity";
+  public static final String DELTA_WHEN = "when";
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b6696a6d/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/JsonUtils.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/JsonUtils.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/JsonUtils.java
index 41c2eac..c98aa75 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/JsonUtils.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/JsonUtils.java
@@ -27,6 +27,10 @@ import com.google.gson.stream.JsonToken;
 
 public class JsonUtils {
 
+  public static String createODataContextValueForTombstone(final String entitySetName) {
+    return FormatJson.DELTA_CONTEXT_PREFIX + entitySetName + FormatJson.DELTA_CONTEXT_POSTFIX;
+  }
+
   public static int startJson(final JsonReader reader) throws EntityProviderException {
     // The enclosing "d" and "results" are optional - so we cannot check for the presence
     // but we have to read over them in case they are present.

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b6696a6d/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImplTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImplTest.java
index 2c3c800..434d43d 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImplTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImplTest.java
@@ -34,6 +34,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import junit.framework.Assert;
+
 import org.apache.olingo.odata2.api.commons.HttpContentType;
 import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
 import org.apache.olingo.odata2.api.edm.Edm;
@@ -43,6 +45,7 @@ import org.apache.olingo.odata2.api.edm.EdmLiteralKind;
 import org.apache.olingo.odata2.api.edm.EdmProperty;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
 import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
+import org.apache.olingo.odata2.api.ep.entry.DeletedEntryMetadata;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
 import org.apache.olingo.odata2.api.ep.feed.ODataDeltaFeed;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
@@ -156,6 +159,39 @@ public class ProviderFacadeImplTest extends AbstractConsumerTest {
   }
 
   @Test
+  public void readDeltaFeedJson() throws Exception {
+
+    final String contentType = ContentType.APPLICATION_JSON.toContentTypeString();
+    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
+    InputStream content = getFileAsStream("JsonWithDeletedEntries.json");
+    EntityProviderReadProperties properties = EntityProviderReadProperties.init().build();
+
+    ODataDeltaFeed deltaFeed = new ProviderFacadeImpl().readDeltaFeed(contentType, entitySet, content, properties);
+    assertNotNull(deltaFeed);
+    assertNotNull(deltaFeed.getEntries());
+    assertNotNull(deltaFeed.getFeedMetadata());
+    assertEquals(1, deltaFeed.getEntries().size());
+    assertEquals("http://localhost:8080/ReferenceScenario.svc/Rooms?!deltatoken=4711",
+        deltaFeed.getFeedMetadata().getDeltaLink());
+
+    assertEquals(2, deltaFeed.getDeletedEntries().size());
+    List<DeletedEntryMetadata> deletedEntries = deltaFeed.getDeletedEntries();
+    assertEquals(2, deletedEntries.size());
+    for (DeletedEntryMetadata deletedEntry : deletedEntries) {
+      String uri = deletedEntry.getUri();
+      if (uri.contains("Rooms('4')")) {
+        assertEquals("http://host:80/service/Rooms('4')", deletedEntry.getUri());
+        assertEquals(new Date(3509636760000l), deletedEntry.getWhen());
+      } else if (uri.contains("Rooms('3')")) {
+        assertEquals("http://host:80/service/Rooms('3')", deletedEntry.getUri());
+        assertEquals(new Date(1300561560000l), deletedEntry.getWhen());
+      } else {
+        Assert.fail("Found unknown DeletedEntry with value: " + deletedEntry);
+      }
+    }
+  }
+
+  @Test
   public void readPropertyValue() throws Exception {
     final EdmProperty property =
         (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EntryDate");

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b6696a6d/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumerTest.java
index 1e8999f..3d9201c 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumerTest.java
@@ -23,14 +23,19 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
 import java.io.InputStream;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
+import junit.framework.Assert;
+
 import org.apache.olingo.odata2.api.edm.EdmEntitySet;
 import org.apache.olingo.odata2.api.ep.EntityProviderException;
+import org.apache.olingo.odata2.api.ep.entry.DeletedEntryMetadata;
 import org.apache.olingo.odata2.api.ep.entry.MediaMetadata;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
 import org.apache.olingo.odata2.api.ep.feed.FeedMetadata;
+import org.apache.olingo.odata2.api.ep.feed.ODataDeltaFeed;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.testutil.mock.MockFacade;
 import org.junit.Test;
@@ -328,11 +333,200 @@ public class JsonFeedConsumerTest extends AbstractConsumerTest {
     assertEquals("deltalink", feedMetadata.getDeltaLink());
   }
 
+  @Test
+  public void feedWithTeamAndNextAndDelta() throws Exception {
+    EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
+    String content =
+        "{\"d\":{\"results\":[{" +
+            "\"__metadata\":{\"id\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')\"," +
+            "\"uri\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')\",\"type\":\"RefScenario.Team\"}," +
+            "\"Id\":\"1\",\"Name\":\"Team 1\",\"isScrumTeam\":false,\"nt_Employees\":{\"__deferred\":{" +
+            "\"uri\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')/nt_Employees\"}}}]," +
+            "\"__next\":\"Rooms?$skiptoken=98\"," +
+            "\"__delta\":\"http://localhost:8080/ReferenceScenario.svc/Teams?!deltatoken=4711\"}}";
+    assertNotNull(content);
+    InputStream contentBody = createContentAsStream(content);
+
+    // execute
+    JsonEntityConsumer xec = new JsonEntityConsumer();
+    ODataFeed feed = xec.readFeed(entitySet, contentBody, DEFAULT_PROPERTIES);
+    assertNotNull(feed);
+
+    List<ODataEntry> entries = feed.getEntries();
+    assertNotNull(entries);
+    assertEquals(1, entries.size());
+
+    FeedMetadata feedMetadata = feed.getFeedMetadata();
+    assertNotNull(feedMetadata);
+    assertEquals("Rooms?$skiptoken=98", feedMetadata.getNextLink());
+    assertEquals("http://localhost:8080/ReferenceScenario.svc/Teams?!deltatoken=4711", feedMetadata.getDeltaLink());
+  }
+
+  @Test
+  public void feedWithTeamAndDeltaAndDeletedEntriesWithoutWhen() throws Exception {
+    EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
+    String content =
+        "{\"d\":{\"results\":[{" +
+            "\"__metadata\":{\"id\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')\"," +
+            "\"uri\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')\",\"type\":\"RefScenario.Team\"}," +
+            "\"Id\":\"1\",\"Name\":\"Team 1\",\"isScrumTeam\":false,\"nt_Employees\":{\"__deferred\":{" +
+            "\"uri\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')/nt_Employees\"}}}" +
+            ",{ \"@odata.context\":\"$metadata#Teams/$deletedEntity\",\"id\":\"/Teams('2')\"}" +
+            "]," +
+            "\"__delta\":\"http://localhost:8080/ReferenceScenario.svc/Teams?!deltatoken=4711\"}}";
+    assertNotNull(content);
+    InputStream contentBody = createContentAsStream(content);
+
+    // execute
+    JsonEntityConsumer xec = new JsonEntityConsumer();
+    ODataDeltaFeed feed = xec.readDeltaFeed(entitySet, contentBody, DEFAULT_PROPERTIES);
+    assertNotNull(feed);
+
+    List<ODataEntry> entries = feed.getEntries();
+    assertNotNull(entries);
+    assertEquals(1, entries.size());
+
+    FeedMetadata feedMetadata = feed.getFeedMetadata();
+    assertNotNull(feedMetadata);
+    assertEquals("http://localhost:8080/ReferenceScenario.svc/Teams?!deltatoken=4711", feedMetadata.getDeltaLink());
+
+    List<DeletedEntryMetadata> deletedEntries = feed.getDeletedEntries();
+    assertEquals(1, deletedEntries.size());
+    assertEquals("/Teams('2')", deletedEntries.get(0).getUri());
+    assertNull(deletedEntries.get(0).getWhen());
+  }
+
+  @Test
+  public void feedWithTeamAndDeltaAndDeletedEntries() throws Exception {
+    EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
+    String content =
+        "{\"d\":{\"results\":[{" +
+            "\"__metadata\":{\"id\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')\"," +
+            "\"uri\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')\",\"type\":\"RefScenario.Team\"}," +
+            "\"Id\":\"1\",\"Name\":\"Team 1\",\"isScrumTeam\":false,\"nt_Employees\":{\"__deferred\":{" +
+            "\"uri\":\"http://localhost:8080/ReferenceScenario.svc/Teams('1')/nt_Employees\"}}}" +
+            ",{ \"@odata.context\":\"$metadata#Teams/$deletedEntity\"," +
+            "\"id\":\"/Teams('2')\"," +
+            "\"when\":\"\\/Date(1297187419617)\\/\" }" +
+            "]," +
+            "\"__delta\":\"http://localhost:8080/ReferenceScenario.svc/Teams?!deltatoken=4711\"}}";
+    assertNotNull(content);
+    InputStream contentBody = createContentAsStream(content);
+
+    // execute
+    JsonEntityConsumer xec = new JsonEntityConsumer();
+    ODataDeltaFeed feed = xec.readDeltaFeed(entitySet, contentBody, DEFAULT_PROPERTIES);
+    assertNotNull(feed);
+
+    List<ODataEntry> entries = feed.getEntries();
+    assertNotNull(entries);
+    assertEquals(1, entries.size());
+
+    FeedMetadata feedMetadata = feed.getFeedMetadata();
+    assertNotNull(feedMetadata);
+    assertEquals("http://localhost:8080/ReferenceScenario.svc/Teams?!deltatoken=4711", feedMetadata.getDeltaLink());
+
+    List<DeletedEntryMetadata> deletedEntries = feed.getDeletedEntries();
+    assertEquals(1, deletedEntries.size());
+    assertEquals("/Teams('2')", deletedEntries.get(0).getUri());
+    assertEquals(new Date(1297187419617l), deletedEntries.get(0).getWhen());
+  }
+
+  @Test
+  public void feedWithOnlyDeletedEntries() throws Exception {
+    EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
+    String content =
+        "{\"d\":{\"results\":[" +
+            "{ \"@odata.context\":\"$metadata#Teams/$deletedEntity\"," +
+            "\"id\":\"/Teams('2')\"," +
+            "\"when\":\"\\/Date(1297187419617)\\/\" }" +
+            "]," +
+            "\"__delta\":\"http://localhost:8080/ReferenceScenario.svc/Teams?!deltatoken=4711\"}}";
+    assertNotNull(content);
+    InputStream contentBody = createContentAsStream(content);
+
+    // execute
+    JsonEntityConsumer xec = new JsonEntityConsumer();
+    ODataDeltaFeed feed = xec.readDeltaFeed(entitySet, contentBody, DEFAULT_PROPERTIES);
+    assertNotNull(feed);
+
+    List<ODataEntry> entries = feed.getEntries();
+    assertNotNull(entries);
+    assertEquals(0, entries.size());
+
+    FeedMetadata feedMetadata = feed.getFeedMetadata();
+    assertNotNull(feedMetadata);
+    assertEquals("http://localhost:8080/ReferenceScenario.svc/Teams?!deltatoken=4711", feedMetadata.getDeltaLink());
+
+    List<DeletedEntryMetadata> deletedEntries = feed.getDeletedEntries();
+    assertEquals(1, deletedEntries.size());
+    assertEquals("/Teams('2')", deletedEntries.get(0).getUri());
+    assertEquals(new Date(1297187419617l), deletedEntries.get(0).getWhen());
+  }
+
+  @Test(expected = EntityProviderException.class)
+  public void feedWithInvalidDeletedEntryWhenValue() throws Exception {
+    EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
+    String content =
+        "{\"d\":{\"results\":[" +
+            "{ \"@odata.context\":\"$metadata#Teams/$deletedEntity\"," +
+            "\"id\":\"/Teams('2')\"," +
+            "\"when\":\"1297187419617\" }" +
+            "]," +
+            "\"__delta\":\"http://localhost:8080/ReferenceScenario.svc/Teams?!deltatoken=4711\"}}";
+    assertNotNull(content);
+    InputStream contentBody = createContentAsStream(content);
+
+    // execute
+    JsonEntityConsumer xec = new JsonEntityConsumer();
+    try {
+      xec.readDeltaFeed(entitySet, contentBody, DEFAULT_PROPERTIES);
+    } catch (EntityProviderException e) {
+      assertEquals(EntityProviderException.INVALID_DELETED_ENTRY_METADATA, e.getMessageReference());
+      throw e;
+    }
+  }
+
+  @Test
+  public void feedWithRoomAndDeltaAndDeletedEntries() throws Exception {
+    EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
+    String content = readFile("JsonWithDeletedEntries.json");
+    assertNotNull(content);
+    InputStream contentBody = createContentAsStream(content);
+
+    // execute
+    JsonEntityConsumer xec = new JsonEntityConsumer();
+    ODataDeltaFeed feed = xec.readDeltaFeed(entitySet, contentBody, DEFAULT_PROPERTIES);
+    assertNotNull(feed);
+
+    List<ODataEntry> entries = feed.getEntries();
+    assertNotNull(entries);
+    assertEquals(1, entries.size());
+
+    FeedMetadata feedMetadata = feed.getFeedMetadata();
+    assertNotNull(feedMetadata);
+    assertEquals("http://localhost:8080/ReferenceScenario.svc/Rooms?!deltatoken=4711", feedMetadata.getDeltaLink());
+
+    List<DeletedEntryMetadata> deletedEntries = feed.getDeletedEntries();
+    assertEquals(2, deletedEntries.size());
+    for (DeletedEntryMetadata deletedEntry : deletedEntries) {
+      String uri = deletedEntry.getUri();
+      if (uri.contains("Rooms('4')")) {
+        assertEquals("http://host:80/service/Rooms('4')", deletedEntry.getUri());
+        assertEquals(new Date(3509636760000l), deletedEntry.getWhen());
+      } else if (uri.contains("Rooms('3')")) {
+        assertEquals("http://host:80/service/Rooms('3')", deletedEntry.getUri());
+        assertEquals(new Date(1300561560000l), deletedEntry.getWhen());
+      } else {
+        Assert.fail("Found unknown DeletedEntry with value: " + deletedEntry);
+      }
+    }
+  }
+
   private void checkMediaDataInitial(final MediaMetadata mediaMetadata) {
     assertNull(mediaMetadata.getContentType());
     assertNull(mediaMetadata.getEditLink());
     assertNull(mediaMetadata.getEtag());
     assertNull(mediaMetadata.getSourceLink());
   }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/b6696a6d/odata2-lib/odata-core/src/test/resources/JsonWithDeletedEntries.json
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/resources/JsonWithDeletedEntries.json b/odata2-lib/odata-core/src/test/resources/JsonWithDeletedEntries.json
new file mode 100644
index 0000000..00eabe3
--- /dev/null
+++ b/odata2-lib/odata-core/src/test/resources/JsonWithDeletedEntries.json
@@ -0,0 +1,30 @@
+{
+"d": {
+"results": [
+  {
+    "__metadata": 
+        { 
+            "id": "http://ldcigmd.wdf.sap.corp:50055/sap/bc/odata/Rooms('1')", 
+            "uri": "http://ldcigmd.wdf.sap.corp:50055/sap/bc/odata/Rooms('1')", 
+            "type": "RefScenario.Room", 
+           "etag":"W/\"2\""
+        },
+    "Id": "1",
+    "Name": "Room 1",
+    "Seats": 1,
+    "Version": 1
+  },
+     {
+        "@odata.context":"$metadata#Rooms/$deletedEntity",
+        "id":"http://host:80/service/Rooms('3')",
+        "when":"\/Date(1300561560000)\/"
+     },
+     {
+        "@odata.context":"$metadata#Rooms/$deletedEntity",
+        "id":"http://host:80/service/Rooms('4')",
+        "when":"\/Date(3509636760000)\/"
+     }
+],
+"__delta":"http://localhost:8080/ReferenceScenario.svc/Rooms?!deltatoken=4711"
+}
+}
\ No newline at end of file


[26/35] git commit: [OLINGO-117] refactoring

Posted by sk...@apache.org.
[OLINGO-117] refactoring


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/6774b95a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/6774b95a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/6774b95a

Branch: refs/heads/master
Commit: 6774b95ae9091b61cbef90891142ea564af8f7ca
Parents: 38539fe
Author: Stephan Klevenz <sk...@apache.org>
Authored: Thu Jan 23 16:23:41 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Thu Jan 23 17:21:31 2014 +0100

----------------------------------------------------------------------
 .../olingo/odata2/api/ep/EntityProvider.java    |  37 ++++++-
 .../odata2/api/ep/EntityProviderException.java  |   3 +
 .../api/ep/entry/DeletedEntryMetadata.java      |  42 ++++++++
 .../odata2/api/ep/feed/ODataDeltaFeed.java      |  36 +++++++
 .../olingo/odata2/api/ep/feed/ODataFeed.java    |  15 ---
 .../odata2/core/ep/AtomEntityProvider.java      |   7 ++
 .../core/ep/ContentTypeBasedEntityProvider.java |   4 +
 .../odata2/core/ep/JsonEntityProvider.java      |   7 ++
 .../odata2/core/ep/ProviderFacadeImpl.java      |   7 ++
 .../core/ep/consumer/JsonFeedConsumer.java      |   8 +-
 .../core/ep/consumer/XmlEntityConsumer.java     |   4 +-
 .../core/ep/consumer/XmlEntryConsumer.java      |   4 +-
 .../core/ep/consumer/XmlFeedConsumer.java       | 101 +++++++++++--------
 .../core/ep/entry/DeletedEntryMetadataImpl.java |  30 ++++++
 .../odata2/core/ep/feed/ODataDeltaFeedImpl.java |  60 +++++++++++
 .../odata2/core/ep/feed/ODataFeedImpl.java      |  67 ------------
 .../src/main/resources/i18n.properties          |   1 +
 .../odata2/core/ep/ProviderFacadeImplTest.java  |  47 ++++++++-
 .../core/ep/consumer/XmlFeedConsumerTest.java   |  20 ++--
 .../fit/client/ClientDeltaResponseTest.java     |  56 +++++-----
 .../olingo/odata2/fit/client/util/Client.java   |  23 ++++-
 21 files changed, 406 insertions(+), 173 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProvider.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProvider.java b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProvider.java
index c37a8bc..447df31 100644
--- a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProvider.java
+++ b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProvider.java
@@ -33,6 +33,7 @@ import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
 import org.apache.olingo.odata2.api.edm.EdmProperty;
 import org.apache.olingo.odata2.api.edm.provider.Schema;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.ep.feed.ODataDeltaFeed;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.api.processor.ODataErrorContext;
 import org.apache.olingo.odata2.api.processor.ODataResponse;
@@ -229,7 +230,7 @@ public final class EntityProvider {
      * Read (de-serialize) a data feed from <code>content</code> (as {@link InputStream}) in specified format (given as
      * <code>contentType</code>)
      * based on <code>entity data model</code> (given as {@link EdmEntitySet}) and provide this data as
-     * {@link ODataEntry}.
+     * {@link ODataFeed}.
      * 
      * @param contentType format of content in the given input stream.
      * @param entitySet entity data model for entity set to be read
@@ -242,6 +243,22 @@ public final class EntityProvider {
         EntityProviderReadProperties properties) throws EntityProviderException;
 
     /**
+     * Read (de-serialize) a delta data feed from <code>content</code> (as {@link InputStream}) in specified format
+     * (given as <code>contentType</code>)
+     * based on <code>entity data model</code> (given as {@link EdmEntitySet}) and provide this data as
+     * {@link ODataDeltaFeed}.
+     * 
+     * @param contentType format of content in the given input stream.
+     * @param entitySet entity data model for entity set to be read
+     * @param content delta feed data in form of an {@link InputStream} which contains the data in specified format
+     * @param properties additional properties necessary for reading content from {@link InputStream} into {@link Map}.
+     * @return an {@link ODataDeltaFeed} object
+     * @throws EntityProviderException if reading of data (de-serialization) fails
+     */
+    ODataDeltaFeed readDeltaFeed(String contentType, EdmEntitySet entitySet, InputStream content,
+        EntityProviderReadProperties properties) throws EntityProviderException;
+
+    /**
      * Reads (de-serializes) data from <code>content</code> (as {@link InputStream})
      * in specified format (given as <code>contentType</code>) based on
      * <code>entity data model</code> (given as {@link EdmEntitySet})
@@ -634,6 +651,24 @@ public final class EntityProvider {
   }
 
   /**
+   * Read (de-serialize) a delta data feed from <code>content</code> (as {@link InputStream}) in specified format
+   * (given as <code>contentType</code>) based on <code>entity data model</code> (given as {@link EdmEntitySet}) and
+   * provide this data as {@link ODataEntry} .
+   * 
+   * @param contentType format of content in the given input stream.
+   * @param entitySet entity data model for entity set to be read
+   * @param content feed data in form of an {@link InputStream} which contains the data in specified format
+   * @param properties additional properties necessary for reading content from {@link InputStream} into {@link Map}.
+   * Must not be null.
+   * @return an {@link ODataDeltaFeed} object
+   * @throws EntityProviderException if reading of data (de-serialization) fails
+   */
+  public static ODataDeltaFeed readDeltaFeed(String contentType, EdmEntitySet entitySet, InputStream content,
+      EntityProviderReadProperties properties) throws EntityProviderException {
+    return createEntityProvider().readDeltaFeed(contentType, entitySet, content, properties);
+  }
+
+  /**
    * Read (de-serialize) data from <code>content</code> (as {@link InputStream}) in specified format (given as
    * <code>contentType</code>)
    * based on <code>entity data model</code> (given as {@link EdmEntitySet}) and provide this data as {@link ODataEntry}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderException.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderException.java b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderException.java
index a2ddc91..9054372 100644
--- a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderException.java
+++ b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProviderException.java
@@ -99,6 +99,9 @@ public class EntityProviderException extends ODataMessageException {
   public static final MessageReference MISSING_RESULTS_ARRAY = createMessageReference(EntityProviderException.class,
       "MISSING_RESULTS_ARRAY");
 
+  public static final MessageReference INVALID_DELETED_ENTRY_METADATA = createMessageReference(
+      EntityProviderException.class, "INVALID_DELETED_ENTRY_METADATA");
+
   public EntityProviderException(final MessageReference messageReference) {
     super(messageReference);
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/DeletedEntryMetadata.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/DeletedEntryMetadata.java b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/DeletedEntryMetadata.java
new file mode 100644
index 0000000..be5601e
--- /dev/null
+++ b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/DeletedEntryMetadata.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.odata2.api.ep.entry;
+
+import java.util.Date;
+
+/**
+ * Metadata of a deleted feed entry as defined in Atom Tombstone extension (RFC6721) or Json proprietary format.
+ */
+public interface DeletedEntryMetadata {
+
+  /**
+   * Gets the URI of this deleted entry.
+   * 
+   * @return the URI
+   */
+  String getUri();
+
+  /**
+   * Gets the date when this entry was deleted.
+   * 
+   * @return the when date
+   */
+  Date getWhen();
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataDeltaFeed.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataDeltaFeed.java b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataDeltaFeed.java
new file mode 100644
index 0000000..c068772
--- /dev/null
+++ b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataDeltaFeed.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.odata2.api.ep.feed;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.ep.entry.DeletedEntryMetadata;
+
+public interface ODataDeltaFeed extends ODataFeed {
+
+  /**
+   * Delta responses can contain changed feed data and deleted entries metadata. A delta response it the result of
+   * a delta link. If the feed is not a delta feed then the list of deleted entries is null.
+   * @return metadata of deleted entries in case of feed is result of a delta response or null 
+   */
+  public List<DeletedEntryMetadata> getDeletedEntries();
+
+
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java
index ee7ff88..9b98ec9 100644
--- a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java
+++ b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java
@@ -20,7 +20,6 @@ package org.apache.olingo.odata2.api.ep.feed;
 
 import java.util.List;
 
-import org.apache.olingo.odata2.api.ep.entry.EntryMetadata;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
 
 /**
@@ -41,18 +40,4 @@ public interface ODataFeed {
    */
   public FeedMetadata getFeedMetadata();
 
-  /**
-   * Delta responses can contain changed feed data and deleted entries metadata. A delta response it the result of
-   * a delta link.
-   * @return true in case of feed is result of a delta response (contains changed feed entries and deleted entries)
-   */
-  public boolean isDeltaFeed();
-
-  /**
-   * Delta responses can contain changed feed data and deleted entries metadata. A delta response it the result of
-   * a delta link. If the feed is not a delta feed then the list of deleted entries is null.
-   * @return metadata of deleted entries in case of feed is result of a delta response or null 
-   */
-  public List<EntryMetadata> getDeletedEntries();
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/AtomEntityProvider.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/AtomEntityProvider.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/AtomEntityProvider.java
index 9f67d2f..c0e88d1 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/AtomEntityProvider.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/AtomEntityProvider.java
@@ -44,6 +44,7 @@ import org.apache.olingo.odata2.api.ep.EntityProviderException;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
 import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.ep.feed.ODataDeltaFeed;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.api.processor.ODataResponse;
 import org.apache.olingo.odata2.api.processor.ODataResponse.ODataResponseBuilder;
@@ -358,6 +359,12 @@ public class AtomEntityProvider implements ContentTypeBasedEntityProvider {
   @Override
   public ODataFeed readFeed(final EdmEntitySet entitySet, final InputStream content,
       final EntityProviderReadProperties properties) throws EntityProviderException {
+    return readDeltaFeed(entitySet, content, properties);
+  }
+
+  @Override
+  public ODataDeltaFeed readDeltaFeed(EdmEntitySet entitySet, InputStream content,
+      EntityProviderReadProperties properties) throws EntityProviderException {
     XmlEntityConsumer xec = new XmlEntityConsumer();
     return xec.readFeed(entitySet, content, properties);
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/ContentTypeBasedEntityProvider.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/ContentTypeBasedEntityProvider.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/ContentTypeBasedEntityProvider.java
index 3ae1958..75adf9e 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/ContentTypeBasedEntityProvider.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/ContentTypeBasedEntityProvider.java
@@ -32,6 +32,7 @@ import org.apache.olingo.odata2.api.ep.EntityProviderException;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
 import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.ep.feed.ODataDeltaFeed;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.api.processor.ODataResponse;
 import org.apache.olingo.odata2.api.servicedocument.ServiceDocument;
@@ -80,4 +81,7 @@ public interface ContentTypeBasedEntityProvider {
       String innerError);
 
   ServiceDocument readServiceDocument(InputStream serviceDocument) throws EntityProviderException;
+
+  ODataDeltaFeed readDeltaFeed(EdmEntitySet entitySet, InputStream content, EntityProviderReadProperties properties)
+      throws EntityProviderException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java
index c008e2f..8f11653 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java
@@ -41,6 +41,7 @@ import org.apache.olingo.odata2.api.ep.EntityProviderException;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
 import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.ep.feed.ODataDeltaFeed;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.api.processor.ODataResponse;
 import org.apache.olingo.odata2.api.processor.ODataResponse.ODataResponseBuilder;
@@ -334,4 +335,10 @@ public class JsonEntityProvider implements ContentTypeBasedEntityProvider {
     return new JsonServiceDocumentConsumer().parseJson(serviceDocument);
   }
 
+  @Override
+  public ODataDeltaFeed readDeltaFeed(EdmEntitySet entitySet, InputStream content,
+      EntityProviderReadProperties properties) throws EntityProviderException {
+    return null;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImpl.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImpl.java
index 9793115..f1f250e 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImpl.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImpl.java
@@ -39,6 +39,7 @@ import org.apache.olingo.odata2.api.ep.EntityProviderException;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
 import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.ep.feed.ODataDeltaFeed;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.api.exception.ODataNotAcceptableException;
 import org.apache.olingo.odata2.api.processor.ODataErrorContext;
@@ -160,6 +161,12 @@ public class ProviderFacadeImpl implements EntityProviderInterface {
   }
 
   @Override
+  public ODataDeltaFeed readDeltaFeed(String contentType, EdmEntitySet entitySet, InputStream content,
+      EntityProviderReadProperties properties)  throws EntityProviderException {
+    return create(contentType).readDeltaFeed(entitySet, content, properties);
+  }
+  
+  @Override
   public ODataEntry readEntry(final String contentType, final EdmEntitySet entitySet, final InputStream content,
       final EntityProviderReadProperties properties) throws EntityProviderException {
     return create(contentType).readEntry(entitySet, content, properties);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java
index d0ec1e1..856eb1f 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java
@@ -29,7 +29,7 @@ import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.core.ep.aggregator.EntityInfoAggregator;
 import org.apache.olingo.odata2.core.ep.feed.FeedMetadataImpl;
-import org.apache.olingo.odata2.core.ep.feed.ODataFeedImpl;
+import org.apache.olingo.odata2.core.ep.feed.ODataDeltaFeedImpl;
 import org.apache.olingo.odata2.core.ep.util.FormatJson;
 
 import com.google.gson.stream.JsonReader;
@@ -74,7 +74,7 @@ public class JsonFeedConsumer {
       throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
           .getSimpleName()), e);
     }
-    return new ODataFeedImpl(entries, feedMetadata);
+    return new ODataDeltaFeedImpl(entries, feedMetadata);
   }
 
   private void readFeed() throws IOException, EdmException, EntityProviderException {
@@ -176,12 +176,12 @@ public class JsonFeedConsumer {
     handleName(name);
     // consume the rest of the entry content
     readFeedContent();
-    return new ODataFeedImpl(entries, feedMetadata);
+    return new ODataDeltaFeedImpl(entries, feedMetadata);
   }
 
   protected ODataFeed readInlineFeedStandalone() throws EdmException, EntityProviderException, IOException {
     readFeed();
-    return new ODataFeedImpl(entries, feedMetadata);
+    return new ODataDeltaFeedImpl(entries, feedMetadata);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumer.java
index 25e51ed..c7fca98 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntityConsumer.java
@@ -33,7 +33,7 @@ import org.apache.olingo.odata2.api.ep.EntityProviderException;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties.EntityProviderReadPropertiesBuilder;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
-import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
+import org.apache.olingo.odata2.api.ep.feed.ODataDeltaFeed;
 import org.apache.olingo.odata2.core.commons.XmlHelper;
 import org.apache.olingo.odata2.core.ep.aggregator.EntityInfoAggregator;
 
@@ -48,7 +48,7 @@ public class XmlEntityConsumer {
     super();
   }
 
-  public ODataFeed readFeed(final EdmEntitySet entitySet, final InputStream content,
+  public ODataDeltaFeed readFeed(final EdmEntitySet entitySet, final InputStream content,
       final EntityProviderReadProperties properties) throws EntityProviderException {
     XMLStreamReader reader = null;
     EntityProviderException cachedException = null;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java
index 7a987f9..d464b1f 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlEntryConsumer.java
@@ -52,7 +52,7 @@ import org.apache.olingo.odata2.core.ep.entry.EntryMetadataImpl;
 import org.apache.olingo.odata2.core.ep.entry.MediaMetadataImpl;
 import org.apache.olingo.odata2.core.ep.entry.ODataEntryImpl;
 import org.apache.olingo.odata2.core.ep.feed.FeedMetadataImpl;
-import org.apache.olingo.odata2.core.ep.feed.ODataFeedImpl;
+import org.apache.olingo.odata2.core.ep.feed.ODataDeltaFeedImpl;
 import org.apache.olingo.odata2.core.ep.util.FormatXml;
 import org.apache.olingo.odata2.core.uri.ExpandSelectTreeNodeImpl;
 
@@ -376,7 +376,7 @@ public class XmlEntryConsumer {
   private Object extractODataEntity(final boolean isFeed, final List<ODataEntry> inlineEntries) {
     if (isFeed) {
       // TODO: fill metadata correctly with inline count and inline next link. Both are currently ignored.
-      return new ODataFeedImpl(inlineEntries, new FeedMetadataImpl());
+      return new ODataDeltaFeedImpl(inlineEntries, new FeedMetadataImpl());
     } else if (!inlineEntries.isEmpty()) {
       return inlineEntries.get(0);
     }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java
index b5902f4..4ad55b6 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java
@@ -19,6 +19,7 @@
 package org.apache.olingo.odata2.core.ep.consumer;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -28,15 +29,18 @@ import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmLiteralKind;
+import org.apache.olingo.odata2.api.edm.EdmSimpleTypeException;
 import org.apache.olingo.odata2.api.ep.EntityProviderException;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
-import org.apache.olingo.odata2.api.ep.entry.EntryMetadata;
+import org.apache.olingo.odata2.api.ep.entry.DeletedEntryMetadata;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
-import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
+import org.apache.olingo.odata2.api.ep.feed.ODataDeltaFeed;
+import org.apache.olingo.odata2.core.edm.EdmDateTimeOffset;
 import org.apache.olingo.odata2.core.ep.aggregator.EntityInfoAggregator;
-import org.apache.olingo.odata2.core.ep.entry.EntryMetadataImpl;
+import org.apache.olingo.odata2.core.ep.entry.DeletedEntryMetadataImpl;
 import org.apache.olingo.odata2.core.ep.feed.FeedMetadataImpl;
-import org.apache.olingo.odata2.core.ep.feed.ODataFeedImpl;
+import org.apache.olingo.odata2.core.ep.feed.ODataDeltaFeedImpl;
 import org.apache.olingo.odata2.core.ep.util.FormatXml;
 
 /**
@@ -55,10 +59,10 @@ public class XmlFeedConsumer {
    * @param reader
    * @param eia
    * @param readProperties
-   * @return {@link ODataFeed} object
+   * @return {@link ODataDeltaFeed} object
    * @throws EntityProviderException
    */
-  public ODataFeed readFeed(final XMLStreamReader reader, final EntityInfoAggregator eia,
+  public ODataDeltaFeed readFeed(final XMLStreamReader reader, final EntityInfoAggregator eia,
       final EntityProviderReadProperties readProperties) throws EntityProviderException {
     try {
       // read xml tag
@@ -83,7 +87,7 @@ public class XmlFeedConsumer {
 
   /**
    * Read all feed specific data (like <code>inline count</code> and <code>next link</code>) as well as all feed entries
-   * (<code>entry</code>).
+   * (<code>entry</code>) and delta feed extensions (tombstones).
    * 
    * @param reader xml stream reader with xml content to be read
    * @param eia entity infos for validation and mapping
@@ -93,54 +97,27 @@ public class XmlFeedConsumer {
    * @throws XMLStreamException if malformed xml is read in stream
    * @throws EntityProviderException if xml contains invalid data (based on odata specification and edm definition)
    */
-  private ODataFeed readFeedData(final XMLStreamReader reader, final EntityInfoAggregator eia,
+  private ODataDeltaFeed readFeedData(final XMLStreamReader reader, final EntityInfoAggregator eia,
       final EntityProviderReadProperties entryReadProperties) throws XMLStreamException, EntityProviderException {
     FeedMetadataImpl metadata = new FeedMetadataImpl();
     XmlEntryConsumer xec = new XmlEntryConsumer();
     List<ODataEntry> results = new ArrayList<ODataEntry>();
-    List<EntryMetadata> deletedEntries = null;
-
-    boolean isDeltaFeed = false;
-    String tombstonePrefix = reader.getNamespaceContext().getPrefix(FormatXml.ATOM_TOMBSTONE_NAMESPACE);
-    if (tombstonePrefix != null) {
-      isDeltaFeed = true;
-      deletedEntries = new ArrayList<EntryMetadata>();
-    }
+    List<DeletedEntryMetadata> deletedEntries = new ArrayList<DeletedEntryMetadata>();
 
     while (reader.hasNext() && !isFeedEndTag(reader)) {
       if (FormatXml.ATOM_ENTRY.equals(reader.getLocalName())) {
         ODataEntry entry = xec.readEntry(reader, eia, entryReadProperties);
         results.add(entry);
       } else if (FormatXml.ATOM_TOMBSTONE_DELETED_ENTRY.equals(reader.getLocalName())) {
-        EntryMetadataImpl deletedEntryMetadata = new EntryMetadataImpl();
-        
-        String uri = reader.getAttributeValue(FormatXml.ATOM_TOMBSTONE_NAMESPACE, FormatXml.ATOM_TOMBSTONE_REF);
-        String date = reader.getAttributeValue(FormatXml.ATOM_TOMBSTONE_NAMESPACE, FormatXml.ATOM_TOMBSTONE_WHEN);
-        String id = uri;
-        
-        reader.nextTag();
-        
-        deletedEntryMetadata.setUri(uri);
-        deletedEntryMetadata.setId(id);
-        
+        reader.require(XMLStreamConstants.START_ELEMENT, FormatXml.ATOM_TOMBSTONE_NAMESPACE,
+            FormatXml.ATOM_TOMBSTONE_DELETED_ENTRY);
+
+        DeletedEntryMetadataImpl deletedEntryMetadata = readDeletedEntryMetadata(reader);
         deletedEntries.add(deletedEntryMetadata);
+        reader.next();
       } else if (FormatXml.M_COUNT.equals(reader.getLocalName())) {
         reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_M_2007_08, FormatXml.M_COUNT);
-
-        String inlineCountString = reader.getElementText();
-        if (inlineCountString != null) {
-          try {
-            int inlineCountNumber = Integer.valueOf(inlineCountString);
-            if (inlineCountNumber >= 0) {
-              metadata.setInlineCount(inlineCountNumber);
-            } else {
-              throw new EntityProviderException(EntityProviderException.INLINECOUNT_INVALID
-                  .addContent(inlineCountNumber));
-            }
-          } catch (NumberFormatException e) {
-            throw new EntityProviderException(EntityProviderException.INLINECOUNT_INVALID.addContent(""), e);
-          }
-        }
+        readInlineCount(reader, metadata);
       } else if (FormatXml.ATOM_LINK.equals(reader.getLocalName())) {
         reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_ATOM_2005, FormatXml.ATOM_LINK);
 
@@ -152,14 +129,50 @@ public class XmlFeedConsumer {
           final String uri = reader.getAttributeValue(null, FormatXml.ATOM_HREF);
           metadata.setDeltaLink(uri);
         }
-
         reader.next();
       } else {
         reader.next();
       }
       readTillNextStartTag(reader);
     }
-    return new ODataFeedImpl(results, metadata, isDeltaFeed, deletedEntries);
+    return new ODataDeltaFeedImpl(results, metadata, deletedEntries);
+  }
+
+  private DeletedEntryMetadataImpl readDeletedEntryMetadata(final XMLStreamReader reader)
+      throws EntityProviderException, XMLStreamException {
+    try {
+      DeletedEntryMetadataImpl deletedEntryMetadata = new DeletedEntryMetadataImpl();
+
+      String uri = reader.getAttributeValue(null, FormatXml.ATOM_TOMBSTONE_REF);
+      String whenStr = reader.getAttributeValue(null, FormatXml.ATOM_TOMBSTONE_WHEN);
+      Date when;
+      when = EdmDateTimeOffset.getInstance().valueOfString(whenStr, EdmLiteralKind.DEFAULT, null,
+          Date.class);
+
+      deletedEntryMetadata.setUri(uri);
+      deletedEntryMetadata.setWhen(when);
+      return deletedEntryMetadata;
+    } catch (EdmSimpleTypeException e) {
+      throw new EntityProviderException(EntityProviderException.INVALID_DELETED_ENTRY_METADATA);
+    }
+  }
+
+  private void readInlineCount(final XMLStreamReader reader, FeedMetadataImpl metadata) throws XMLStreamException,
+      EntityProviderException {
+    String inlineCountString = reader.getElementText();
+    if (inlineCountString != null) {
+      try {
+        int inlineCountNumber = Integer.valueOf(inlineCountString);
+        if (inlineCountNumber >= 0) {
+          metadata.setInlineCount(inlineCountNumber);
+        } else {
+          throw new EntityProviderException(EntityProviderException.INLINECOUNT_INVALID
+              .addContent(inlineCountNumber));
+        }
+      } catch (NumberFormatException e) {
+        throw new EntityProviderException(EntityProviderException.INLINECOUNT_INVALID.addContent(""), e);
+      }
+    }
   }
 
   private void readTillNextStartTag(final XMLStreamReader reader) throws XMLStreamException {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/entry/DeletedEntryMetadataImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/entry/DeletedEntryMetadataImpl.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/entry/DeletedEntryMetadataImpl.java
new file mode 100644
index 0000000..8fc2cce
--- /dev/null
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/entry/DeletedEntryMetadataImpl.java
@@ -0,0 +1,30 @@
+package org.apache.olingo.odata2.core.ep.entry;
+
+import java.util.Date;
+
+import org.apache.olingo.odata2.api.ep.entry.DeletedEntryMetadata;
+
+public class DeletedEntryMetadataImpl implements DeletedEntryMetadata {
+
+  private String uri;
+  private Date when;
+  
+  @Override
+  public String getUri() {
+    return uri;
+  }
+
+  @Override
+  public Date getWhen() {
+    return when;
+  }
+
+  public void setUri(String uri) {
+    this.uri = uri;
+  }
+
+  public void setWhen(Date when) {
+    this.when = when;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataDeltaFeedImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataDeltaFeedImpl.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataDeltaFeedImpl.java
new file mode 100644
index 0000000..1ffa765
--- /dev/null
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataDeltaFeedImpl.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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.odata2.core.ep.feed;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.ep.entry.DeletedEntryMetadata;
+import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.ep.feed.FeedMetadata;
+import org.apache.olingo.odata2.api.ep.feed.ODataDeltaFeed;
+
+public class ODataDeltaFeedImpl implements ODataDeltaFeed {
+
+  private final List<ODataEntry> entries;
+  private final FeedMetadata feedMetadata;
+  private final List<DeletedEntryMetadata> deletedEntries;
+
+  public ODataDeltaFeedImpl(final List<ODataEntry> entries, final FeedMetadata feedMetadata) {
+    this(entries, feedMetadata, null);
+  }
+
+  public ODataDeltaFeedImpl(final List<ODataEntry> entries, final FeedMetadata feedMetadata,
+      List<DeletedEntryMetadata> deletedEntries) {
+    this.entries = entries;
+    this.feedMetadata = feedMetadata;
+    this.deletedEntries = deletedEntries;
+  }
+
+  @Override
+  public List<ODataEntry> getEntries() {
+    return entries;
+  }
+
+  @Override
+  public FeedMetadata getFeedMetadata() {
+    return feedMetadata;
+  }
+
+  @Override
+  public List<DeletedEntryMetadata> getDeletedEntries() {
+    return deletedEntries;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataFeedImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataFeedImpl.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataFeedImpl.java
deleted file mode 100644
index c81890a..0000000
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataFeedImpl.java
+++ /dev/null
@@ -1,67 +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.odata2.core.ep.feed;
-
-import java.util.List;
-
-import org.apache.olingo.odata2.api.ep.entry.EntryMetadata;
-import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
-import org.apache.olingo.odata2.api.ep.feed.FeedMetadata;
-import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
-
-public class ODataFeedImpl implements ODataFeed {
-
-  private final List<ODataEntry> entries;
-  private final FeedMetadata feedMetadata;
-  private boolean isDeltaFeed = false;
-  private List<EntryMetadata> deletedEntries = null;
-
-  public ODataFeedImpl(final List<ODataEntry> entries, final FeedMetadata feedMetadata) {
-    this.entries = entries;
-    this.feedMetadata = feedMetadata;
-  }
-
-  public ODataFeedImpl(final List<ODataEntry> entries, final FeedMetadata feedMetadata, boolean isDeltaFeed,
-      List<EntryMetadata> deletedEntries) {
-    this(entries, feedMetadata);
-    this.isDeltaFeed = isDeltaFeed;
-    this.deletedEntries = deletedEntries;
-  }
-
-  @Override
-  public List<ODataEntry> getEntries() {
-    return entries;
-  }
-
-  @Override
-  public FeedMetadata getFeedMetadata() {
-    return feedMetadata;
-  }
-
-  @Override
-  public boolean isDeltaFeed() {
-    return isDeltaFeed;
-  }
-
-  @Override
-  public List<EntryMetadata> getDeletedEntries() {
-    return deletedEntries;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-core/src/main/resources/i18n.properties
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/resources/i18n.properties b/odata2-lib/odata-core/src/main/resources/i18n.properties
index 08c08a1..b640790 100644
--- a/odata2-lib/odata-core/src/main/resources/i18n.properties
+++ b/odata2-lib/odata-core/src/main/resources/i18n.properties
@@ -111,6 +111,7 @@ org.apache.olingo.odata2.api.ep.EntityProviderException.EXPANDNOTSUPPORTED=Expan
 org.apache.olingo.odata2.api.ep.EntityProviderException.MEDIA_DATA_NOT_INITIAL=Resource is not a media resource but media metadata was provided.
 org.apache.olingo.odata2.api.ep.EntityProviderException.END_DOCUMENT_EXPECTED=End of document expected but was '%1$s'.
 org.apache.olingo.odata2.api.ep.EntityProviderException.MISSING_RESULTS_ARRAY=Mandatory results array not found.
+org.apache.olingo.odata2.api.ep.EntityProviderException.INVALID_DELETED_ENTRY_METADATA=Invalid delete entry data format (Atom XML Tombstone or Json) 
 
 ##################################
 # BatchParserexceptions

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImplTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImplTest.java
index 10db170..53b48bd 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImplTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImplTest.java
@@ -29,6 +29,7 @@ import java.io.InputStream;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -38,20 +39,27 @@ import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
 import org.apache.olingo.odata2.api.edm.Edm;
 import org.apache.olingo.odata2.api.edm.EdmEntitySet;
 import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata2.api.edm.EdmLiteralKind;
 import org.apache.olingo.odata2.api.edm.EdmProperty;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
 import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.ep.feed.ODataDeltaFeed;
+import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.api.processor.ODataResponse;
 import org.apache.olingo.odata2.core.commons.ContentType;
+import org.apache.olingo.odata2.core.edm.EdmDateTimeOffset;
+import org.apache.olingo.odata2.core.ep.consumer.AbstractConsumerTest;
 import org.apache.olingo.odata2.testutil.helper.StringHelper;
 import org.apache.olingo.odata2.testutil.mock.MockFacade;
+import org.junit.Ignore;
 import org.junit.Test;
 
 /**
  *  
  */
-public class ProviderFacadeImplTest {
+@Ignore
+public class ProviderFacadeImplTest extends AbstractConsumerTest {
 
   private static final String EMPLOYEE_1_XML =
       "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
@@ -92,6 +100,43 @@ public class ProviderFacadeImplTest {
           "</entry>";
 
   @Test
+  public void readDeltaFeed() throws Exception {
+
+    final String contentType = ContentType.APPLICATION_ATOM_XML_FEED.toContentTypeString();
+    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
+    InputStream content = getFileAsStream("feed_with_deleted_entries.xml");
+    EntityProviderReadProperties properties = EntityProviderReadProperties.init().build();
+
+    ODataDeltaFeed deltaFeed = new ProviderFacadeImpl().readDeltaFeed(contentType, entitySet, content, properties);
+    assertNotNull(deltaFeed);
+    assertNotNull(deltaFeed.getEntries());
+    assertNotNull(deltaFeed.getFeedMetadata());
+    assertEquals(1, deltaFeed.getEntries().size());
+    assertEquals(1, deltaFeed.getDeletedEntries().size());
+    assertEquals("http://host:123/odata/Rooms?$skiptoken=97", deltaFeed.getFeedMetadata().getDeltaLink());
+    assertEquals("http://host:123/odata/Rooms('2')", deltaFeed.getDeletedEntries().get(0).getUri());
+
+    Date when =
+        EdmDateTimeOffset.getInstance().valueOfString("2014-01-14T18:11:06.682+01:00", EdmLiteralKind.DEFAULT, null,
+            Date.class);
+    assertEquals(when, deltaFeed.getDeletedEntries().get(0).getWhen());
+  }
+
+  @Test
+  public void readFeed() throws Exception {
+    final String contentType = ContentType.APPLICATION_ATOM_XML_FEED.toContentTypeString();
+    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
+    InputStream content = getFileAsStream("feed_employees.xml");
+    EntityProviderReadProperties properties = EntityProviderReadProperties.init().build();
+
+    ODataFeed feed = new ProviderFacadeImpl().readFeed(contentType, entitySet, content, properties);
+    assertNotNull(feed);
+    assertNotNull(feed.getEntries());
+    assertNotNull(feed.getFeedMetadata());
+    assertEquals(6, feed.getEntries().size());
+  }
+
+  @Test
   public void readEntry() throws Exception {
     final String contentType = ContentType.APPLICATION_ATOM_XML_ENTRY.toContentTypeString();
     final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java
index a05c377..acd9f2e 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java
@@ -19,7 +19,7 @@
 package org.apache.olingo.odata2.core.ep.consumer;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
 
 import java.io.InputStream;
 
@@ -30,6 +30,7 @@ import org.apache.olingo.odata2.api.ep.EntityProvider;
 import org.apache.olingo.odata2.api.ep.EntityProviderException;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
 import org.apache.olingo.odata2.api.ep.feed.FeedMetadata;
+import org.apache.olingo.odata2.api.ep.feed.ODataDeltaFeed;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.testutil.mock.MockFacade;
 import org.junit.Test;
@@ -50,8 +51,6 @@ public class XmlFeedConsumerTest extends AbstractXmlConsumerTest {
             .getEntitySet(
                 "Employees"), file, DEFAULT_PROPERTIES);
     assertNotNull(feed);
-    assertFalse(feed.isDeltaFeed());
-    assertNull(feed.getDeletedEntries());
 
     FeedMetadata feedMetadata = feed.getFeedMetadata();
     assertNotNull(feedMetadata);
@@ -73,8 +72,6 @@ public class XmlFeedConsumerTest extends AbstractXmlConsumerTest {
 
     ODataFeed feed = xec.readFeed(entitySet, reqContent, consumerProperties);
     assertNotNull(feed);
-    assertFalse(feed.isDeltaFeed());
-    assertNull(feed.getDeletedEntries());
 
     FeedMetadata feedMetadata = feed.getFeedMetadata();
     assertNotNull(feedMetadata);
@@ -146,15 +143,14 @@ public class XmlFeedConsumerTest extends AbstractXmlConsumerTest {
     XmlEntityConsumer xec = new XmlEntityConsumer();
     EntityProviderReadProperties consumerProperties = EntityProviderReadProperties.init().build();
 
-    ODataFeed feed = xec.readFeed(entitySet, reqContent, consumerProperties);
+    ODataDeltaFeed deltaFeed = xec.readFeed(entitySet, reqContent, consumerProperties);
     
-    assertNotNull(feed);
-    assertTrue(feed.isDeltaFeed());
+    assertNotNull(deltaFeed);
     
-    assertNotNull(feed.getDeletedEntries());
-    assertNotNull(feed.getEntries());
+    assertNotNull(deltaFeed.getDeletedEntries());
+    assertNotNull(deltaFeed.getEntries());
     
-    assertEquals(1, feed.getEntries().size());
-    assertEquals(1, feed.getDeletedEntries().size());
+    assertEquals(1, deltaFeed.getEntries().size());
+    assertEquals(1, deltaFeed.getDeletedEntries().size());
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
index 43111fd..a02a12b 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
@@ -1,9 +1,7 @@
 package org.apache.olingo.odata2.fit.client;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -20,13 +18,14 @@ import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
 import org.apache.olingo.odata2.api.ep.EntityProvider;
 import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
 import org.apache.olingo.odata2.api.ep.callback.TombstoneCallback;
-import org.apache.olingo.odata2.api.ep.entry.EntryMetadata;
+import org.apache.olingo.odata2.api.ep.callback.TombstoneCallbackResult;
+import org.apache.olingo.odata2.api.ep.entry.DeletedEntryMetadata;
+import org.apache.olingo.odata2.api.ep.feed.ODataDeltaFeed;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.api.exception.ODataException;
 import org.apache.olingo.odata2.api.processor.ODataResponse;
 import org.apache.olingo.odata2.api.processor.ODataSingleProcessor;
 import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
-import org.apache.olingo.odata2.core.ep.producer.TombstoneCallbackImpl;
 import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
 import org.apache.olingo.odata2.core.processor.ODataSingleProcessorService;
 import org.apache.olingo.odata2.fit.client.util.Client;
@@ -160,26 +159,19 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
     assertNotNull(feed);
     assertEquals(2, feed.getEntries().size());
     assertEquals(getEndpoint().toASCIIString() + "Rooms?" + DELTATOKEN_1234, feed.getFeedMetadata().getDeltaLink());
-    assertFalse(feed.isDeltaFeed());
 
-    URI uri = new URI(deltaLink);
-    String query = uri.getQuery();
-    ODataFeed deltaFeed = client.readFeed("Container1", "Rooms", contentType, query);
+    ODataDeltaFeed deltaFeed = client.readDeltaFeed("Container1", "Rooms", contentType, deltaLink);
 
     assertNotNull(deltaFeed);
     assertEquals(2, deltaFeed.getEntries().size());
-    assertEquals(uri.toASCIIString(), deltaFeed.getFeedMetadata().getDeltaLink());
+    assertEquals(deltaLink, deltaFeed.getFeedMetadata().getDeltaLink());
 
-    assertTrue(deltaFeed.isDeltaFeed());
-    List<EntryMetadata> deletedEntries = deltaFeed.getDeletedEntries();
+    List<DeletedEntryMetadata> deletedEntries = deltaFeed.getDeletedEntries();
     assertNotNull(deletedEntries);
     assertEquals(2, deletedEntries.size());
 
-    assertEquals("3", deletedEntries.get(0).getId());
-    assertEquals("uri3", deletedEntries.get(0).getUri());
-
-    assertEquals("4", deletedEntries.get(1).getId());
-    assertEquals("uri4", deletedEntries.get(1).getUri());
+    assertEquals("http://localhost:19000/abc/ClientDeltaResponseTest/Rooms('3')", deletedEntries.get(0).getUri());
+    assertEquals("http://localhost:19000/abc/ClientDeltaResponseTest/Rooms('4')", deletedEntries.get(1).getUri());
   }
 
   private void testDeltaFeedWithZeroEntries(String contentType) throws Exception {
@@ -192,18 +184,14 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
     assertNotNull(feed);
     assertEquals(0, feed.getEntries().size());
     assertEquals(getEndpoint().toASCIIString() + "Rooms?" + DELTATOKEN_1234, feed.getFeedMetadata().getDeltaLink());
-    assertFalse(feed.isDeltaFeed());
 
-    URI uri = new URI(deltaLink);
-    String query = uri.getQuery();
-    ODataFeed deltaFeed = client.readFeed("Container1", "Rooms", contentType, query);
+    ODataDeltaFeed deltaFeed = client.readDeltaFeed("Container1", "Rooms", contentType, deltaLink);
 
     assertNotNull(deltaFeed);
     assertEquals(0, deltaFeed.getEntries().size());
-    assertEquals(uri.toASCIIString(), deltaFeed.getFeedMetadata().getDeltaLink());
+    assertEquals(deltaLink, deltaFeed.getFeedMetadata().getDeltaLink());
 
-    assertTrue(deltaFeed.isDeltaFeed());
-    List<EntryMetadata> deletedEntries = deltaFeed.getDeletedEntries();
+    List<DeletedEntryMetadata> deletedEntries = deltaFeed.getDeletedEntries();
     assertNotNull(deletedEntries);
     assertEquals(0, deletedEntries.size());
   }
@@ -214,6 +202,7 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
   }
 
   @Test
+  @Ignore
   public void testFeedWithDeltaLinkJson() throws Exception {
     testDeltaFeedWithDeltaLink("application/json");
   }
@@ -224,8 +213,29 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
   }
 
   @Test
+  @Ignore
   public void testFeedWithZeroEntriesJson() throws Exception {
     testDeltaFeedWithZeroEntries("application/json");
   }
 
+  static public class TombstoneCallbackImpl implements TombstoneCallback {
+
+    private ArrayList<Map<String, Object>> deletedEntriesData;
+    private String deltaLink = null;
+
+    public TombstoneCallbackImpl(final ArrayList<Map<String, Object>> deletedEntriesData, final String deltaLink) {
+      this.deletedEntriesData = deletedEntriesData;
+      this.deltaLink = deltaLink;
+    }
+
+    @Override
+    public TombstoneCallbackResult getTombstoneCallbackResult() {
+      TombstoneCallbackResult result = new TombstoneCallbackResult();
+      result.setDeletedEntriesData(deletedEntriesData);
+      result.setDeltaLink(deltaLink);
+      return result;
+    }
+
+  }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/6774b95a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
index bf682b5..55b6fef 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
@@ -15,6 +15,7 @@ import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
 import org.apache.olingo.odata2.api.edm.EdmEntitySetInfo;
 import org.apache.olingo.odata2.api.ep.EntityProvider;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
+import org.apache.olingo.odata2.api.ep.feed.ODataDeltaFeed;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.api.exception.ODataException;
 
@@ -122,10 +123,10 @@ public class Client {
         EntityProviderReadProperties.init().build());
   }
 
-  private HttpURLConnection connect(String relativeUri, String query, String contentType, String httpMethod)
+  private HttpURLConnection connect(String absoluteUri, String contentType, String httpMethod)
       throws IOException,
       HttpException {
-    URL url = new URL(serviceUrl + relativeUri + (query != null ? "?" + query : ""));
+    URL url = new URL(absoluteUri);
     HttpURLConnection connection;
     if (useProxy) {
       Proxy proxy = new Proxy(protocol, new InetSocketAddress(this.proxy, port));
@@ -148,4 +149,22 @@ public class Client {
 
     return connection;
   }
+
+  private HttpURLConnection connect(String relativeUri, String query, String contentType, String httpMethod)
+      throws IOException,
+      HttpException {
+    URL url = new URL(serviceUrl + relativeUri + (query != null ? "?" + query : ""));
+    return connect(url.toString(), contentType, httpMethod);
+  }
+
+  public ODataDeltaFeed
+      readDeltaFeed(String entityContainerName, String entitySetName, String contentType, String deltaLink)
+          throws IOException, ODataException, HttpException {
+
+    EdmEntityContainer entityContainer = edm.getEntityContainer(entityContainerName);
+
+    InputStream content = (InputStream) connect(deltaLink, contentType, "GET").getContent();
+    return EntityProvider.readDeltaFeed(contentType, entityContainer.getEntitySet(entitySetName), content,
+        EntityProviderReadProperties.init().build());
+  }
 }
\ No newline at end of file


[32/35] git commit: [OLINGO-117] refactor unit tests

Posted by sk...@apache.org.
[OLINGO-117] refactor unit tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/459a1b25
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/459a1b25
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/459a1b25

Branch: refs/heads/master
Commit: 459a1b254819a44a9bfdaacc123b6f256625e081
Parents: 567103a
Author: Stephan Klevenz <sk...@apache.org>
Authored: Fri Jan 24 09:25:14 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Fri Jan 24 09:25:14 2014 +0100

----------------------------------------------------------------------
 .../apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java  | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/459a1b25/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
index 1b939be..c3ab652 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
@@ -192,8 +192,7 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
     assertNotNull(deletedEntries);
     assertEquals(deletedRoomDataCount, deletedEntries.size());
 
-    for (int i = 0; i < deletedRoomDataCount; i++)
-    {
+    for (int i = 0; i < deletedRoomDataCount; i++) {
       assertEquals("http://localhost:19000/abc/ClientDeltaResponseTest/Rooms('" + (roomDataCount + i + 1) + "')",
           deletedEntries.get(i).getUri());
       assertNotNull(deletedEntries.get(i).getWhen());


[13/35] git commit: [OLINGO-116] Added fix

Posted by sk...@apache.org.
[OLINGO-116] Added fix


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/58b61188
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/58b61188
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/58b61188

Branch: refs/heads/master
Commit: 58b6118864ac329daf5487c5fa67a9ac2815f1f7
Parents: ae15d1d
Author: Michael Bolz <mi...@apache.org>
Authored: Mon Jan 13 13:48:54 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Tue Jan 14 12:24:44 2014 +0100

----------------------------------------------------------------------
 .../processor/core/util/ClassHelper.java        | 60 +++++++++++++-------
 1 file changed, 38 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/58b61188/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
index 006adb4..27f9cdb 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
@@ -39,9 +39,9 @@ import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
  */
 public class ClassHelper {
 
-  private static final String JAR_FILE_ENDING = "jar!";
+  private static final String JAR_FILE_ENDING = "jar";
   private static final String JAR_RESOURCE_SEPARATOR = "!";
-  private static final char PATH_SEPARATOR = '/';
+  private static final char RESOURCE_SEPARATOR = '/';
   private static final char PACKAGE_SEPARATOR = '.';
   private static final File[] EMPTY_FILE_ARRAY = new File[0];
   private static final String CLASSFILE_ENDING = ".class";
@@ -67,18 +67,20 @@ public class ClassHelper {
   public static final List<Class<?>> loadClasses(final String packageToScan, final FilenameFilter ff,
       final ClassValidator cv) {
     final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-    String folderToScan = packageToScan.replace(PACKAGE_SEPARATOR, PATH_SEPARATOR);
+    String folderToScan = packageToScan.replace(PACKAGE_SEPARATOR, RESOURCE_SEPARATOR);
     URL url = classLoader.getResource(folderToScan);
     if (url == null) {
       throw new IllegalArgumentException("No folder to scan found for package '" + packageToScan + "'.");
     }
 
     final Collection<String> fqnForClasses;
-    if (url.getFile().contains(JAR_FILE_ENDING)) {
-      fqnForClasses = getClassFqnFromJar(url.getFile().substring(5));
-    } else {
-      File folder = new File(url.getFile());
+    File folder = new File(url.getFile());
+    if (folder.isDirectory()) {
       fqnForClasses = getClassFqnFromDir(ff, folder, packageToScan);
+    } else if (isJarFile(url)) {
+      fqnForClasses = getClassFqnFromJar(url.getFile().substring(5), packageToScan);
+    } else {
+      fqnForClasses = null;
     }
 
     if (fqnForClasses == null || fqnForClasses.isEmpty()) {
@@ -94,6 +96,7 @@ public class ClassHelper {
         }
       } catch (ClassNotFoundException ex) {
         throw new IllegalArgumentException("Exception during class loading of class '" + fqn +
+            " from resource '" + url.getFile() + "'" +
             "' with message '" + ex.getMessage() + "'.");
       }
     }
@@ -101,6 +104,16 @@ public class ClassHelper {
     return annotatedClasses;
   }
 
+  private static boolean isJarFile(URL url) {
+    String filename = url.getFile();
+    int index = filename.indexOf(JAR_RESOURCE_SEPARATOR);
+    if (index > JAR_FILE_ENDING.length()) {
+      String fileEnding = filename.substring(index - JAR_FILE_ENDING.length(), index);
+      return JAR_FILE_ENDING.equalsIgnoreCase(fileEnding);
+    }
+    return false;
+  }
+
   private static Collection<String> getClassFqnFromDir(final FilenameFilter ff, File folder, String packageToScan) {
     List<String> classFiles = new ArrayList<String>();
     String[] classFilesForFolder = folder.list(ff);
@@ -117,33 +130,28 @@ public class ClassHelper {
     return classFiles;
   }
 
-  private static Collection<String> getClassFqnFromJar(String filepath) {
+  private static Collection<String> getClassFqnFromJar(String filepath, String packageToScan) {
+    JarFile jarFile = null;
+
+    final String jarFilePath;
     String[] split = filepath.split(JAR_RESOURCE_SEPARATOR);
     if (split.length == 2) {
-      return getClassFilesFromJar(split[0], split[1]);
+      jarFilePath = split[0];
+    } else {
+      throw new IllegalArgumentException("Illegal jar file path '" + filepath + "'.");
     }
-    throw new IllegalArgumentException("Illegal jar file path '" + filepath + "'.");
-  }
 
-  private static Collection<String> getClassFilesFromJar(String jarFilePath, String folderToScan) {
     try {
-      final String prefix;
-      if (folderToScan.startsWith(File.separator)) {
-        prefix = folderToScan.substring(1);
-      } else {
-        prefix = folderToScan;
-      }
-
-      JarFile jarFile = new JarFile(jarFilePath);
+      jarFile = new JarFile(jarFilePath);
       List<String> classFileNames = new ArrayList<String>();
       Enumeration<JarEntry> entries = jarFile.entries();
 
       while (entries.hasMoreElements()) {
         JarEntry je = entries.nextElement();
         String name = je.getName();
-        if (!je.isDirectory() && name.endsWith(CLASSFILE_ENDING) && name.startsWith(prefix)) {
+        if (!je.isDirectory() && name.matches(".*" + packageToScan + ".*" + CLASSFILE_ENDING)) {
           String className = name.substring(0, name.length() - CLASSFILE_ENDING.length());
-          classFileNames.add(className.replace(PATH_SEPARATOR, PACKAGE_SEPARATOR));
+          classFileNames.add(className.replace(RESOURCE_SEPARATOR, PACKAGE_SEPARATOR));
         }
       }
 
@@ -151,6 +159,14 @@ public class ClassHelper {
     } catch (IOException e) {
       throw new IllegalArgumentException("Exception during class loading from path '" + jarFilePath +
           "' with message '" + e.getMessage() + "'.");
+    } finally {
+      if (jarFile != null) {
+        try {
+          jarFile.close();
+        } catch (IOException e) {
+          throw new RuntimeException("Error during close of jar file: " + jarFile.getName() + "", e);
+        }
+      }
     }
   }
 


[03/35] git commit: [OLINGO-117] deleted entries support]

Posted by sk...@apache.org.
[OLINGO-117] deleted entries support]


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/3c327f2f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/3c327f2f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/3c327f2f

Branch: refs/heads/master
Commit: 3c327f2fbaaaf985b44e01b6a333e22b78acef25
Parents: f23e8c7
Author: Stephan Klevenz <sk...@apache.org>
Authored: Tue Jan 14 09:50:51 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Tue Jan 14 12:01:46 2014 +0100

----------------------------------------------------------------------
 .../JsonDeletedEntryEntityProducer.java         | 49 ++++++++++++++++++++
 .../ep/producer/JsonFeedEntityProducer.java     | 10 ++++
 .../olingo/odata2/core/ep/util/FormatJson.java  |  1 +
 .../JsonFeedWithDeltaLinkProducerTest.java      | 46 ++++++++++++++++--
 4 files changed, 101 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/3c327f2f/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
new file mode 100644
index 0000000..88f54f2
--- /dev/null
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
@@ -0,0 +1,49 @@
+package org.apache.olingo.odata2.core.ep.producer;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.ep.EntityProviderException;
+import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
+import org.apache.olingo.odata2.core.ep.aggregator.EntityInfoAggregator;
+import org.apache.olingo.odata2.core.ep.util.FormatJson;
+import org.apache.olingo.odata2.core.ep.util.JsonStreamWriter;
+
+public class JsonDeletedEntryEntityProducer {
+
+  private EntityProviderWriteProperties properties;
+
+  public JsonDeletedEntryEntityProducer(EntityProviderWriteProperties properties) {
+    this.properties = properties;
+  }
+
+  public void append(Writer writer, EntityInfoAggregator entityInfo, List<Map<String, Object>> deletedEntries)
+      throws EntityProviderException {
+    JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
+    try {
+      if (deletedEntries.size() > 0) {
+        jsonStreamWriter.separator();
+        for (Map<String, Object> deletedEntry : deletedEntries) {
+          jsonStreamWriter.beginObject();
+
+          String odataContextValue = "$metadata#" + entityInfo.getEntitySetName() + "/$deletedEntity";
+          String selfLink = AtomEntryEntityProducer.createSelfLink(entityInfo, deletedEntry, null);
+          String idValue = properties.getServiceRoot().toASCIIString() + selfLink;
+
+          jsonStreamWriter.namedStringValue(FormatJson.ODATA_CONTEXT, odataContextValue);
+          jsonStreamWriter.separator();
+          jsonStreamWriter.namedStringValue(FormatJson.ID, idValue);
+
+          jsonStreamWriter.endObject();
+        }
+      }
+    } catch (final IOException e) {
+      throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+          .getSimpleName()), e);
+    }
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/3c327f2f/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducer.java
index eb84b5b..25af754 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducer.java
@@ -75,6 +75,16 @@ public class JsonFeedEntityProducer {
         }
         entryProducer.append(writer, entityInfo, entryData, false);
       }
+
+      if (callback != null) {
+        JsonDeletedEntryEntityProducer deletedEntryProducer = new JsonDeletedEntryEntityProducer(properties);
+        TombstoneCallbackResult callbackResult = callback.getTombstoneCallbackResult();
+        List<Map<String, Object>> deletedEntries = callbackResult.getDeletedEntriesData();
+        if (deletedEntries != null) {
+          deletedEntryProducer.append(writer, entityInfo, deletedEntries);
+        }
+      }
+
       jsonStreamWriter.endArray();
 
       appendNextLink(jsonStreamWriter);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/3c327f2f/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/FormatJson.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/FormatJson.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/FormatJson.java
index 28b31e1..4d108b7 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/FormatJson.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/FormatJson.java
@@ -50,4 +50,5 @@ public class FormatJson {
   public static final String VALUE = "value";
   public static final String INNER_ERROR = "innererror";
   public static final String DELTA = "__delta";
+  public static final String ODATA_CONTEXT = "@odata.context";
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/3c327f2f/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
index 7927b02..03d7e0c 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
@@ -1,12 +1,12 @@
 package org.apache.olingo.odata2.core.ep.producer;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.*;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.Type;
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -14,6 +14,7 @@ import java.util.Map;
 
 import org.apache.olingo.odata2.api.ODataCallback;
 import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.ep.EntityProviderException;
 import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
 import org.apache.olingo.odata2.api.ep.callback.TombstoneCallback;
 import org.apache.olingo.odata2.api.processor.ODataResponse;
@@ -75,8 +76,45 @@ public class JsonFeedWithDeltaLinkProducerTest extends BaseTest {
     final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
 
     TombstoneCallback tombstoneCallback =
+        new TombstoneCallbackImpl(null, BASE_URI + "Rooms?!deltatoken=1234");
+
+    final String json = writeRoomData(entitySet, tombstoneCallback);
+
+    assertTrue("Delta Link missing or wrong!", json
+        .contains("__delta\":\"http://host:80/service/Rooms?!deltatoken=1234"));
+  }
+
+  @Test
+  public void deletedEntries() throws Exception {
+    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
+
+    TombstoneCallback tombstoneCallback =
+        new TombstoneCallbackImpl(deletedRoomData, null);
+
+    final String json = writeRoomData(entitySet, tombstoneCallback);
+
+    assertTrue("Somthing wring with @odata.context!", json
+        .contains("{\"@odata.context\":\"$metadata#Rooms/$deletedEntity\",\""));
+    System.out.println(json);
+  }
+
+  @Test
+  public void deletedEntriesAndDeltaLink() throws Exception {
+    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
+
+    TombstoneCallback tombstoneCallback =
         new TombstoneCallbackImpl(deletedRoomData, BASE_URI + "Rooms?!deltatoken=1234");
 
+    final String json = writeRoomData(entitySet, tombstoneCallback);
+
+    assertTrue("Delta Link missing or wrong!", json
+        .contains("__delta\":\"http://host:80/service/Rooms?!deltatoken=1234"));
+    assertTrue("Somthing wring with @odata.context!", json
+        .contains("{\"@odata.context\":\"$metadata#Rooms/$deletedEntity\",\""));
+  }
+
+  private String writeRoomData(final EdmEntitySet entitySet, TombstoneCallback tombstoneCallback)
+      throws URISyntaxException, EntityProviderException, IOException {
     Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
     callbacks.put(TombstoneCallback.CALLBACK_KEY_TOMBSTONE, tombstoneCallback);
 
@@ -91,9 +129,7 @@ public class JsonFeedWithDeltaLinkProducerTest extends BaseTest {
 
     final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
     assertNotNull(json);
-
-    assertTrue("Delta Link missing or wrong!", json.contains("__delta\":\"http://host:80/service/Rooms?!deltatoken=1234"));
-    
+    return json;
   }
 
 }


[21/35] git commit: [OLINGO-117] prepare for TDD

Posted by sk...@apache.org.
[OLINGO-117] prepare for TDD


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/0efcc30e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/0efcc30e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/0efcc30e

Branch: refs/heads/master
Commit: 0efcc30e47b3213ef236be31a13965f0a2769b53
Parents: 255fcc0
Author: Stephan Klevenz <st...@klaeff.de>
Authored: Fri Jan 17 18:34:51 2014 +0100
Committer: Stephan Klevenz <st...@klaeff.de>
Committed: Fri Jan 17 18:34:51 2014 +0100

----------------------------------------------------------------------
 .../org/apache/olingo/odata2/fit/client/ClientDeltaResponse.java    | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/0efcc30e/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponse.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponse.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponse.java
index 6c8ef5b..32f70af 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponse.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponse.java
@@ -75,7 +75,6 @@ public class ClientDeltaResponse extends AbstractFitTest {
   }
 
   @Test
-//  @Ignore
   public void testEntity() throws Exception {
     ODataFeed feed = client.readFeed("Container1", "Rooms", "application/atom+xml");
     assertNotNull(feed);


[06/35] git commit: [OLINGO-88] Added archetype project for 'annotation-processor'

Posted by sk...@apache.org.
[OLINGO-88] Added archetype project for 'annotation-processor'


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/17a1b04f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/17a1b04f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/17a1b04f

Branch: refs/heads/master
Commit: 17a1b04f438c77259c69511d022456cbc75bc148
Parents: d98180e
Author: Michael Bolz <mi...@apache.org>
Authored: Thu Jan 9 10:20:34 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Tue Jan 14 12:24:42 2014 +0100

----------------------------------------------------------------------
 odata2-sample/cars-annotation-archetype/pom.xml |  70 +++++++
 .../META-INF/maven/archetype-metadata.xml       |  41 ++++
 .../main/resources/archetype-resources/pom.xml  | 148 ++++++++++++++
 .../src/main/java/model/Address.java            |  79 ++++++++
 .../src/main/java/model/Car.java                | 115 +++++++++++
 .../src/main/java/model/Driver.java             | 104 ++++++++++
 .../src/main/java/model/Manufacturer.java       |  98 ++++++++++
 .../src/main/java/model/ResourceHelper.java     |  96 +++++++++
 .../AnnotationSampleServiceFactory.java         | 195 +++++++++++++++++++
 .../src/main/resources/log4j.xml                |  47 +++++
 .../src/main/version/version.html               |  29 +++
 .../src/main/webapp/WEB-INF/web.xml             |  51 +++++
 .../src/main/webapp/index.jsp                   | 115 +++++++++++
 .../projects/basic/archetype.properties         |   5 +
 .../src/test/resources/projects/basic/goal.txt  |   0
 odata2-sample/pom.xml                           |   1 +
 16 files changed, 1194 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/17a1b04f/odata2-sample/cars-annotation-archetype/pom.xml
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/pom.xml b/odata2-sample/cars-annotation-archetype/pom.xml
new file mode 100644
index 0000000..f275010
--- /dev/null
+++ b/odata2-sample/cars-annotation-archetype/pom.xml
@@ -0,0 +1,70 @@
+<?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>
+
+  <groupId>org.apache.olingo</groupId>
+  <artifactId>olingo-odata2-sample-cars-annotation-archetype-incubating</artifactId>
+  <name>${project.artifactId}</name>
+  <version>1.1.0-SNAPSHOT</version>
+  <packaging>maven-archetype</packaging>
+
+  <parent>
+    <groupId>org.apache.olingo</groupId>
+    <artifactId>olingo-odata2-sample-incubating</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
+    <relativePath>..</relativePath>
+  </parent>
+
+  <build>
+    <extensions>
+      <extension>
+        <groupId>org.apache.maven.archetype</groupId>
+        <artifactId>archetype-packaging</artifactId>
+        <version>2.2</version>
+      </extension>
+    </extensions>
+
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-archetype-plugin</artifactId>
+          <version>2.2</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-archetype-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <goals>
+              <goal>integration-test</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-eclipse-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/17a1b04f/odata2-sample/cars-annotation-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/odata2-sample/cars-annotation-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 0000000..81286c8
--- /dev/null
+++ b/odata2-sample/cars-annotation-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archetype-descriptor
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
+  name="olingo-odata2-sample-cars-annotation-incubating"
+  xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <fileSets>
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>src/main/java</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/version</directory>
+      <includes>
+        <include>**/*.html</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/webapp</directory>
+      <includes>
+        <include>**/*.jsp</include>
+        <include>**/*.xml</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/main/resources</directory>
+      <includes>
+        <include>**/*.xml</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
+      <directory></directory>
+      <includes>
+        <include>.classpath</include>
+        <include>.project</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/17a1b04f/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/pom.xml b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..100d87b
--- /dev/null
+++ b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,148 @@
+<?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>
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+  <name>${project.artifactId}</name>
+
+  <packaging>war</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <!-- Plugin Versions -->
+    <version.compiler-plugin>2.3.2</version.compiler-plugin>
+    <version.deploy-plugin>2.8.1</version.deploy-plugin>
+    <version.eclipse-plugin>2.9</version.eclipse-plugin>
+    <version.jetty-plugin>9.0.6.v20130930</version.jetty-plugin>
+    <!-- Dependency Versions -->
+    <version.cxf>2.7.6</version.cxf>
+    <version.servlet-api>2.5</version.servlet-api>
+    <version.jaxrs-api>2.0-m10</version.jaxrs-api>
+    <version.slf4j>1.7.1</version.slf4j>
+    <version.olingo>1.1.0-SNAPSHOT</version.olingo>
+  </properties>
+
+  <build>
+    <finalName>${project.artifactId}</finalName>
+    <defaultGoal>package jetty:run</defaultGoal>
+    <resources>
+      <resource>
+        <directory>src/main/version</directory>
+        <filtering>true</filtering>
+        <targetPath>../${project.build.finalName}/gen</targetPath>
+      </resource>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+      <resource>
+        <directory>target/maven-shared-archive-resources</directory>
+      </resource>
+    </resources>
+
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>${version.compiler-plugin}</version>
+        <configuration>
+          <source>1.6</source>
+          <target>1.6</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-deploy-plugin</artifactId>
+        <version>${version.deploy-plugin}</version>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-eclipse-plugin</artifactId>
+        <version>${version.eclipse-plugin}</version>
+        <configuration>
+          <addGroupIdToProjectName>true</addGroupIdToProjectName>
+          <addVersionToProjectName>true</addVersionToProjectName>
+          <wtpversion>2.0</wtpversion>
+          <downloadSources>true</downloadSources>
+          <downloadJavadocs>true</downloadJavadocs>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.eclipse.jetty</groupId>
+        <artifactId>jetty-maven-plugin</artifactId>
+        <version>${version.jetty-plugin}</version>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <!-- Apache Olingo Library dependencies -->
+    <dependency>
+      <groupId>org.apache.olingo</groupId>
+      <artifactId>olingo-odata2-api-incubating</artifactId>
+      <version>${version.olingo}</version>
+    </dependency>
+    <dependency>
+      <artifactId>olingo-odata2-api-annotation-incubating</artifactId>
+      <groupId>org.apache.olingo</groupId>
+      <type>jar</type>
+      <version>${version.olingo}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.olingo</groupId>
+      <artifactId>olingo-odata2-core-incubating</artifactId>
+      <version>${version.olingo}</version>
+    </dependency>
+    <!-- Apache Olingo Annotation Processor Extension dependencies -->
+    <dependency>
+      <groupId>org.apache.olingo</groupId>
+      <artifactId>olingo-odata2-annotation-processor-api-incubating</artifactId>
+      <version>${version.olingo}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.olingo</groupId>
+      <artifactId>olingo-odata2-annotation-processor-core-incubating</artifactId>
+      <version>${version.olingo}</version>
+    </dependency>
+    <!-- Additional dependencies -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <version>${version.slf4j}</version>
+    </dependency>
+    <!-- Servlet/REST dependencies -->
+    <dependency>
+      <!-- required because of auto detection of web facet 2.5 -->
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>${version.servlet-api}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.ws.rs</groupId>
+      <artifactId>javax.ws.rs-api</artifactId>
+      <version>${version.jaxrs-api}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+      <version>${version.cxf}</version>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/17a1b04f/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/Address.java
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/Address.java b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/Address.java
new file mode 100644
index 0000000..66ea6b9
--- /dev/null
+++ b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/Address.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.model;
+
+import org.apache.olingo.odata2.api.annotation.edm.EdmComplexType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
+
+/**
+ *
+ */
+@EdmComplexType(name = "Address", namespace = "MyFormula")
+public class Address {
+
+  @EdmProperty
+  private String street;
+  @EdmProperty
+  private String city;
+  @EdmProperty
+  private String zipCode;
+  @EdmProperty
+  private String country;
+
+  public String getStreet() {
+    return street;
+  }
+
+  public void setStreet(String street) {
+    this.street = street;
+  }
+
+  public String getCity() {
+    return city;
+  }
+
+  public void setCity(String city) {
+    this.city = city;
+  }
+
+  public String getZipCode() {
+    return zipCode;
+  }
+
+  public void setZipCode(String zipCode) {
+    this.zipCode = zipCode;
+  }
+
+  public String getCountry() {
+    return country;
+  }
+
+  public void setCountry(String country) {
+    this.country = country;
+  }
+
+  @Override
+  public String toString() {
+    return "Address{" + "street=" + street + ", city=" + city + ", zipCode=" + zipCode + ", country=" + country + '}';
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/17a1b04f/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/Car.java
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/Car.java b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/Car.java
new file mode 100644
index 0000000..26deb78
--- /dev/null
+++ b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/Car.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.model;
+
+import java.util.Date;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
+import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
+
+/**
+ *
+ */
+@EdmEntityType(namespace = "MyFormula")
+@EdmEntitySet(name = "Cars")
+public class Car {
+
+  @EdmKey
+  @EdmProperty
+  private String id;
+  @EdmProperty
+  private String model;
+  @EdmNavigationProperty
+  private Manufacturer manufacturer;
+  @EdmNavigationProperty
+  private Driver driver;
+  @EdmProperty
+  private Double price;
+  @EdmProperty
+  private Integer modelYear;
+  @EdmProperty
+  private Date updated;
+
+  public String getId() {
+    return id;
+  }
+
+  public void setId(String id) {
+    this.id = id;
+  }
+
+  public String getModel() {
+    return model;
+  }
+
+  public void setModel(String model) {
+    this.model = model;
+  }
+
+  public Manufacturer getManufacturer() {
+    return manufacturer;
+  }
+
+  public void setManufacturer(Manufacturer manufacturer) {
+    this.manufacturer = manufacturer;
+  }
+
+  public double getPrice() {
+    return price;
+  }
+
+  public void setPrice(double price) {
+    this.price = price;
+  }
+
+  public int getModelYear() {
+    return modelYear;
+  }
+
+  public void setModelYear(int modelYear) {
+    this.modelYear = modelYear;
+  }
+
+  public Date getUpdated() {
+    return updated;
+  }
+
+  public void setUpdated(Date updated) {
+    this.updated = updated;
+  }
+
+  public Driver getDriver() {
+    return driver;
+  }
+
+  public void setDriver(Driver driver) {
+    this.driver = driver;
+  }
+
+  @Override
+  public String toString() {
+    return "Car{" + "id=" + id + ", model=" + model + ", manufacturer id=" + manufacturer.getId() + ", driver id=" + driver.getId() + 
+            ", price=" + price + ", modelYear=" + modelYear + ", updated=" + updated + '}';
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/17a1b04f/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/Driver.java
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/Driver.java b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/Driver.java
new file mode 100644
index 0000000..594e002
--- /dev/null
+++ b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/Driver.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.model;
+
+import java.util.Calendar;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
+import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
+import org.apache.olingo.odata2.api.annotation.edm.EdmType;
+
+/**
+ *
+ */
+@EdmEntityType(namespace = "MyFormula")
+@EdmEntitySet(name = "Drivers")
+public class Driver {
+
+  @EdmKey
+  @EdmProperty
+  private Long id;
+  
+  @EdmProperty
+  private String name;
+  @EdmProperty
+  private String lastname;
+  @EdmProperty
+  private String nickname;
+  @EdmNavigationProperty(name = "Car")
+  private Car car;
+  @EdmProperty(type = EdmType.DATE_TIME)
+  private Calendar birthday;
+
+  public Long getId() {
+    return id;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public String getLastname() {
+    return lastname;
+  }
+
+  public void setLastname(String lastname) {
+    this.lastname = lastname;
+  }
+
+  public String getNickname() {
+    return nickname;
+  }
+
+  public void setNickname(String nickname) {
+    this.nickname = nickname;
+  }
+
+  public Car getCar() {
+    return car;
+  }
+
+  public void setCar(Car car) {
+    this.car = car;
+  }
+
+  public Calendar getUpdated() {
+    return birthday;
+  }
+
+  public void setBirthday(Calendar birthday) {
+    this.birthday = birthday;
+  }
+
+  @Override
+  public String toString() {
+    return "Driver{id=" + id + ", name=" + name + ", lastname=" + lastname + ", nickname=" + nickname
+            + ", car id=" + car.getId() + ", updated=" + birthday + '}';
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/17a1b04f/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/Manufacturer.java
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/Manufacturer.java b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/Manufacturer.java
new file mode 100644
index 0000000..2e8163c
--- /dev/null
+++ b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/Manufacturer.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.model;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
+import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty.Multiplicity;
+import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
+
+/**
+ *
+ */
+@EdmEntityType(namespace = "MyFormula")
+@EdmEntitySet(name = "Manufacturers")
+public class Manufacturer {
+
+  @EdmKey
+  @EdmProperty
+  private String id;
+  @EdmProperty
+  private String name;
+  @EdmProperty
+  private Calendar founded;
+  @EdmProperty
+  private Address address;
+  @EdmNavigationProperty(name = "Cars", toType = Car.class, toMultiplicity = Multiplicity.MANY)
+  private List<Car> cars = new ArrayList<Car>();
+
+  public String getId() {
+    return id;
+  }
+
+  public void setId(String id) {
+    this.id = id;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public Calendar getUpdated() {
+    return founded;
+  }
+
+  public void setFounded(Calendar updated) {
+    this.founded = updated;
+  }
+
+  public Address getAddress() {
+    return address;
+  }
+
+  public void setAddress(Address address) {
+    this.address = address;
+  }
+
+  public List<Car> getCars() {
+    return cars;
+  }
+
+  public void setCars(List<Car> cars) {
+    this.cars = cars;
+  }
+
+  @Override
+  public String toString() {
+    return "Manufacturer{" + "id=" + id + ", name=" + name + ", updated=" + founded + 
+            ", address=" + address + ", cars=" + cars.size() + '}';
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/17a1b04f/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/ResourceHelper.java
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/ResourceHelper.java b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/ResourceHelper.java
new file mode 100644
index 0000000..d509d28
--- /dev/null
+++ b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/model/ResourceHelper.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.model;
+
+import java.awt.image.BufferedImage;
+import java.awt.image.WritableRaster;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import javax.imageio.ImageIO;
+
+/**
+ *
+ */
+public class ResourceHelper {
+
+  public static byte[] loadAsByte(String resource) {
+    return load(resource, new byte[0]);
+  }
+
+  public static byte[] load(String resource, byte[] defaultResult) {
+    InputStream instream = null;
+    try {
+      instream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
+      if (instream == null) {
+        return defaultResult;
+      }
+      ByteArrayOutputStream stream = new ByteArrayOutputStream();
+      int b = 0;
+      while ((b = instream.read()) != -1) {
+        stream.write(b);
+      }
+
+      return stream.toByteArray();
+    } catch (IOException e) {
+      throw new RuntimeException(e);
+    } finally {
+      if(instream != null) {
+        try {
+          instream.close();
+        } catch (IOException ex) { }
+      }
+    }
+  }
+
+  public enum Format {BMP, JPEG, PNG, GIF};
+  
+  public static byte[] generateImage() {
+    return generateImage(Format.PNG);
+  }
+  
+  public static byte[] generateImage(Format format) {
+    try {
+      int width = 320;
+      int height = 320;
+      BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_BINARY);
+      WritableRaster raster = image.getRaster();
+      
+      int mod = format.ordinal() + 2;
+      for (int h = 0; h < height; h++) {
+        for (int w = 0; w < width; w++) {
+          if (((h / 32) + (w / 32)) % mod == 0) {
+            raster.setSample(w, h, 0, 0);
+          } else {
+            raster.setSample(w, h, 0, 1);
+          }
+        }
+      }
+      
+      ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
+      ImageIO.write(image, format.name(), out);
+      return out.toByteArray();
+    } catch (IOException ex) {
+      return new byte[0];
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/17a1b04f/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/processor/AnnotationSampleServiceFactory.java
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/processor/AnnotationSampleServiceFactory.java b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/processor/AnnotationSampleServiceFactory.java
new file mode 100644
index 0000000..5b346cc
--- /dev/null
+++ b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/java/processor/AnnotationSampleServiceFactory.java
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.processor;
+
+import ${package}.model.Address;
+import ${package}.model.Car;
+import ${package}.model.Driver;
+import ${package}.model.Manufacturer;
+import java.util.Calendar;
+import java.util.Locale;
+import org.apache.olingo.odata2.annotation.processor.api.AnnotationServiceFactory;
+import org.apache.olingo.odata2.annotation.processor.core.datasource.DataStore;
+import org.apache.olingo.odata2.api.ODataCallback;
+import org.apache.olingo.odata2.api.ODataDebugCallback;
+import org.apache.olingo.odata2.api.ODataService;
+import org.apache.olingo.odata2.api.ODataServiceFactory;
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+import org.apache.olingo.odata2.api.ep.EntityProvider;
+import org.apache.olingo.odata2.api.exception.ODataApplicationException;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataContext;
+import org.apache.olingo.odata2.api.processor.ODataErrorCallback;
+import org.apache.olingo.odata2.api.processor.ODataErrorContext;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ */
+public class AnnotationSampleServiceFactory extends ODataServiceFactory {
+
+  /**
+   * Instance holder for all annotation relevant instances which should be used as singleton
+   * instances within the ODataApplication (ODataService)
+   */
+  private static class AnnotationInstances {
+    final static String MODEL_PACKAGE = "${package}.model";
+    final static ODataService ANNOTATION_ODATA_SERVICE;
+    
+    static {
+      try {
+        ANNOTATION_ODATA_SERVICE = AnnotationServiceFactory.createAnnotationService(MODEL_PACKAGE);
+        initializeSampleData();
+      } catch (ODataApplicationException ex) {
+        throw new RuntimeException("Exception during sample data generation.", ex);
+      } catch (ODataException ex) {
+        throw new RuntimeException("Exception during data source initialization generation.", ex);
+      }
+    }
+  }
+
+  @Override
+  public ODataService createService(final ODataContext context) throws ODataException {
+    // Edm via Annotations and ListProcessor via AnnotationDS with AnnotationsValueAccess
+    return AnnotationInstances.ANNOTATION_ODATA_SERVICE;
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public <T extends ODataCallback> T getCallback(final Class<? extends ODataCallback> callbackInterface) {
+    return (T) (callbackInterface.isAssignableFrom(ScenarioErrorCallback.class)
+            ? new ScenarioErrorCallback() : callbackInterface.isAssignableFrom(ODataDebugCallback.class)
+            ? new ScenarioDebugCallback() : super.getCallback(callbackInterface));
+  }
+
+  /*
+   * Helper classes and methods
+   */
+  private final class ScenarioDebugCallback implements ODataDebugCallback {
+
+    @Override
+    public boolean isDebugEnabled() {
+      return true;
+    }
+  }
+
+  private class ScenarioErrorCallback implements ODataErrorCallback {
+
+    private final Logger LOG = LoggerFactory.getLogger(ScenarioErrorCallback.class);
+
+    @Override
+    public ODataResponse handleError(final ODataErrorContext context) throws ODataApplicationException {
+      if (context.getHttpStatus() == HttpStatusCodes.INTERNAL_SERVER_ERROR) {
+        LOG.error("Internal Server Error", context.getException());
+      }
+
+      return EntityProvider.writeErrorDocument(context);
+    }
+
+  }
+
+  private static <T> DataStore<T> getDataStore(Class<T> clz) throws DataStore.DataStoreException {
+    return DataStore.createInMemory(clz, true);
+  }
+
+  private static void initializeSampleData() throws ODataApplicationException {
+    DataStore<Car> carDs = getDataStore(Car.class);
+    Calendar updated = Calendar.getInstance();
+    Car c1 = createCar("F1 W02", 167189.00, 2011, updated);
+    carDs.create(c1);
+    Car c2 = createCar("F1 W04", 242189.99, 2013, updated);
+    carDs.create(c2);
+    Car c3 = createCar("FF2013", 199189.11, 2013, updated);
+    carDs.create(c3);
+    Car c4 = createCar("FF2014", 299189.11, 2014, updated);
+    carDs.create(c4);
+
+    DataStore<Driver> driverDs = getDataStore(Driver.class);
+    Driver d1 = createDriver("Mic", "Shoemaker", "The Fast", createDateTime(1985, 6, 27), c1);
+    driverDs.create(d1);
+    Driver d2 = createDriver("Nico", "Mulemountain", null, createDateTime(1969, 1, 3), c2);
+    driverDs.create(d2);
+    Driver d3 = createDriver("Kimi", "Heikkinen", "Iceman", createDateTime(1979, 10, 17), c3);
+    driverDs.create(d3);
+
+    Address addressStar = createAddress("Star Street 137", "Stuttgart", "70173", "Germany");
+    Manufacturer manStar = createManufacturer("Star Powered Racing", addressStar, createDateTime(1954, 7, 4), c1, c2);
+
+    Address addressHorse = createAddress("Horse Street 1", "Maranello", "41053", "Italy");
+    Manufacturer manHorse = createManufacturer("Horse Powered Racing", addressHorse, createDateTime(1929, 11, 16), c3, c4);
+
+    DataStore<Manufacturer> manDs = getDataStore(Manufacturer.class);
+    manDs.create(manStar);
+    manDs.create(manHorse);
+  }
+
+  private static Calendar createDateTime(int year, int month, int day) {
+    Calendar cal = Calendar.getInstance(Locale.ENGLISH);
+    cal.clear();
+    cal.set(year, month - 1, day);
+    return cal;
+  }
+
+  private static Car createCar(String name, double price, int modelyear, Calendar updated) {
+    Car car = new Car();
+    car.setModel(name);
+    car.setModelYear(modelyear);
+    car.setPrice(price);
+    car.setUpdated(updated.getTime());
+    return car;
+  }
+
+  private static Driver createDriver(String name, String lastname, String nickname, Calendar birthday, Car car) {
+    Driver driver = new Driver();
+    driver.setName(name);
+    driver.setLastname(lastname);
+    driver.setNickname(nickname);
+    driver.setBirthday(birthday);
+    driver.setCar(car);
+    car.setDriver(driver);
+    return driver;
+  }
+
+  private static Manufacturer createManufacturer(String name, Address address, Calendar founded, Car... cars) {
+    Manufacturer m = new Manufacturer();
+    m.setName(name);
+    m.setAddress(address);
+    m.setFounded(founded);
+    for (Car car : cars) {
+      car.setManufacturer(m);
+      m.getCars().add(car);
+    }
+    return m;
+  }
+
+  private static Address createAddress(final String street, final String city, final String zipCode,
+          final String country) {
+    Address address = new Address();
+    address.setStreet(street);
+    address.setCity(city);
+    address.setZipCode(zipCode);
+    address.setCountry(country);
+    return address;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/17a1b04f/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/resources/log4j.xml b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/resources/log4j.xml
new file mode 100644
index 0000000..6e3ec59
--- /dev/null
+++ b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/resources/log4j.xml
@@ -0,0 +1,47 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?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.
+-->
+<!DOCTYPE log4j:configuration SYSTEM "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+    <appender name="console" class="org.apache.log4j.ConsoleAppender">
+        <param name="Target" value="System.out" />
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%-5p %c{1} - %m%n" />
+        </layout>
+    </appender>
+
+    <logger name="${package}" additivity="false">
+        <level value="trace" />
+        <appender-ref ref="console" />
+    </logger>
+
+    <logger name="org.apache.olingo.odata2" additivity="false">
+        <level value="debug" />
+        <appender-ref ref="console" />
+    </logger>
+    
+    <root>
+        <priority value="error" />
+        <appender-ref ref="console" />
+    </root>
+</log4j:configuration>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/17a1b04f/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/version/version.html
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/version/version.html b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/version/version.html
new file mode 100644
index 0000000..512ae83
--- /dev/null
+++ b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/version/version.html
@@ -0,0 +1,29 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<!--
+
+ 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.
+
+-->
+<table border="1">
+  <tr><td>name</td><td>${symbol_dollar}{name}</td></tr>
+  <tr><td>version</td><td>${symbol_dollar}{version}</td></tr>
+  <tr><td>timestamp</td><td>${symbol_dollar}{timestamp}</td></tr>
+  <tr><td>project.build.finalName</td><td>${symbol_dollar}{project.build.finalName}</td></tr>
+</table>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/17a1b04f/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..1a22906
--- /dev/null
+++ b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,51 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?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.
+ -->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+	id="WebApp_ID" version="2.5">
+	<display-name>${package}</display-name>
+	<welcome-file-list>
+		<welcome-file>index.jsp</welcome-file>
+	</welcome-file-list>
+	
+	<servlet>
+		<servlet-name>CarServiceServlet</servlet-name>
+		<servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>
+		<init-param>
+			<param-name>javax.ws.rs.Application</param-name>
+			<param-value>org.apache.olingo.odata2.core.rest.app.ODataApplication</param-value>
+		</init-param>
+		<init-param>
+			<param-name>org.apache.olingo.odata2.service.factory</param-name>
+			<param-value>${package}.processor.AnnotationSampleServiceFactory</param-value>
+		</init-param>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+
+	<servlet-mapping>
+		<servlet-name>CarServiceServlet</servlet-name>
+		<url-pattern>/MyFormula.svc/*</url-pattern>
+	</servlet-mapping>
+
+</web-app>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/17a1b04f/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/webapp/index.jsp
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/webapp/index.jsp b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/webapp/index.jsp
new file mode 100644
index 0000000..b6f892d
--- /dev/null
+++ b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/webapp/index.jsp
@@ -0,0 +1,115 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<!--
+
+ 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.
+
+-->
+<%@ page language="java" contentType="text/html; UTF-8" pageEncoding="UTF-8"%>
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>Apache Olingo - OData2 Library</title>
+<style type="text/css">
+body { font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;
+       color: blue; background-color: ${symbol_pound}ffffff; }
+a { color: blue; text-decoration: none; }
+a:focus { outline: thin dotted ${symbol_pound}4076cb; outline-offset: -1px; }
+a:hover, a:active { outline: 0; }
+a:hover { color: ${symbol_pound}404a7e; text-decoration: underline; }
+h1, h2, h3, h4, h5, h6 { margin: 9px 0; font-family: inherit; font-weight: bold;
+                         line-height: 1; color: blue; }
+h1 { font-size: 36px; line-height: 40px; }
+h2 { font-size: 30px; line-height: 40px; }
+h3 { font-size: 24px; line-height: 40px; }
+h4 { font-size: 18px; line-height: 20px; }
+h5 { font-size: 14px; line-height: 20px; }
+h6 { font-size: 12px; line-height: 20px; }
+.logo { float: right; }
+ul { padding: 0; margin: 0 0 9px 25px; }
+ul ul { margin-bottom: 0; }
+li { line-height: 18px; }
+hr { margin: 18px 0;
+     border: 0; border-top: 1px solid ${symbol_pound}cccccc; border-bottom: 1px solid ${symbol_pound}ffffff; }
+table { border-collapse: collapse; border-spacing: 10px; }
+th, td { border: 1px solid; padding: 20px; }
+.code { font-family: "Courier New", monospace; font-size: 13px; line-height: 18px; }
+</style>
+</head>
+<body>
+	<h1>Apache Olingo - OData2 Library</h1>
+	<hr />
+	<h2>Reference Scenario</h2>
+	<table>
+		<tr>
+			<td valign="top">
+				<h3>Service Document and Metadata</h3>
+				<ul>
+					<li><a href="MyFormula.svc?_wadl" target="_blank">wadl</a></li>
+					<li><a href="MyFormula.svc/" target="_blank">service document</a></li>
+					<li><a href="MyFormula.svc/${symbol_dollar}metadata" target="_blank">metadata</a></li>
+				</ul>
+				<h3>EntitySets</h3>
+				<ul>
+					<li><a href="MyFormula.svc/Manufacturers" target="_blank">Manufacturers</a></li>
+					<li><a href="MyFormula.svc/Manufacturers/?${symbol_dollar}expand=Cars" target="_blank">Manufacturers/?${symbol_dollar}expand=Cars</a></li>
+					<li><a href="MyFormula.svc/Cars" target="_blank">Cars</a></li>
+					<li><a href="MyFormula.svc/Cars/?${symbol_dollar}expand=Driver" target="_blank">Cars/?${symbol_dollar}expand=Driver</a></li>
+					<li><a href="MyFormula.svc/Drivers" target="_blank">Drivers</a></li>
+					<li><a href="MyFormula.svc/Drivers/?${symbol_dollar}expand=Car" target="_blank">Drivers/?${symbol_dollar}expand=Car</a></li>
+					<li><a href="MyFormula.svc/Drivers/?${symbol_dollar}orderby=Lastname" target="_blank">Drivers/?${symbol_dollar}orderby=Lastname</a></li>
+					<li><a href="MyFormula.svc/Drivers/?${symbol_dollar}filter=year(Birthday)%20gt%201981" target="_blank">Drivers/?${symbol_dollar}filter=year(Birthday) gt 1981</a></li>
+				</ul>
+				<h3>Entities</h3>
+				<ul>
+					<li><a href="MyFormula.svc/Manufacturers('1')" target="_blank">Manufacturers('1')</a></li>
+					<li><a href="MyFormula.svc/Manufacturers('1')/Cars" target="_blank">Manufacturers('1')/Cars</a></li>
+					<li><a href="MyFormula.svc/Cars('1')" target="_blank">Cars('1')</a></li>
+					<li><a href="MyFormula.svc/Cars('1')/Driver" target="_blank">Cars('1')/Driver</a></li>
+					<li><a href="MyFormula.svc/Cars('1')/?${symbol_dollar}expand=Manufacturer" target="_blank">Cars('1')/?${symbol_dollar}expand=Manufacturer</a></li>
+					<li><a href="MyFormula.svc/Drivers(1)" target="_blank">Drivers(1)</a></li>
+					<li><a href="MyFormula.svc/Drivers(1)/Car" target="_blank">Drivers(1)/Car</a></li>
+				</ul>
+			</td>
+			<td valign="top">
+				&nbsp;
+			</td>
+			<td valign="bottom">
+				<div class="code">
+					<%
+					  String version = "gen/version.html";
+					%>
+					<%
+					  try {
+					%>
+					<jsp:include page='<%=version%>' />
+					<%
+					  } catch (Exception e) {
+					%>
+					<p>IDE Build</p>
+					<%
+					  }
+					%>
+				</div>
+			</td>
+		</tr>
+	</table>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/17a1b04f/odata2-sample/cars-annotation-archetype/src/test/resources/projects/basic/archetype.properties
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/test/resources/projects/basic/archetype.properties b/odata2-sample/cars-annotation-archetype/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..5bb9a2b
--- /dev/null
+++ b/odata2-sample/cars-annotation-archetype/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,5 @@
+#Thu Jan 09 06:21:45 CET 2014
+package=it.pkg
+version=0.1-SNAPSHOT
+groupId=archetype.it
+artifactId=basic

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/17a1b04f/odata2-sample/cars-annotation-archetype/src/test/resources/projects/basic/goal.txt
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/test/resources/projects/basic/goal.txt b/odata2-sample/cars-annotation-archetype/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/17a1b04f/odata2-sample/pom.xml
----------------------------------------------------------------------
diff --git a/odata2-sample/pom.xml b/odata2-sample/pom.xml
index 576d4f0..8082976 100644
--- a/odata2-sample/pom.xml
+++ b/odata2-sample/pom.xml
@@ -23,5 +23,6 @@
 
     <modules>
         <module>cars-service-archetype</module>
+        <module>cars-annotation-archetype</module>
     </modules>
 </project>


[02/35] git commit: [OLINGO-117] delta link support

Posted by sk...@apache.org.
[OLINGO-117] delta link support


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/f23e8c7a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/f23e8c7a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/f23e8c7a

Branch: refs/heads/master
Commit: f23e8c7a81c12bb329ff84304d75f2cf01ff4bf8
Parents: f294302
Author: Stephan Klevenz <sk...@apache.org>
Authored: Mon Jan 13 17:54:48 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Mon Jan 13 17:54:48 2014 +0100

----------------------------------------------------------------------
 .../ep/producer/JsonFeedEntityProducer.java     | 47 ++++++++--
 .../JsonFeedWithDeltaLinkProducerTest.java      | 99 ++++++++++++++++++++
 2 files changed, 138 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/f23e8c7a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducer.java
index 9be2fb0..eb84b5b 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducer.java
@@ -26,6 +26,8 @@ import java.util.Map;
 import org.apache.olingo.odata2.api.commons.InlineCount;
 import org.apache.olingo.odata2.api.ep.EntityProviderException;
 import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
+import org.apache.olingo.odata2.api.ep.callback.TombstoneCallback;
+import org.apache.olingo.odata2.api.ep.callback.TombstoneCallbackResult;
 import org.apache.olingo.odata2.core.ep.aggregator.EntityInfoAggregator;
 import org.apache.olingo.odata2.core.ep.util.FormatJson;
 import org.apache.olingo.odata2.core.ep.util.JsonStreamWriter;
@@ -46,6 +48,8 @@ public class JsonFeedEntityProducer {
       final boolean isRootElement) throws EntityProviderException {
     JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
 
+    TombstoneCallback callback = getTombstoneCallback();
+
     try {
       jsonStreamWriter.beginObject();
 
@@ -73,14 +77,8 @@ public class JsonFeedEntityProducer {
       }
       jsonStreamWriter.endArray();
 
-      // Write "next" link.
-      // To be compatible with other implementations out there, the link is
-      // written directly after "__next" and not as "{"uri":"next link"}",
-      // deviating from the OData 2.0 specification.
-      if (properties.getNextLink() != null) {
-        jsonStreamWriter.separator()
-            .namedStringValue(FormatJson.NEXT, properties.getNextLink());
-      }
+      appendNextLink(jsonStreamWriter);
+      appendDeltaLink(callback, jsonStreamWriter);
 
       if (isRootElement) {
         jsonStreamWriter.endObject();
@@ -92,4 +90,37 @@ public class JsonFeedEntityProducer {
           .getSimpleName()), e);
     }
   }
+
+  private TombstoneCallback getTombstoneCallback() {
+    if (properties.getCallbacks() != null
+        && properties.getCallbacks().containsKey(TombstoneCallback.CALLBACK_KEY_TOMBSTONE)) {
+      TombstoneCallback callback =
+          (TombstoneCallback) properties.getCallbacks().get(TombstoneCallback.CALLBACK_KEY_TOMBSTONE);
+      return callback;
+    } else {
+      return null;
+    }
+  }
+
+  private void appendNextLink(JsonStreamWriter jsonStreamWriter) throws IOException {
+    // Write "next" link.
+    // To be compatible with other implementations out there, the link is
+    // written directly after "__next" and not as "{"uri":"next link"}",
+    // deviating from the OData 2.0 specification.
+    if (properties.getNextLink() != null) {
+      jsonStreamWriter.separator()
+          .namedStringValue(FormatJson.NEXT, properties.getNextLink());
+    }
+  }
+
+  private void appendDeltaLink(TombstoneCallback callback, JsonStreamWriter jsonStreamWriter) throws IOException {
+    if (callback != null) {
+      TombstoneCallbackResult callbackResult = callback.getTombstoneCallbackResult();
+
+      String deltaLink = callbackResult.getDeltaLink();
+      if (deltaLink != null) {
+        jsonStreamWriter.separator().namedStringValue(FormatJson.DELTA, deltaLink);
+      }
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/f23e8c7a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
new file mode 100644
index 0000000..7927b02
--- /dev/null
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
@@ -0,0 +1,99 @@
+package org.apache.olingo.odata2.core.ep.producer;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.*;
+
+import java.io.InputStream;
+import java.lang.reflect.Type;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.ODataCallback;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
+import org.apache.olingo.odata2.api.ep.callback.TombstoneCallback;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.core.ep.JsonEntityProvider;
+import org.apache.olingo.odata2.testutil.fit.BaseTest;
+import org.apache.olingo.odata2.testutil.helper.StringHelper;
+import org.apache.olingo.odata2.testutil.mock.MockFacade;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.gson.Gson;
+import com.google.gson.internal.StringMap;
+import com.google.gson.reflect.TypeToken;
+
+public class JsonFeedWithDeltaLinkProducerTest extends BaseTest {
+
+  protected static final String BASE_URI = "http://host:80/service/";
+  protected static final EntityProviderWriteProperties DEFAULT_PROPERTIES =
+      EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).build();
+
+  private ArrayList<Map<String, Object>> deletedRoomData;
+  protected ArrayList<Map<String, Object>> roomsData;
+
+  private void initializeRoomData() {
+    Map<String, Object> roomData1 = new HashMap<String, Object>();
+    roomData1.put("Id", "1");
+    roomData1.put("Seats", 123);
+    roomData1.put("Version", 1);
+    Map<String, Object> roomData2 = new HashMap<String, Object>();
+    roomData2.put("Id", "2");
+    roomData2.put("Seats", 66);
+    roomData2.put("Version", 2);
+
+    roomsData = new ArrayList<Map<String, Object>>();
+    roomsData.add(roomData1);
+    roomsData.add(roomData2);
+  }
+
+  private void initializeDeletedRoomData() {
+    deletedRoomData = new ArrayList<Map<String, Object>>();
+    for (int i = 2; i <= roomsData.size(); i = i + 2) {
+      HashMap<String, Object> tmp = new HashMap<String, Object>();
+      tmp.put("Id", "" + i);
+      tmp.put("Name", "Neu Schwanstein" + i);
+      tmp.put("Seats", new Integer(20));
+      tmp.put("Version", new Integer(3));
+      deletedRoomData.add(tmp);
+    }
+  }
+
+  @Before
+  public void before() {
+    initializeRoomData();
+    initializeDeletedRoomData();
+  }
+
+  @Test
+  public void deltaLink() throws Exception {
+    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
+
+    TombstoneCallback tombstoneCallback =
+        new TombstoneCallbackImpl(deletedRoomData, BASE_URI + "Rooms?!deltatoken=1234");
+
+    Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
+    callbacks.put(TombstoneCallback.CALLBACK_KEY_TOMBSTONE, tombstoneCallback);
+
+    EntityProviderWriteProperties properties =
+        EntityProviderWriteProperties.serviceRoot(new URI(BASE_URI)).callbacks(callbacks).build();
+
+    final ODataResponse response = new JsonEntityProvider().writeFeed(entitySet, roomsData,
+        properties);
+    assertNotNull(response);
+    assertNotNull(response.getEntity());
+    assertNull("EntitypProvider must not set content header", response.getContentHeader());
+
+    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
+    assertNotNull(json);
+
+    assertTrue("Delta Link missing or wrong!", json.contains("__delta\":\"http://host:80/service/Rooms?!deltatoken=1234"));
+    
+  }
+
+}


[30/35] git commit: [OLINGO-117] merge from origin/master

Posted by sk...@apache.org.
[OLINGO-117] merge from origin/master


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/674f0fa7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/674f0fa7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/674f0fa7

Branch: refs/heads/master
Commit: 674f0fa7483dacbeaa6be90b391deb2653c3db9c
Parents: 38d06b2 416537b
Author: Stephan Klevenz <sk...@apache.org>
Authored: Thu Jan 23 17:31:40 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Thu Jan 23 17:31:40 2014 +0100

----------------------------------------------------------------------
 .../processor/api/AnnotationServiceFactory.java |   2 +-
 .../core/datasource/AnnotationInMemoryDs.java   |   9 +-
 .../datasource/AnnotationsInMemoryDsTest.java   |  65 ++
 .../core/datasource/BeanPropertyAccessTest.java | 102 ++--
 .../processor/core/util/ClassHelperTest.java    |  12 +
 odata2-dist/janos/pom.xml                       | 103 ++++
 .../janos/src/main/assembly/janos-assembly.xml  |  48 ++
 odata2-dist/janos/src/main/resources/LICENSE    | 587 +++++++++++++++++++
 odata2-dist/janos/src/main/resources/NOTICE     |   5 +
 .../lib/src/main/assembly/lib-assembly.xml      |   4 +-
 odata2-dist/pom.xml                             |   1 +
 odata2-dist/ref/pom.xml                         |  15 +
 .../ref/src/main/assembly/ref-assembly.xml      |   9 +-
 .../processor/api/ODataJPAResponseBuilder.java  |   6 +-
 .../jpa/processor/api/access/JPAProcessor.java  |   8 +-
 .../core/ODataJPAProcessorDefault.java          |   4 +-
 .../core/ODataJPAResponseBuilderDefault.java    |  70 +--
 .../processor/core/access/data/JPAEntity.java   | 163 ++---
 .../core/access/data/JPAEntityParser.java       | 389 ++++++------
 .../core/access/data/JPAExpandCallBack.java     |  47 +-
 .../jpa/processor/core/access/data/JPALink.java |  70 ++-
 .../core/access/data/JPAProcessorImpl.java      |  19 +-
 .../core/access/data/JPAEntityParserTest.java   |  50 +-
 .../JPAEntityParserTestForStaticMethods.java    |  18 +-
 .../core/access/data/JPAEntityTest.java         |   3 +-
 .../processor/core/mock/data/EdmMockUtil.java   |  16 +-
 .../processor/core/mock/data/EdmMockUtilV2.java |   3 +-
 .../core/mock/data/ODataEntryMockUtil.java      |  34 +-
 .../processor/ref/model/SalesOrderHeader.java   |  16 +-
 .../jpa/processor/ref/model/SalesOrderItem.java |  13 +-
 pom.xml                                         |  52 +-
 31 files changed, 1404 insertions(+), 539 deletions(-)
----------------------------------------------------------------------



[24/35] git commit: [OLINGO-117] fix XmlInputFactory

Posted by sk...@apache.org.
[OLINGO-117] fix XmlInputFactory


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/cdad25df
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/cdad25df
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/cdad25df

Branch: refs/heads/master
Commit: cdad25df7d1a9cc6c477c015ad7ee1bbef8c6392
Parents: 6774b95
Author: Stephan Klevenz <sk...@apache.org>
Authored: Thu Jan 23 16:36:49 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Thu Jan 23 17:21:31 2014 +0100

----------------------------------------------------------------------
 .../org/apache/olingo/odata2/core/commons/XmlHelperTest.java   | 6 ++++++
 .../apache/olingo/odata2/core/ep/ProviderFacadeImplTest.java   | 2 --
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/cdad25df/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/commons/XmlHelperTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/commons/XmlHelperTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/commons/XmlHelperTest.java
index 55c9df0..956eb1b 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/commons/XmlHelperTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/commons/XmlHelperTest.java
@@ -35,6 +35,7 @@ import org.apache.olingo.odata2.api.ep.EntityProvider;
 import org.apache.olingo.odata2.api.ep.EntityProviderException;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
 import org.apache.olingo.odata2.testutil.mock.MockFacade;
+import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -86,6 +87,11 @@ public class XmlHelperTest {
           "  <data>&rules;</data>" +
           "</extract>";
 
+  @BeforeClass
+  public static void beforeClass() {
+    System.setProperty("javax.xml.stream.XMLInputFactory", "com.ctc.wstx.stax.WstxInputFactory"); // NOSONAR
+  }
+  
   @Test
   public void createReader() throws Exception {
     InputStream content = new ByteArrayInputStream(XML.getBytes("UTF-8"));

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/cdad25df/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImplTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImplTest.java
index 53b48bd..2c3c800 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImplTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImplTest.java
@@ -52,13 +52,11 @@ import org.apache.olingo.odata2.core.edm.EdmDateTimeOffset;
 import org.apache.olingo.odata2.core.ep.consumer.AbstractConsumerTest;
 import org.apache.olingo.odata2.testutil.helper.StringHelper;
 import org.apache.olingo.odata2.testutil.mock.MockFacade;
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
  *  
  */
-@Ignore
 public class ProviderFacadeImplTest extends AbstractConsumerTest {
 
   private static final String EMPLOYEE_1_XML =


[27/35] [olingo-117] cleanup, rat and checkstyle issues

Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
index a02a12b..909ce19 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
@@ -1,3 +1,21 @@
+/*******************************************************************************
+ * 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.odata2.fit.client;
 
 import static org.junit.Assert.assertEquals;
@@ -67,7 +85,8 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
     private int deletedRoomDataCount = 2;
 
     @Override
-    public ODataResponse readEntitySet(GetEntitySetUriInfo uriInfo, String contentType) throws ODataException {
+    public ODataResponse readEntitySet(final GetEntitySetUriInfo uriInfo, final String contentType)
+        throws ODataException {
       try {
         ArrayList<Map<String, Object>> deletedRoomData = null;
         ODataResponse response = null;
@@ -152,7 +171,7 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
     assertEquals(6, sets.size());
   }
 
-  private void testDeltaFeedWithDeltaLink(String contentType) throws Exception {
+  private void testDeltaFeedWithDeltaLink(final String contentType) throws Exception {
     ODataFeed feed = client.readFeed("Container1", "Rooms", contentType);
     String deltaLink = feed.getFeedMetadata().getDeltaLink();
 
@@ -174,7 +193,7 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
     assertEquals("http://localhost:19000/abc/ClientDeltaResponseTest/Rooms('4')", deletedEntries.get(1).getUri());
   }
 
-  private void testDeltaFeedWithZeroEntries(String contentType) throws Exception {
+  private void testDeltaFeedWithZeroEntries(final String contentType) throws Exception {
     processor.roomDataCount = 0;
     processor.deletedRoomDataCount = 0;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
index 55b6fef..dfe27fe 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
@@ -1,3 +1,21 @@
+/*******************************************************************************
+ * 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.odata2.fit.client.util;
 
 import java.io.IOException;
@@ -38,46 +56,49 @@ public class Client {
 
   private Edm edm;
 
-  public Client(String serviceUrl, Proxy.Type protocol, String proxy, int port) throws IOException, ODataException,
+  public Client(final String serviceUrl, final Proxy.Type protocol, final String proxy, final int port)
+      throws IOException, ODataException,
       HttpException {
     this.serviceUrl = serviceUrl;
     this.protocol = protocol;
     this.proxy = proxy;
     this.port = port;
-    this.useProxy = true;
-    this.useAuthentication = false;
+    useProxy = true;
+    useAuthentication = false;
 
     edm = getEdmInternal();
   }
 
-  public Client(String serviceUrl) throws IOException, ODataException, HttpException {
+  public Client(final String serviceUrl) throws IOException, ODataException, HttpException {
     this.serviceUrl = serviceUrl;
-    this.useProxy = false;
-    this.useAuthentication = false;
+    useProxy = false;
+    useAuthentication = false;
 
     edm = getEdmInternal();
   }
 
-  public Client(String serviceUrl, Proxy.Type protocol, String proxy, int port, String username, String password)
+  public Client(final String serviceUrl, final Proxy.Type protocol, final String proxy, final int port,
+      final String username, final String password)
       throws IOException, ODataException, HttpException {
     this.serviceUrl = serviceUrl;
     this.protocol = protocol;
     this.proxy = proxy;
     this.port = port;
-    this.useProxy = true;
+    useProxy = true;
     this.username = username;
     this.password = password;
-    this.useAuthentication = true;
+    useAuthentication = true;
 
     edm = getEdmInternal();
   }
 
-  public Client(String serviceUrl, String username, String password) throws IOException, ODataException, HttpException {
+  public Client(final String serviceUrl, final String username, final String password) throws IOException,
+      ODataException, HttpException {
     this.serviceUrl = serviceUrl;
-    this.useProxy = false;
+    useProxy = false;
     this.username = username;
     this.password = password;
-    this.useAuthentication = true;
+    useAuthentication = true;
 
     edm = getEdmInternal();
   }
@@ -88,7 +109,7 @@ public class Client {
     return edm;
   }
 
-  private void checkStatus(HttpURLConnection connection) throws IOException, HttpException {
+  private void checkStatus(final HttpURLConnection connection) throws IOException, HttpException {
     if (400 <= connection.getResponseCode() && connection.getResponseCode() <= 599) {
       HttpStatusCodes httpStatusCode = HttpStatusCodes.fromStatusCode(connection.getResponseCode());
       throw new HttpException(httpStatusCode, httpStatusCode.getStatusCode() + " " + httpStatusCode.toString());
@@ -103,12 +124,14 @@ public class Client {
     return edm.getServiceMetadata().getEntitySetInfos();
   }
 
-  public ODataFeed readFeed(String entityContainerName, String entitySetName, String contentType) throws IOException,
+  public ODataFeed readFeed(final String entityContainerName, final String entitySetName, final String contentType)
+      throws IOException,
       ODataException, HttpException {
     return readFeed(entityContainerName, entitySetName, contentType, null);
   }
 
-  public ODataFeed readFeed(String entityContainerName, String entitySetName, String contentType, String query)
+  public ODataFeed readFeed(final String entityContainerName, final String entitySetName, final String contentType,
+      final String query)
       throws IOException, ODataException, HttpException {
     EdmEntityContainer entityContainer = edm.getEntityContainer(entityContainerName);
     String relativeUri;
@@ -123,7 +146,7 @@ public class Client {
         EntityProviderReadProperties.init().build());
   }
 
-  private HttpURLConnection connect(String absoluteUri, String contentType, String httpMethod)
+  private HttpURLConnection connect(final String absoluteUri, final String contentType, final String httpMethod)
       throws IOException,
       HttpException {
     URL url = new URL(absoluteUri);
@@ -139,7 +162,7 @@ public class Client {
 
     if (useAuthentication) {
       String authorization = "Basic ";
-      authorization += new String(Base64.encodeBase64((this.username + ":" + this.password).getBytes()));
+      authorization += new String(Base64.encodeBase64((username + ":" + password).getBytes()));
       connection.setRequestProperty("Authorization", authorization);
     }
 
@@ -150,7 +173,8 @@ public class Client {
     return connection;
   }
 
-  private HttpURLConnection connect(String relativeUri, String query, String contentType, String httpMethod)
+  private HttpURLConnection connect(final String relativeUri, final String query, final String contentType,
+      final String httpMethod)
       throws IOException,
       HttpException {
     URL url = new URL(serviceUrl + relativeUri + (query != null ? "?" + query : ""));
@@ -158,7 +182,8 @@ public class Client {
   }
 
   public ODataDeltaFeed
-      readDeltaFeed(String entityContainerName, String entitySetName, String contentType, String deltaLink)
+      readDeltaFeed(final String entityContainerName, final String entitySetName, final String contentType,
+          final String deltaLink)
           throws IOException, ODataException, HttpException {
 
     EdmEntityContainer entityContainer = edm.getEntityContainer(entityContainerName);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/HttpException.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/HttpException.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/HttpException.java
index cb35db1..2597518 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/HttpException.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/HttpException.java
@@ -1,3 +1,21 @@
+/*******************************************************************************
+ * 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.odata2.fit.client.util;
 
 import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
@@ -8,7 +26,7 @@ public class HttpException extends Exception {
 
   private HttpStatusCodes httpStatusCode;
 
-  public HttpException(HttpStatusCodes httpStatusCode, String message) {
+  public HttpException(final HttpStatusCodes httpStatusCode, final String message) {
     super(message);
     this.httpStatusCode = httpStatusCode;
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsProcessor.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsProcessor.java b/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsProcessor.java
index 32f196f..7e22a3d 100644
--- a/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsProcessor.java
+++ b/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ListsProcessor.java
@@ -115,7 +115,7 @@ import org.apache.olingo.odata2.ref.processor.ScenarioDataSource.BinaryData;
 
 /**
  * Implementation of the centralized parts of OData processing,
- * allowing to use the simplified {@link DataSource} for the
+ * allowing to use the simplified DataSource for the
  * actual data handling.
  * 
  */
@@ -129,7 +129,7 @@ public class ListsProcessor extends ODataSingleProcessor {
   public ListsProcessor(final ScenarioDataSource dataSource) {
     this(dataSource, new BeanPropertyAccess());
   }
-  
+
   public ListsProcessor(final ScenarioDataSource dataSource, final BeanPropertyAccess valueAccess) {
     this.dataSource = dataSource;
     this.valueAccess = valueAccess;
@@ -212,16 +212,16 @@ public class ListsProcessor extends ODataSingleProcessor {
     return ODataResponse.fromResponse(response).build();
   }
 
-  String percentEncodeNextLink(String link) {
-    if(link == null) {
+  String percentEncodeNextLink(final String link) {
+    if (link == null) {
       return null;
     }
-       
+
     return link.replaceAll("\\$skiptoken=.+?(?:&|$)", "")
         .replaceAll("\\$skip=.+?(?:&|$)", "")
         .replaceFirst("(?:\\?|&)$", ""); // Remove potentially trailing "?" or "&" left over from remove actions
   }
-  
+
   @Override
   public ODataResponse countEntitySet(final GetEntitySetCountUriInfo uriInfo, final String contentType)
       throws ODataException {
@@ -913,7 +913,7 @@ public class ListsProcessor extends ODataSingleProcessor {
           keys.isEmpty() ?
               dataSource.readData(startEntitySet) : dataSource.readData(startEntitySet, keys) :
           dataSource.readData(functionImport, functionImportParameters, keys);
-  
+
       EdmEntitySet currentEntitySet =
           functionImport == null ? startEntitySet : functionImport.getEntitySet();
       for (NavigationSegment navigationSegment : navigationSegments) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ScenarioDataSource.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ScenarioDataSource.java b/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ScenarioDataSource.java
index cb055ed..d2f55aa 100644
--- a/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ScenarioDataSource.java
+++ b/odata2-lib/odata-ref/src/main/java/org/apache/olingo/odata2/ref/processor/ScenarioDataSource.java
@@ -605,7 +605,7 @@ public class ScenarioDataSource {
       throw new ODataNotImplementedException();
     }
   }
-  
+
   /**
    * Container to store binary data (as byte array) and the associated MIME type.
    */

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-ref/src/test/java/org/apache/olingo/odata2/ref/processor/ListsProcessorTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-ref/src/test/java/org/apache/olingo/odata2/ref/processor/ListsProcessorTest.java b/odata2-lib/odata-ref/src/test/java/org/apache/olingo/odata2/ref/processor/ListsProcessorTest.java
index bfca445..b695a55 100644
--- a/odata2-lib/odata-ref/src/test/java/org/apache/olingo/odata2/ref/processor/ListsProcessorTest.java
+++ b/odata2-lib/odata-ref/src/test/java/org/apache/olingo/odata2/ref/processor/ListsProcessorTest.java
@@ -26,9 +26,9 @@ import org.junit.Test;
  * 
  */
 public class ListsProcessorTest {
-  
+
   private ListsProcessor listsProcessor;
-  
+
   public ListsProcessorTest() {
     listsProcessor = new ListsProcessor(null);
   }
@@ -68,7 +68,7 @@ public class ListsProcessorTest {
     String url = "Rooms?$orderby=Seats%20desc&$skiptoken=213&$top=200";
     String result = listsProcessor.percentEncodeNextLink(url);
     Assert.assertEquals("Rooms?$orderby=Seats%20desc&$top=200", result);
-    
+
     String url2 = "Rooms?$orderby=Seats%20desc&$skiptoken=213";
     String result2 = listsProcessor.percentEncodeNextLink(url2);
     Assert.assertEquals("Rooms?$orderby=Seats%20desc", result2);


[34/35] git commit: [OLINGO-117] Merge branch 'master' into delta

Posted by sk...@apache.org.
[OLINGO-117] Merge branch 'master' into delta


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/5b4a4594
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/5b4a4594
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/5b4a4594

Branch: refs/heads/master
Commit: 5b4a459424cb6018f47c19d5e127f916e8818546
Parents: b6696a6 7c281ff
Author: Stephan Klevenz <sk...@apache.org>
Authored: Mon Feb 10 10:16:50 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Mon Feb 10 10:24:44 2014 +0100

----------------------------------------------------------------------
 NOTICE                                          |  11 +-
 .../annotation-processor-ref/pom.xml            |  17 +-
 .../src/main/resources/META-INF/NOTICE          |  23 +
 .../janos/src/main/assembly/janos-assembly.xml  |   2 +-
 odata2-dist/janos/src/main/resources/NOTICE     |  17 +-
 .../jpa/src/main/assembly/jpa-assembly.xml      |   2 +-
 odata2-dist/jpa/src/main/resources/NOTICE       |  24 +-
 .../lib/src/main/assembly/lib-assembly.xml      |   2 +-
 odata2-dist/lib/src/main/resources/NOTICE       |  17 +-
 .../ref/src/main/assembly/ref-assembly.xml      |   2 +-
 odata2-dist/ref/src/main/resources/NOTICE       |  47 +-
 .../core/ODataJPAResponseBuilderDefault.java    |  21 +-
 .../core/access/data/JPAEntityParser.java       |  36 +-
 .../core/ODataJPAResponseBuilderTest.java       |   1 +
 .../jpa-web/src/main/resources/META-INF/NOTICE  |  44 +
 odata2-lib/odata-core/pom.xml                   |  27 +-
 odata2-lib/odata-fit/pom.xml                    |  12 +
 .../odata-fit/src/test/resources/log4j.xml      |  39 +
 odata2-lib/odata-ref/pom.xml                    |  23 +-
 odata2-lib/odata-testutil/pom.xml               |  22 +-
 .../src/main/resources/META-INF/NOTICE          |  23 +
 .../META-INF/maven/archetype-metadata.xml       |   7 +
 .../projects/basic/archetype.properties         |   7 +
 .../META-INF/maven/archetype-metadata.xml       |   7 +
 .../projects/basic/archetype.properties         |   7 +
 pom.xml                                         | 805 +++++++++----------
 26 files changed, 768 insertions(+), 477 deletions(-)
----------------------------------------------------------------------



[19/35] git commit: [OLINGO-117] merge origin/master

Posted by sk...@apache.org.
[OLINGO-117] merge origin/master


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/f9d2a013
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/f9d2a013
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/f9d2a013

Branch: refs/heads/master
Commit: f9d2a013bf8441cb90c432813c2152b1c5f857d5
Parents: 677bea9 8ed6306
Author: Stephan Klevenz <sk...@apache.org>
Authored: Fri Jan 17 15:10:09 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Fri Jan 17 15:10:09 2014 +0100

----------------------------------------------------------------------
 .../annotation-processor-api/pom.xml            |   2 +-
 .../annotation-processor-core/pom.xml           |   2 +-
 .../processor/core/ListsProcessor.java          |  20 +-
 .../core/datasource/AnnotationValueAccess.java  |  14 +-
 .../processor/core/ListsProcessorTest.java      |  54 +++++
 .../datasource/AnnotationValueAccessTest.java   |  22 ++
 .../annotation-processor-ref/pom.xml            |   2 +-
 .../annotation-processor-web/pom.xml            |   2 +-
 odata2-annotation-processor/pom.xml             |   2 +-
 odata2-dist/javadoc/pom.xml                     |   2 +-
 odata2-dist/jpa/pom.xml                         |   2 +-
 odata2-dist/lib/pom.xml                         |   2 +-
 odata2-dist/pom.xml                             |   2 +-
 odata2-dist/ref/pom.xml                         |   2 +-
 odata2-jpa-processor/jpa-api/pom.xml            |   2 +-
 odata2-jpa-processor/jpa-core/pom.xml           |   2 +-
 .../jpa/processor/core/ODataEntityParser.java   |   2 +-
 .../processor/core/access/data/JPAEntity.java   |  10 +-
 .../core/access/data/JPAEntityParser.java       |  74 ++++---
 .../core/access/data/JPAExpandCallBack.java     |  16 +-
 .../jpa/processor/core/access/data/JPALink.java |  50 +++--
 .../core/access/data/JPAProcessorImpl.java      |   4 +-
 .../core/access/data/JPAEntityTest.java         |  13 +-
 .../core/access/data/JPAExpandCallBackTest.java |   5 +
 .../core/mock/ODataJPAContextMock.java          |   9 +
 .../core/mock/data/ODataEntryMockUtil.java      |  13 +-
 odata2-jpa-processor/jpa-ref/pom.xml            |   2 +-
 .../jpa/processor/ref/model/Customer.java       |   3 +-
 .../jpa/processor/ref/model/SalesOrderItem.java | 208 ++++++++++---------
 odata2-jpa-processor/jpa-web/pom.xml            |   2 +-
 .../SQL_Insert_SalesOrderItem.properties        |  22 +-
 odata2-jpa-processor/pom.xml                    |   2 +-
 odata2-lib/odata-annotation/pom.xml             |   2 +-
 odata2-lib/odata-api/pom.xml                    |   2 +-
 .../api/ep/EntityProviderWriteProperties.java   |  19 ++
 odata2-lib/odata-core/pom.xml                   |   2 +-
 .../odata2/core/ep/AtomEntityProvider.java      |   2 +-
 .../core/ep/consumer/XmlMetadataConsumer.java   |   4 +-
 .../ep/producer/AtomEntryEntityProducer.java    |   4 +-
 .../producer/XmlCollectionEntityProducer.java   |   2 +-
 .../ep/producer/XmlPropertyEntityProducer.java  |  11 +
 .../ep/ODataEntityProviderPropertiesTest.java   |   4 +
 .../ep/ProducerConsumerIntegrationTest.java     |   3 +-
 .../core/ep/producer/AtomEntryProducerTest.java |  16 ++
 .../core/ep/producer/AtomFeedProducerTest.java  |  16 ++
 odata2-lib/odata-fit/pom.xml                    |   2 +-
 odata2-lib/odata-ref/pom.xml                    |   2 +-
 .../odata2/ref/processor/ListsProcessor.java    |  19 +-
 .../ref/processor/ListsProcessorTest.java       |  80 +++++++
 odata2-lib/odata-testutil/pom.xml               |   2 +-
 odata2-lib/odata-web/pom.xml                    |   2 +-
 odata2-lib/pom.xml                              |   2 +-
 odata2-sample/cars-annotation-archetype/pom.xml |   4 +-
 .../main/resources/archetype-resources/pom.xml  |   2 +-
 odata2-sample/cars-service-archetype/pom.xml    |   4 +-
 .../main/resources/archetype-resources/pom.xml  | 166 +++++++--------
 odata2-sample/pom.xml                           |   2 +-
 pom.xml                                         |   2 +-
 58 files changed, 633 insertions(+), 312 deletions(-)
----------------------------------------------------------------------



[14/35] git commit: [OLINGO-88] Removed not used 'version.html'

Posted by sk...@apache.org.
[OLINGO-88] Removed not used 'version.html'


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/171352a1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/171352a1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/171352a1

Branch: refs/heads/master
Commit: 171352a1061b513f51982aae5d04e42dae6d9368
Parents: 58b6118
Author: Michael Bolz <mi...@apache.org>
Authored: Tue Jan 14 08:48:09 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Tue Jan 14 12:24:44 2014 +0100

----------------------------------------------------------------------
 .../META-INF/maven/archetype-metadata.xml       |   9 +-
 .../src/main/version/version.html               |  29 ------
 .../src/main/webapp/index.jsp                   | 104 +++++++------------
 3 files changed, 43 insertions(+), 99 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/171352a1/odata2-sample/cars-annotation-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/odata2-sample/cars-annotation-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
index 10d3ba2..5a10f46 100644
--- a/odata2-sample/cars-annotation-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/odata2-sample/cars-annotation-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -14,6 +14,9 @@
     <requiredProperty key="version">
       <defaultValue>1.0.0-SNAPSHOT</defaultValue>
     </requiredProperty>
+    <requiredProperty key="package">
+      <defaultValue>org.apache.olingo.sample.annotation</defaultValue>
+    </requiredProperty>
   </requiredProperties>
   <fileSets>
     <fileSet filtered="true" packaged="true" encoding="UTF-8">
@@ -23,12 +26,6 @@
       </includes>
     </fileSet>
     <fileSet filtered="true" encoding="UTF-8">
-      <directory>src/main/version</directory>
-      <includes>
-        <include>**/*.html</include>
-      </includes>
-    </fileSet>
-    <fileSet filtered="true" encoding="UTF-8">
       <directory>src/main/webapp</directory>
       <includes>
         <include>**/*.jsp</include>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/171352a1/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/version/version.html
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/version/version.html b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/version/version.html
deleted file mode 100644
index 512ae83..0000000
--- a/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/version/version.html
+++ /dev/null
@@ -1,29 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-<!--
-
- 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.
-
--->
-<table border="1">
-  <tr><td>name</td><td>${symbol_dollar}{name}</td></tr>
-  <tr><td>version</td><td>${symbol_dollar}{version}</td></tr>
-  <tr><td>timestamp</td><td>${symbol_dollar}{timestamp}</td></tr>
-  <tr><td>project.build.finalName</td><td>${symbol_dollar}{project.build.finalName}</td></tr>
-</table>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/171352a1/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/webapp/index.jsp
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/webapp/index.jsp b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/webapp/index.jsp
index b6f892d..1d43be0 100644
--- a/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/webapp/index.jsp
+++ b/odata2-sample/cars-annotation-archetype/src/main/resources/archetype-resources/src/main/webapp/index.jsp
@@ -1,6 +1,3 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
 <!--
 
  Licensed to the Apache Software Foundation (ASF) under one
@@ -29,11 +26,11 @@
 <title>Apache Olingo - OData2 Library</title>
 <style type="text/css">
 body { font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;
-       color: blue; background-color: ${symbol_pound}ffffff; }
+       color: blue; background-color: #ffffff; }
 a { color: blue; text-decoration: none; }
-a:focus { outline: thin dotted ${symbol_pound}4076cb; outline-offset: -1px; }
+a:focus { outline: thin dotted #4076cb; outline-offset: -1px; }
 a:hover, a:active { outline: 0; }
-a:hover { color: ${symbol_pound}404a7e; text-decoration: underline; }
+a:hover { color: #404a7e; text-decoration: underline; }
 h1, h2, h3, h4, h5, h6 { margin: 9px 0; font-family: inherit; font-weight: bold;
                          line-height: 1; color: blue; }
 h1 { font-size: 36px; line-height: 40px; }
@@ -47,69 +44,48 @@ ul { padding: 0; margin: 0 0 9px 25px; }
 ul ul { margin-bottom: 0; }
 li { line-height: 18px; }
 hr { margin: 18px 0;
-     border: 0; border-top: 1px solid ${symbol_pound}cccccc; border-bottom: 1px solid ${symbol_pound}ffffff; }
+     border: 0; border-top: 1px solid #cccccc; border-bottom: 1px solid #ffffff; }
 table { border-collapse: collapse; border-spacing: 10px; }
 th, td { border: 1px solid; padding: 20px; }
 .code { font-family: "Courier New", monospace; font-size: 13px; line-height: 18px; }
 </style>
 </head>
 <body>
-	<h1>Apache Olingo - OData2 Library</h1>
-	<hr />
-	<h2>Reference Scenario</h2>
-	<table>
-		<tr>
-			<td valign="top">
-				<h3>Service Document and Metadata</h3>
-				<ul>
-					<li><a href="MyFormula.svc?_wadl" target="_blank">wadl</a></li>
-					<li><a href="MyFormula.svc/" target="_blank">service document</a></li>
-					<li><a href="MyFormula.svc/${symbol_dollar}metadata" target="_blank">metadata</a></li>
-				</ul>
-				<h3>EntitySets</h3>
-				<ul>
-					<li><a href="MyFormula.svc/Manufacturers" target="_blank">Manufacturers</a></li>
-					<li><a href="MyFormula.svc/Manufacturers/?${symbol_dollar}expand=Cars" target="_blank">Manufacturers/?${symbol_dollar}expand=Cars</a></li>
-					<li><a href="MyFormula.svc/Cars" target="_blank">Cars</a></li>
-					<li><a href="MyFormula.svc/Cars/?${symbol_dollar}expand=Driver" target="_blank">Cars/?${symbol_dollar}expand=Driver</a></li>
-					<li><a href="MyFormula.svc/Drivers" target="_blank">Drivers</a></li>
-					<li><a href="MyFormula.svc/Drivers/?${symbol_dollar}expand=Car" target="_blank">Drivers/?${symbol_dollar}expand=Car</a></li>
-					<li><a href="MyFormula.svc/Drivers/?${symbol_dollar}orderby=Lastname" target="_blank">Drivers/?${symbol_dollar}orderby=Lastname</a></li>
-					<li><a href="MyFormula.svc/Drivers/?${symbol_dollar}filter=year(Birthday)%20gt%201981" target="_blank">Drivers/?${symbol_dollar}filter=year(Birthday) gt 1981</a></li>
-				</ul>
-				<h3>Entities</h3>
-				<ul>
-					<li><a href="MyFormula.svc/Manufacturers('1')" target="_blank">Manufacturers('1')</a></li>
-					<li><a href="MyFormula.svc/Manufacturers('1')/Cars" target="_blank">Manufacturers('1')/Cars</a></li>
-					<li><a href="MyFormula.svc/Cars('1')" target="_blank">Cars('1')</a></li>
-					<li><a href="MyFormula.svc/Cars('1')/Driver" target="_blank">Cars('1')/Driver</a></li>
-					<li><a href="MyFormula.svc/Cars('1')/?${symbol_dollar}expand=Manufacturer" target="_blank">Cars('1')/?${symbol_dollar}expand=Manufacturer</a></li>
-					<li><a href="MyFormula.svc/Drivers(1)" target="_blank">Drivers(1)</a></li>
-					<li><a href="MyFormula.svc/Drivers(1)/Car" target="_blank">Drivers(1)/Car</a></li>
-				</ul>
-			</td>
-			<td valign="top">
-				&nbsp;
-			</td>
-			<td valign="bottom">
-				<div class="code">
-					<%
-					  String version = "gen/version.html";
-					%>
-					<%
-					  try {
-					%>
-					<jsp:include page='<%=version%>' />
-					<%
-					  } catch (Exception e) {
-					%>
-					<p>IDE Build</p>
-					<%
-					  }
-					%>
-				</div>
-			</td>
-		</tr>
-	</table>
+    <h1>Apache Olingo - OData2 Library</h1>
+    <hr />
+    <h2>Cars Annotation Service</h2>
+    <table>
+        <tr>
+            <td valign="top">
+                <h3>Service Document and Metadata</h3>
+                <ul>
+                    <li><a href="MyFormula.svc?_wadl" target="_blank">wadl</a></li>
+                    <li><a href="MyFormula.svc/" target="_blank">service document</a></li>
+                    <li><a href="MyFormula.svc/$metadata" target="_blank">metadata</a></li>
+                </ul>
+                <h3>EntitySets</h3>
+                <ul>
+                    <li><a href="MyFormula.svc/Manufacturers" target="_blank">Manufacturers</a></li>
+                    <li><a href="MyFormula.svc/Manufacturers/?$expand=Cars" target="_blank">Manufacturers/?$expand=Cars</a></li>
+                    <li><a href="MyFormula.svc/Cars" target="_blank">Cars</a></li>
+                    <li><a href="MyFormula.svc/Cars/?$expand=Driver" target="_blank">Cars/?$expand=Driver</a></li>
+                    <li><a href="MyFormula.svc/Drivers" target="_blank">Drivers</a></li>
+                    <li><a href="MyFormula.svc/Drivers/?$expand=Car" target="_blank">Drivers/?$expand=Car</a></li>
+                    <li><a href="MyFormula.svc/Drivers/?$orderby=Lastname" target="_blank">Drivers/?$orderby=Lastname</a></li>
+                    <li><a href="MyFormula.svc/Drivers/?$filter=year(Birthday)%20gt%201981" target="_blank">Drivers/?$filter=year(Birthday) gt 1981</a></li>
+                </ul>
+                <h3>Entities</h3>
+                <ul>
+                    <li><a href="MyFormula.svc/Manufacturers('1')" target="_blank">Manufacturers('1')</a></li>
+                    <li><a href="MyFormula.svc/Manufacturers('1')/Cars" target="_blank">Manufacturers('1')/Cars</a></li>
+                    <li><a href="MyFormula.svc/Cars('1')" target="_blank">Cars('1')</a></li>
+                    <li><a href="MyFormula.svc/Cars('1')/Driver" target="_blank">Cars('1')/Driver</a></li>
+                    <li><a href="MyFormula.svc/Cars('1')/?$expand=Manufacturer" target="_blank">Cars('1')/?$expand=Manufacturer</a></li>
+                    <li><a href="MyFormula.svc/Drivers(1)" target="_blank">Drivers(1)</a></li>
+                    <li><a href="MyFormula.svc/Drivers(1)/Car" target="_blank">Drivers(1)/Car</a></li>
+                </ul>
+            </td>
+        </tr>
+    </table>
 </body>
 </html>


[35/35] git commit: [OLINGO-117] fix failing delta JSON fit test

Posted by sk...@apache.org.
[OLINGO-117] fix failing delta JSON fit test


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/16106f60
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/16106f60
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/16106f60

Branch: refs/heads/master
Commit: 16106f603ea978336d937ce73f09d629612a435c
Parents: 5b4a459
Author: Stephan Klevenz <sk...@apache.org>
Authored: Mon Feb 10 15:01:12 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Mon Feb 10 15:01:12 2014 +0100

----------------------------------------------------------------------
 .../ep/producer/JsonDeletedEntryEntityProducer.java   |  2 +-
 .../producer/JsonFeedWithDeltaLinkProducerTest.java   |  4 ++++
 .../odata2/fit/client/ClientDeltaResponseTest.java    | 14 ++++++++------
 .../apache/olingo/odata2/fit/client/util/Client.java  |  1 +
 4 files changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/16106f60/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
index 872159f..23f72bc 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
@@ -58,7 +58,7 @@ public class JsonDeletedEntryEntityProducer {
           jsonStreamWriter.namedStringValue(FormatJson.ID, idValue);
           jsonStreamWriter.endObject();
 
-          if (counter < deletedEntries.size()) {
+          if (counter < deletedEntries.size() - 1) {
             jsonStreamWriter.separator();
           }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/16106f60/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
index 97063e6..cf035ae 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
@@ -112,6 +112,7 @@ public class JsonFeedWithDeltaLinkProducerTest extends BaseTest {
     final String json = writeRoomData(entitySet, tombstoneCallback);
 
     assertDeletedEntries(json);
+    assertTrue("Somthing wrong with closing brakets after deleted entries!", json.endsWith("}]}}"));
   }
 
   @Test
@@ -140,6 +141,9 @@ public class JsonFeedWithDeltaLinkProducerTest extends BaseTest {
     assertTrue("Delta Link missing or wrong!", json
         .contains("__delta\":\"http://host:80/service/Rooms?!deltatoken=1234"));
     assertDeletedEntries(json);
+
+    assertTrue("Somthing wrong with closing brakets after deleted entries!", json.contains("}],\"__delta"));
+
   }
 
   private void assertDeletedEntries(final String json) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/16106f60/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
index c3ab652..d91aa24 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
@@ -20,9 +20,9 @@ package org.apache.olingo.odata2.fit.client;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 
 import java.net.URI;
-import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -50,7 +50,6 @@ import org.apache.olingo.odata2.fit.client.util.Client;
 import org.apache.olingo.odata2.ref.edm.ScenarioEdmProvider;
 import org.apache.olingo.odata2.testutil.fit.AbstractFitTest;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class ClientDeltaResponseTest extends AbstractFitTest {
@@ -116,7 +115,7 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
         response = EntityProvider.writeFeed(contentType, uriInfo.getTargetEntitySet(), createRoomData(), properties);
 
         return response;
-      } catch (URISyntaxException e) {
+      } catch (Exception e) {
         throw new ODataRuntimeException(e);
 
       }
@@ -195,7 +194,12 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
     for (int i = 0; i < deletedRoomDataCount; i++) {
       assertEquals("http://localhost:19000/abc/ClientDeltaResponseTest/Rooms('" + (roomDataCount + i + 1) + "')",
           deletedEntries.get(i).getUri());
-      assertNotNull(deletedEntries.get(i).getWhen());
+
+      if ("application/json".equals(contentType)) {
+        assertNull(deletedEntries.get(i).getWhen());
+      } else {
+        assertNotNull(deletedEntries.get(i).getWhen());
+      }
     }
   }
 
@@ -227,7 +231,6 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
   }
 
   @Test
-  @Ignore
   public void testFeedWithDeltaLinkJson() throws Exception {
     testDeltaFeedWithDeltaLink("application/json");
   }
@@ -238,7 +241,6 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
   }
 
   @Test
-  @Ignore
   public void testFeedWithZeroEntriesJson() throws Exception {
     testDeltaFeedWithZeroEntries("application/json");
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/16106f60/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
index dfe27fe..8238926 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
@@ -189,6 +189,7 @@ public class Client {
     EdmEntityContainer entityContainer = edm.getEntityContainer(entityContainerName);
 
     InputStream content = (InputStream) connect(deltaLink, contentType, "GET").getContent();
+    
     return EntityProvider.readDeltaFeed(contentType, entityContainer.getEntitySet(entitySetName), content,
         EntityProviderReadProperties.init().build());
   }


[04/35] git commit: [OLINGO-56] - Enhance the Data Model and the mock data for the reference scenario.

Posted by sk...@apache.org.
[OLINGO-56] - Enhance the Data Model and the mock data for the reference
scenario.


Signed-off-by: Chandan V A <ch...@sap.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/fa108dca
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/fa108dca
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/fa108dca

Branch: refs/heads/master
Commit: fa108dca88d8df65986e7ee5256da5e37ea44b88
Parents: 10af698
Author: Chandan V A <ch...@sap.com>
Authored: Sat Jan 11 20:55:27 2014 +0530
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Tue Jan 14 12:24:42 2014 +0100

----------------------------------------------------------------------
 .../odata2/jpa/processor/ref/model/Address.java | 11 +++
 .../jpa/processor/ref/model/Category.java       | 68 ++++++++++++++++
 .../jpa/processor/ref/model/Customer.java       | 80 ++++++++++++++++++
 .../jpa/processor/ref/model/Material.java       | 22 ++++-
 .../processor/ref/model/SalesOrderHeader.java   | 86 ++++++++------------
 .../src/main/resources/META-INF/persistence.xml |  2 +
 .../extension/SalesOrderHeaderProcessor.java    |  2 +-
 .../extension/_SalesOrderHeaderProcessor.java   |  2 +-
 .../jpa/processor/ref/util/DataGenerator.java   |  4 +-
 .../main/resources/DataDeleteSQLs.properties    | 22 -----
 .../src/main/resources/MaterialSQLs.properties  | 30 -------
 .../src/main/resources/NoteSQLs.properties      | 20 -----
 .../main/resources/SQLInsertConfig.properties   | 22 -----
 .../src/main/resources/SQL_Cleanup.properties   | 22 +++++
 .../resources/SQL_Insert_Category.properties    | 22 +++++
 .../main/resources/SQL_Insert_Config.properties | 22 +++++
 .../resources/SQL_Insert_Customer.properties    | 23 ++++++
 .../resources/SQL_Insert_Material.properties    | 30 +++++++
 .../main/resources/SQL_Insert_Note.properties   | 20 +++++
 .../SQL_Insert_SalesOrderHeader.properties      | 30 +++++++
 .../SQL_Insert_SalesOrderItem.properties        | 30 +++++++
 .../main/resources/SQL_Insert_Store.properties  | 30 +++++++
 .../resources/SalesOrderHeaderSQLs.properties   | 30 -------
 .../resources/SalesOrderItemSQLs.properties     | 30 -------
 .../src/main/resources/StoreSQLs.properties     | 30 -------
 25 files changed, 448 insertions(+), 242 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java
index a0aabcb..ab21848 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java
@@ -48,6 +48,17 @@ public class Address {
 
   @Column(name = "COUNTRY")
   private String country;
+  
+  @Column(name = "PINCODE")
+  private String pincode;
+
+  public String getPincode() {
+    return pincode;
+  }
+
+  public void setPincode(String pincode) {
+    this.pincode = pincode;
+  }
 
   public short getHouseNumber() {
     return houseNumber;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java
new file mode 100644
index 0000000..34891a7
--- /dev/null
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.odata2.jpa.processor.ref.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "T_CATEGORY")
+public class Category {
+
+  @Id
+  @Column(name="CODE")
+  private char code[] = new char[2];
+
+  @Column(name="DESC")
+  private String description;
+
+  @OneToMany(mappedBy = "category")
+  private List<Material> materials = new ArrayList<Material>();
+
+  public List<Material> getMaterials() {
+    return materials;
+  }
+
+  public void setMaterials(List<Material> materials) {
+    this.materials = materials;
+  }
+
+  public char[] getCode() {
+    return code;
+  }
+
+  public void setCode(char[] code) {
+    this.code = code;
+  }
+
+  public String getDescription() {
+    return description;
+  }
+
+  public void setDescription(String description) {
+    this.description = description;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
new file mode 100644
index 0000000..c28e37e
--- /dev/null
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * 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.odata2.jpa.processor.ref.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.Column;
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "T_CUSTOMER")
+public class Customer {
+
+  @Id
+  @Column(name = "ID")
+  private Long id;
+
+  @Column(name = "NAME")
+  private String name;
+
+  @Embedded
+  private Address address;
+
+  @OneToMany(mappedBy = "customer")
+  private List<SalesOrderHeader> orders = new ArrayList<SalesOrderHeader>();
+
+  public Long getId() {
+    return id;
+  }
+
+  public void setId(Long id) {
+    this.id = id;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  public List<SalesOrderHeader> getOrders() {
+    return orders;
+  }
+
+  public void setOrders(List<SalesOrderHeader> orders) {
+    this.orders = orders;
+  }
+
+  public Address getAddress() {
+    return address;
+  }
+
+  public void setAddress(final Address address) {
+    this.address = address;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
index 6f08119..7330042 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
@@ -25,7 +25,9 @@ import java.util.List;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
+import javax.persistence.JoinColumn;
 import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
 import javax.persistence.Table;
 
 @Entity
@@ -34,7 +36,7 @@ public class Material {
 
   public Material() {}
 
-  public Material(final String materialName, final String typeCode, final double price,
+  public Material(final String materialName, final char[] typeCode, final double price,
       final String measurementUnit) {
     super();
     this.materialName = materialName;
@@ -51,7 +53,7 @@ public class Material {
   private String materialName;
 
   @Column(name = "TYPE_CODE")
-  private String typeCode;
+  private char[] typeCode = new char[2];
 
   @Column(name = "PRICE")
   private double price;
@@ -62,6 +64,10 @@ public class Material {
   @ManyToMany
   private List<Store> stores = new ArrayList<Store>();
 
+  @ManyToOne
+  @JoinColumn(name = "TYPE_CODE", referencedColumnName = "CODE")
+  private Category category;
+
   public long getMaterialId() {
     return materialId;
   }
@@ -70,6 +76,14 @@ public class Material {
     this.materialId = materialId;
   }
 
+  public Category getCategory() {
+    return category;
+  }
+
+  public void setCategory(Category category) {
+    this.category = category;
+  }
+
   public String getMaterialName() {
     return materialName;
   }
@@ -78,11 +92,11 @@ public class Material {
     this.materialName = materialName;
   }
 
-  public String getTypeCode() {
+  public char[] getTypeCode() {
     return typeCode;
   }
 
-  public void setTypeCode(final String typeCode) {
+  public void setTypeCode(final char[] typeCode) {
     this.typeCode = typeCode;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java
index 9af23f3..3ed1ee5 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java
@@ -26,11 +26,11 @@ import java.util.List;
 import java.util.Set;
 import java.util.TimeZone;
 
-import javax.persistence.CascadeType;
 import javax.persistence.Column;
-import javax.persistence.Embedded;
 import javax.persistence.Entity;
 import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
 import javax.persistence.OneToMany;
 import javax.persistence.PostPersist;
 import javax.persistence.Table;
@@ -43,14 +43,10 @@ public class SalesOrderHeader {
 
   public SalesOrderHeader() {}
 
-  public SalesOrderHeader(final Calendar creationDate, final int buyerId, final String buyerName,
-      final Address buyerAddress, final String currencyCode, final double netAmount,
+  public SalesOrderHeader(final Calendar creationDate, final String currencyCode, final double netAmount,
       final String deliveryStatus, final char[] shortText, final Character[] longText) {
     super();
     this.creationDate = creationDate;
-    this.buyerId = buyerId;
-    this.buyerName = buyerName;
-    this.buyerAddress = buyerAddress;
     this.currencyCode = currencyCode;
     this.deliveryStatus = deliveryStatus;
     this.shortText = shortText;
@@ -67,29 +63,12 @@ public class SalesOrderHeader {
   @Column
   private Character status;
 
-  public Character getStatus() {
-    return status;
-  }
-
-  public void setStatus(final Character status) {
-    this.status = status;
-  }
-
   @Column(name = "SHORT_TEXT", length = 20)
   private char[] shortText;
 
   @Column(name = "LONG_TEXT", length = 40)
   private Character[] longText;
 
-  @Column(name = "BUYER_ID")
-  private int buyerId;
-
-  @Column(name = "BUYER_NAME", length = 255)
-  private String buyerName;
-
-  @Embedded
-  private Address buyerAddress;
-
   @Column(name = "CURRENCY_CODE", length = 3)
   private String currencyCode;
 
@@ -102,12 +81,43 @@ public class SalesOrderHeader {
   @Column(precision = 8)
   private double netAmount;
 
-  @OneToMany(mappedBy = "salesOrderHeader", cascade = CascadeType.ALL)
+  @Column(name = "CUST_ID")
+  private Long customerId;
+
+  @OneToMany(mappedBy = "salesOrderHeader")
   private Set<SalesOrderItem> salesOrderItem = new HashSet<SalesOrderItem>();
 
-  @OneToMany(mappedBy = "salesOrderHeader", cascade = CascadeType.ALL)
+  @OneToMany(mappedBy = "salesOrderHeader")
   private List<Note> notes = new ArrayList<Note>();
 
+  @ManyToOne
+  @JoinColumn(name = "CUST_ID", referencedColumnName = "ID", insertable = false, updatable = false)
+  private Customer customer;
+
+  public Long getCustomerId() {
+    return customerId;
+  }
+
+  public void setCustomerId(Long customerId) {
+    this.customerId = customerId;
+  }
+
+  public Customer getCustomer() {
+    return customer;
+  }
+
+  public void setCustomer(Customer customer) {
+    this.customer = customer;
+  }
+
+  public Character getStatus() {
+    return status;
+  }
+
+  public void setStatus(final Character status) {
+    this.status = status;
+  }
+
   public long getSoId() {
     return soId;
   }
@@ -138,30 +148,6 @@ public class SalesOrderHeader {
     this.creationDate = newCalendar;
   }
 
-  public int getBuyerId() {
-    return buyerId;
-  }
-
-  public void setBuyerId(final int buyerId) {
-    this.buyerId = buyerId;
-  }
-
-  public String getBuyerName() {
-    return buyerName;
-  }
-
-  public void setBuyerName(final String buyerName) {
-    this.buyerName = buyerName;
-  }
-
-  public Address getBuyerAddress() {
-    return buyerAddress;
-  }
-
-  public void setBuyerAddress(final Address buyerAddress) {
-    this.buyerAddress = buyerAddress;
-  }
-
   public String getCurrencyCode() {
     return currencyCode;
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml b/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
index e71d834..b5ff286 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
+++ b/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
@@ -20,6 +20,8 @@
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Note</class>
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Material</class>
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Store</class>
+		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Category</class>
+		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Customer</class>
 		<properties>
 			<property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" />
 			<property name="javax.persistence.jdbc.url"

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderHeaderProcessor.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderHeaderProcessor.java b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderHeaderProcessor.java
index 57549ee..5dc9017 100644
--- a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderHeaderProcessor.java
+++ b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderHeaderProcessor.java
@@ -106,7 +106,7 @@ public class SalesOrderHeaderProcessor {
     List<SalesOrderHeader> soList = (List<SalesOrderHeader>) q
         .getResultList();
     if (!soList.isEmpty()) {
-      return soList.get(0).getBuyerAddress();
+      return soList.get(0).getCustomer().getAddress();
     } else {
       return null;
     }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/_SalesOrderHeaderProcessor.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/_SalesOrderHeaderProcessor.java b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/_SalesOrderHeaderProcessor.java
index 4bc0a29..bfe0e89 100644
--- a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/_SalesOrderHeaderProcessor.java
+++ b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/_SalesOrderHeaderProcessor.java
@@ -108,7 +108,7 @@ public class _SalesOrderHeaderProcessor {
     List<SalesOrderHeader> soList = (List<SalesOrderHeader>) q
         .getResultList();
     if (!soList.isEmpty()) {
-      return soList.get(0).getBuyerAddress();
+      return soList.get(0).getCustomer().getAddress();
     } else {
       return null;
     }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/util/DataGenerator.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/util/DataGenerator.java b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/util/DataGenerator.java
index 55eb876..e840119 100644
--- a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/util/DataGenerator.java
+++ b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/util/DataGenerator.java
@@ -45,14 +45,14 @@ public class DataGenerator {
   /**
    * This is configuration property to hold comma separated names of Insert Files
    */
-  private static final String SQL_INSERT_CONFIG = "SQLInsertConfig";
+  private static final String SQL_INSERT_CONFIG = "SQL_Insert_Config";
 
   /**
    * This is key which will be used to fetch file names from SQL Insert Config File.
    */
   private static final String SQL_INSERT_FILE_NAMES_KEY = "insert_file_names";
 
-  private static final String SQL_DELETE_CONFIG = "DataDeleteSQLs";
+  private static final String SQL_DELETE_CONFIG = "SQL_Cleanup";
   private static final String SQL_DELETE_STATEMENTS_KEY = "delete_queries";
 
   public DataGenerator(final EntityManager entityManager) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/resources/DataDeleteSQLs.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/DataDeleteSQLs.properties b/odata2-jpa-processor/jpa-web/src/main/resources/DataDeleteSQLs.properties
deleted file mode 100644
index 19f859d..0000000
--- a/odata2-jpa-processor/jpa-web/src/main/resources/DataDeleteSQLs.properties
+++ /dev/null
@@ -1,22 +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.
-#-------------------------------------------------------------------------------
-
-#Config file for deleting the entities. They are deleted in the order provided in the below comma-separated string. 
-#It is mandatory due to referential constaints.
-delete_queries = DELETE FROM T_NOTE,DELETE FROM T_SALESORDERITEM,DELETE FROM T_MATERIAL_T_STORE,DELETE FROM T_MATERIAL,DELETE FROM T_STORE,DELETE FROM T_SALESORDERHEADER
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/resources/MaterialSQLs.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/MaterialSQLs.properties b/odata2-jpa-processor/jpa-web/src/main/resources/MaterialSQLs.properties
deleted file mode 100644
index 0faf9ce..0000000
--- a/odata2-jpa-processor/jpa-web/src/main/resources/MaterialSQLs.properties
+++ /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.
-#-------------------------------------------------------------------------------
-
-material_query_1 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(111, 'Test_Material_Name_1', 'Test_Type_Code_1', 111.1, 'Dollar');
-material_query_2 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(112, 'Test_Material_Name_2', 'Test_Type_Code_2', 112.1, 'Pound');
-material_query_3 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(113, 'Test_Material_Name_3', 'Test_Type_Code_3', 113.1, 'Yen');
-material_query_4 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(114, 'Test_Material_Name_4', 'Test_Type_Code_4', 114.1, 'Rupee');
-material_query_5 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(115, 'Test_Material_Name_5', 'Test_Type_Code_5', 115.1, 'Dollar');
-material_query_6 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(116, 'Test_Material_Name_6', 'Test_Type_Code_6', 116.1, 'Dollar');
-material_query_7 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(117, 'Test_Material_Name_7', 'Test_Type_Code_7', 117.1, 'Dollar');
-material_query_8 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(118, 'Test_Material_Name_8', 'Test_Type_Code_8', 118.1, 'Dollar');
-material_query_9 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(119, 'Test_Material_Name_9', 'Test_Type_Code_9', 119.1, 'Dollar');
-material_query_10 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(120, 'Test_Material_Name_10', 'Test_Type_Code_10', 120.1, 'Dollar');
-material_query_11 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(121, 'Test_Material_Name_11', 'Test_Type_Code_11', 121.1, 'Dollar');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/resources/NoteSQLs.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/NoteSQLs.properties b/odata2-jpa-processor/jpa-web/src/main/resources/NoteSQLs.properties
deleted file mode 100644
index 347c37a..0000000
--- a/odata2-jpa-processor/jpa-web/src/main/resources/NoteSQLs.properties
+++ /dev/null
@@ -1,20 +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.
-#-------------------------------------------------------------------------------
-
-note_query_1 = insert into T_NOTE (SO_ID , text, createdBy, creationDate,creationTime) values(2, 'Test_Note_1', 'CreatedBy_1','2013-01-01 00:00:00','00:00:23');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/resources/SQLInsertConfig.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQLInsertConfig.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQLInsertConfig.properties
deleted file mode 100644
index 915a8e8..0000000
--- a/odata2-jpa-processor/jpa-web/src/main/resources/SQLInsertConfig.properties
+++ /dev/null
@@ -1,22 +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.
-#-------------------------------------------------------------------------------
-
-#This file contains names of file which will contain the SQL statements to be executed by Data generator. Add a file name here and it will be picked up by Generator
-#You need to put the file names in order you want to get them called. First Entry will be inserted first.
-insert_file_names = SalesOrderHeaderSQLs,StoreSQLs,MaterialSQLs,SalesOrderItemSQLs,NoteSQLs
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Cleanup.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Cleanup.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Cleanup.properties
new file mode 100644
index 0000000..19f859d
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Cleanup.properties
@@ -0,0 +1,22 @@
+#-------------------------------------------------------------------------------
+# 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.
+#-------------------------------------------------------------------------------
+
+#Config file for deleting the entities. They are deleted in the order provided in the below comma-separated string. 
+#It is mandatory due to referential constaints.
+delete_queries = DELETE FROM T_NOTE,DELETE FROM T_SALESORDERITEM,DELETE FROM T_MATERIAL_T_STORE,DELETE FROM T_MATERIAL,DELETE FROM T_STORE,DELETE FROM T_SALESORDERHEADER
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Category.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Category.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Category.properties
new file mode 100644
index 0000000..86d4a13
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Category.properties
@@ -0,0 +1,22 @@
+#-------------------------------------------------------------------------------
+# 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.
+#-------------------------------------------------------------------------------
+query_1 = INSERT INTO T_CATEGORY (CODE,DESC) VALUES('P1','Pen');
+query_2 = INSERT INTO T_CATEGORY (CODE,DESC) VALUES('P2','Pencil');
+query_3 = INSERT INTO T_CATEGORY (CODE,DESC) VALUES('S1','Sharpner');
+query_4 = INSERT INTO T_CATEGORY (CODE,DESC) VALUES('E1','Eraser');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Config.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Config.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Config.properties
new file mode 100644
index 0000000..5910123
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Config.properties
@@ -0,0 +1,22 @@
+#-------------------------------------------------------------------------------
+# 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.
+#-------------------------------------------------------------------------------
+
+#This file contains names of file which will contain the SQL statements to be executed by Data generator. Add a file name here and it will be picked up by Generator
+#You need to put the file names in order you want to get them called. First Entry will be inserted first.
+insert_file_names = SQL_Insert_Customer,SQL_Insert_Category,SQL_Insert_SalesOrderHeader,SQL_Insert_Store,SQL_Insert_Material,SQL_Insert_SalesOrderItem,SQL_Insert_Note
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Customer.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Customer.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Customer.properties
new file mode 100644
index 0000000..e718a01
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Customer.properties
@@ -0,0 +1,23 @@
+#-------------------------------------------------------------------------------
+# 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.
+#-------------------------------------------------------------------------------
+query_1 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE) VALUES(100,'Bob Bryan',7,'5 cross Street', 'London', 'UK',  'E7');
+query_2 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE) VALUES(200,'Mike Bryan',7,'8 cross Street', 'New York', 'USA',  '10011');
+query_3 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE) VALUES(201,'Steve Roger',7,'9 cross Street', 'Mumbai', 'India', '200101');
+query_4 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE) VALUES(101,'Pac Man',7,'25 cross Street', 'Frankfurt', 'Germany',  '60001');
+query_5 = INSERT INTO T_CUSTOMER (ID , NAME, HOUSE_NUMBER , STREET_NAME, CITY, COUNTRY, PINCODE) VALUES(202,'Bolt Man',7,'25 cross Street', 'Toronto', 'Canada',  'NE');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Material.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Material.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Material.properties
new file mode 100644
index 0000000..7ea5ade
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Material.properties
@@ -0,0 +1,30 @@
+#-------------------------------------------------------------------------------
+# 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.
+#-------------------------------------------------------------------------------
+
+material_query_1 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(111, 'My Pen', 'P1', 111.1, 'Piece');
+material_query_2 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(112, 'My Great Pen', 'P1', 112.1, 'Piece');
+material_query_3 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(113, 'Super Pen', 'P1', 113.1, 'Piece');
+material_query_4 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(114, 'Marvel Pen', 'P1', 114.1, 'Piece');
+material_query_5 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(115, 'Smooth', 'P2', 115.1, 'Piece');
+material_query_6 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(116, 'Silver Line', 'P2', 116.1, 'Piece');
+material_query_7 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(117, 'Dark Line', 'P2', 117.1, 'Piece');
+material_query_8 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(118, 'Sharp', 'S1', 118.1, 'Piece');
+material_query_9 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(119, 'Cut Sharp', 'S1', 119.1, 'Piece');
+material_query_10 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(120, 'Thin line', 'S1', 120.1, 'Piece');
+material_query_11 = insert into T_MATERIAL (MATERIAL_ID , MATERIAL_NAME, TYPE_CODE, PRICE, MEASUREMENT_UNIT) values(121, 'Clean', 'E1', 121.1, 'Piece');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Note.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Note.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Note.properties
new file mode 100644
index 0000000..347c37a
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Note.properties
@@ -0,0 +1,20 @@
+#-------------------------------------------------------------------------------
+# 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.
+#-------------------------------------------------------------------------------
+
+note_query_1 = insert into T_NOTE (SO_ID , text, createdBy, creationDate,creationTime) values(2, 'Test_Note_1', 'CreatedBy_1','2013-01-01 00:00:00','00:00:23');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderHeader.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderHeader.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderHeader.properties
new file mode 100644
index 0000000..b5ebf24
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderHeader.properties
@@ -0,0 +1,30 @@
+#-------------------------------------------------------------------------------
+# 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.
+#-------------------------------------------------------------------------------
+
+query1 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(1, 100, 'INR', '01', '2012-11-01 00:01:00');
+query2 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(2, 100, 'USD', '01', '2013-01-02 00:00:00');
+query3 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(3, 100, 'USD', '02', '2013-01-01 14:00:00');
+query4 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(4, 200, 'INR', '01', '2013-01-02 00:00:00');
+query5 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(5, 201, 'INR', '02', '2013-01-01 14:14:14');
+query6 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(6, 101, 'EUR', '01', '2013-01-02 00:00:00');
+query7 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(7, 201, 'EUR', '02', '2013-01-01 14:14:00');
+query8 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(8, 201, 'GBR', '01', '2013-01-02 00:00:00');
+query9 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(9, 101, 'GBR', '02', '2013-01-01 00:00:00');
+query10 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(10, 100, 'AUD', '01', '2013-01-01 00:00:00');
+query11 = insert into T_SALESORDERHEADER (SO_ID, CUST_ID, CURRENCY_CODE, DELIVERY_STATUS, creationDate) values(11, 202, 'AUD', '02', '2013-01-02 00:00:00');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderItem.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderItem.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderItem.properties
new file mode 100644
index 0000000..ed93834
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_SalesOrderItem.properties
@@ -0,0 +1,30 @@
+#-------------------------------------------------------------------------------
+# 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.
+#-------------------------------------------------------------------------------
+
+line_item_query1 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(111, 1, 10.1, 1.11, 3, 11);
+line_item_query2 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(112, 1, 111.1, 1.12, 2, 10);
+line_item_query3 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(113, 1, 211.1, 1.13, 3, 9);
+line_item_query4 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(114, 1, 221.1, 1.14, 4, 8);
+line_item_query5 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(115, 1, 651.1, 1.15, 5, 7);
+line_item_query6 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(116, 1, 653.21, 1.16, 6, 6);
+line_item_query7 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(117, 1, 57.11, 1.17, 7, 5);
+line_item_query8 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(118, 1, 52.98, 1.18, 8, 4);
+line_item_query9 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(119, 1, 78.99, 1.19, 9, 3);
+line_item_query10 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(120, 1,69.23, 1.20, 10, 2);
+line_item_query11 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(121, 1, 356.65, 1.21, 3, 1);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Store.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Store.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Store.properties
new file mode 100644
index 0000000..20860f2
--- /dev/null
+++ b/odata2-jpa-processor/jpa-web/src/main/resources/SQL_Insert_Store.properties
@@ -0,0 +1,30 @@
+#-------------------------------------------------------------------------------
+# 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.
+#-------------------------------------------------------------------------------
+
+store_query_1 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(131, 'Store New York', 11, 'New York Street', 'New York', 'USA','10001');
+store_query_2 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(132, 'Store Bengaluru', 21, 'Whitefield', 'Bengaluru', 'India','560037');
+store_query_3 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(133, 'Store Toronto', 31, 'Toronto Street', 'Toronto', 'Canada','M4J');
+store_query_4 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(134, 'Store Chicago', 41, 'Chicago Street', 'Chicago', 'USA','60625');
+store_query_5 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(135, 'Store Chennai', 51, 'Park Street', 'Chennai', 'India','600021');
+store_query_6 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(136, 'Store Frankfurt', 61, 'Frankfurt Street', 'Frankfurt', 'Germany','60001');
+store_query_7 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(137, 'Store Berlin', 71, 'Berlin Street', 'Berlin', 'Germany','10115');
+store_query_8 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(138, 'Store Hamburg', 81, 'Hamburg Street', 'Hamburg', 'Germany','20001');
+store_query_9 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(139, 'Store New Delhi', 91, 'New Delhi Street', 'New Delhi', 'India','110001');
+store_query_10 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(140, 'Store Ottawa', 100, 'Ottawa Street', 'Ottawa', 'Canada','K0A');
+store_query_11 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY, PINCODE) values(141, 'Store Kolkata', 101, 'Kolkata Street', 'Kolkata', 'India','310001');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/resources/SalesOrderHeaderSQLs.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SalesOrderHeaderSQLs.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SalesOrderHeaderSQLs.properties
deleted file mode 100644
index bc3e5a3..0000000
--- a/odata2-jpa-processor/jpa-web/src/main/resources/SalesOrderHeaderSQLs.properties
+++ /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.
-#-------------------------------------------------------------------------------
-
-query1 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(20130320170725, 1, 'buyerName_1', 'INR', '01', '2012-11-01 00:01:00', 1, 'Test_Street_Name_1', 'Test_City_1', 'Test_Country_1');
-query2 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(2, 2, 'buyerName_2', 'USD', '01', '2013-01-02 00:00:00', 2, 'Test_Street_Name_2', 'Test_City_2', 'Test_Country_2');
-query3 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(3, 3, 'buyerName_3', 'USD', '02', '2013-01-01 14:00:00', 3, 'Test_Street_Name_3', 'Test_City_3', 'Test_Country_3');
-query4 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(4, 4, 'buyerName_4', 'INR', '01', '2013-01-02 00:00:00', 4, 'Test_Street_Name_4', 'Test_City_4', 'Test_Country_4');
-query5 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(5, 5, 'buyerName_5', 'INR', '02', '2013-01-01 14:14:14', 5, 'Test_Street_Name_5', 'Test_City_5', 'Test_Country_5');
-query6 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(6, 6, 'buyerName_6', 'EUR', '01', '2013-01-02 00:00:00', 6, 'Test_Street_Name_6', 'Test_City_6', 'Test_Country_6');
-query7 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(7, 7, 'buyerName_7', 'EUR', '02', '2013-01-01 14:14:00', 7, 'Test_Street_Name_7', 'Test_City_7', 'Test_Country_7');
-query8 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(8, 8, 'buyerName_8', 'GBR', '01', '2013-01-02 00:00:00', 8, 'Test_Street_Name_8', 'Test_City_8', 'Test_Country_8');
-query9 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(9, 9, 'buyerName_9', 'GBR', '02', '2013-01-01 00:00:00', 9, 'Test_Street_Name_9', 'Test_City_9', 'Test_Country_9');
-query10 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(10, 10, 'buyerName_10', 'AUD', '01', '2013-01-01 00:00:00', 10, 'Test_Street_Name_10', 'Test_City_10', 'Test_Country_10');
-query11 = insert into T_SALESORDERHEADER (SO_ID, BUYER_ID, BUYER_NAME, CURRENCY_CODE, DELIVERY_STATUS, creationDate, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(11, 11, 'buyerName_11', 'AUD', '02', '2013-01-02 00:00:00', 7, 'Test_Street_Name_11', 'Test_City_11', 'Test_Country_3');
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/resources/SalesOrderItemSQLs.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/SalesOrderItemSQLs.properties b/odata2-jpa-processor/jpa-web/src/main/resources/SalesOrderItemSQLs.properties
deleted file mode 100644
index ed93834..0000000
--- a/odata2-jpa-processor/jpa-web/src/main/resources/SalesOrderItemSQLs.properties
+++ /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.
-#-------------------------------------------------------------------------------
-
-line_item_query1 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(111, 1, 10.1, 1.11, 3, 11);
-line_item_query2 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(112, 1, 111.1, 1.12, 2, 10);
-line_item_query3 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(113, 1, 211.1, 1.13, 3, 9);
-line_item_query4 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(114, 1, 221.1, 1.14, 4, 8);
-line_item_query5 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(115, 1, 651.1, 1.15, 5, 7);
-line_item_query6 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(116, 1, 653.21, 1.16, 6, 6);
-line_item_query7 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(117, 1, 57.11, 1.17, 7, 5);
-line_item_query8 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(118, 1, 52.98, 1.18, 8, 4);
-line_item_query9 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(119, 1, 78.99, 1.19, 9, 3);
-line_item_query10 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(120, 1,69.23, 1.20, 10, 2);
-line_item_query11 = insert into T_SALESORDERITEM (Material_Id , quantity , amount , discount , Sales_Order_Id , Sales_Order_Item_Id ) values(121, 1, 356.65, 1.21, 3, 1);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/fa108dca/odata2-jpa-processor/jpa-web/src/main/resources/StoreSQLs.properties
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/resources/StoreSQLs.properties b/odata2-jpa-processor/jpa-web/src/main/resources/StoreSQLs.properties
deleted file mode 100644
index 69af954..0000000
--- a/odata2-jpa-processor/jpa-web/src/main/resources/StoreSQLs.properties
+++ /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.
-#-------------------------------------------------------------------------------
-
-store_query_1 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(131, 'Test_Store_1', 1, 'Test_Street_Name_1', 'Test_City_1', 'Test_Country_1');
-store_query_2 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(132, 'Test_Store_2', 1, 'Test_Street_Name_2', 'Test_City_2', 'Test_Country_2');
-store_query_3 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(133, 'Test_Store_3', 1, 'Test_Street_Name_3', 'Test_City_3', 'Test_Country_3');
-store_query_4 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(134, 'Test_Store_4', 1, 'Test_Street_Name_4', 'Test_City_4', 'Test_Country_4');
-store_query_5 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(135, 'Test_Store_5', 1, 'Test_Street_Name_5', 'Test_City_5', 'Test_Country_5');
-store_query_6 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(136, 'Test_Store_6', 1, 'Test_Street_Name_6', 'Test_City_6', 'Test_Country_6');
-store_query_7 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(137, 'Test_Store_7', 1, 'Test_Street_Name_7', 'Test_City_7', 'Test_Country_7');
-store_query_8 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(138, 'Test_Store_8', 1, 'Test_Street_Name_8', 'Test_City_8', 'Test_Country_8');
-store_query_9 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(139, 'Test_Store_9', 1, 'Test_Street_Name_9', 'Test_City_9', 'Test_Country_9');
-store_query_10 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(140, 'Test_Store_10', 1, 'Test_Street_Name_10', 'Test_City_10', 'Test_Country_10');
-store_query_11 = insert into T_STORE (STORE_ID , STORE_NAME, HOUSE_NUMBER, STREET_NAME, CITY, COUNTRY) values(141, 'Test_Store_11', 1, 'Test_Street_Name_11', 'Test_City_11', 'Test_Country_11');
\ No newline at end of file


[16/35] git commit: [OLINGO-117] more Junit tests

Posted by sk...@apache.org.
[OLINGO-117] more Junit tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/c3930ed1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/c3930ed1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/c3930ed1

Branch: refs/heads/master
Commit: c3930ed1f2fe94a8628669dc9c020596b06704fb
Parents: 0848b54
Author: Stephan Klevenz <sk...@apache.org>
Authored: Tue Jan 14 14:31:22 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Tue Jan 14 14:31:22 2014 +0100

----------------------------------------------------------------------
 .../producer/JsonFeedWithDeltaLinkProducerTest.java   | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/c3930ed1/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
index a3c5fc0..3095b7a 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
@@ -115,6 +115,20 @@ public class JsonFeedWithDeltaLinkProducerTest extends BaseTest {
   }
 
   @Test
+  public void deletedEntriesEmpty() throws Exception {
+    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
+
+    deletedRoomData.clear();
+    
+    TombstoneCallback tombstoneCallback =
+        new TombstoneCallbackImpl(deletedRoomData, null);
+
+    final String json = writeRoomData(entitySet, tombstoneCallback);
+
+    assertTrue("Something wrong with empty deletedRoomData list!", json.contains("nr_Building\"}}}]}}"));
+  }
+
+  @Test
   public void deletedEntriesAndDeltaLink() throws Exception {
     final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
 


[25/35] git commit: [OLINGO-117] TDD implementation

Posted by sk...@apache.org.
[OLINGO-117] TDD implementation


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/38539fe2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/38539fe2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/38539fe2

Branch: refs/heads/master
Commit: 38539fe228a7f0651d1fee7667000c0faf1fa634
Parents: 2de6df2
Author: Stephan Klevenz <sk...@apache.org>
Authored: Tue Jan 21 12:25:48 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Thu Jan 23 17:21:31 2014 +0100

----------------------------------------------------------------------
 .../odata2/core/ep/consumer/XmlFeedConsumer.java      | 14 ++++++++++++++
 .../odata2/core/ep/consumer/XmlFeedConsumerTest.java  |  4 ++++
 2 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/38539fe2/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java
index a20f2f2..b5902f4 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java
@@ -34,6 +34,7 @@ import org.apache.olingo.odata2.api.ep.entry.EntryMetadata;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.core.ep.aggregator.EntityInfoAggregator;
+import org.apache.olingo.odata2.core.ep.entry.EntryMetadataImpl;
 import org.apache.olingo.odata2.core.ep.feed.FeedMetadataImpl;
 import org.apache.olingo.odata2.core.ep.feed.ODataFeedImpl;
 import org.apache.olingo.odata2.core.ep.util.FormatXml;
@@ -110,6 +111,19 @@ public class XmlFeedConsumer {
       if (FormatXml.ATOM_ENTRY.equals(reader.getLocalName())) {
         ODataEntry entry = xec.readEntry(reader, eia, entryReadProperties);
         results.add(entry);
+      } else if (FormatXml.ATOM_TOMBSTONE_DELETED_ENTRY.equals(reader.getLocalName())) {
+        EntryMetadataImpl deletedEntryMetadata = new EntryMetadataImpl();
+        
+        String uri = reader.getAttributeValue(FormatXml.ATOM_TOMBSTONE_NAMESPACE, FormatXml.ATOM_TOMBSTONE_REF);
+        String date = reader.getAttributeValue(FormatXml.ATOM_TOMBSTONE_NAMESPACE, FormatXml.ATOM_TOMBSTONE_WHEN);
+        String id = uri;
+        
+        reader.nextTag();
+        
+        deletedEntryMetadata.setUri(uri);
+        deletedEntryMetadata.setId(id);
+        
+        deletedEntries.add(deletedEntryMetadata);
       } else if (FormatXml.M_COUNT.equals(reader.getLocalName())) {
         reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_M_2007_08, FormatXml.M_COUNT);
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/38539fe2/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java
index b2c6267..a05c377 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java
@@ -152,5 +152,9 @@ public class XmlFeedConsumerTest extends AbstractXmlConsumerTest {
     assertTrue(feed.isDeltaFeed());
     
     assertNotNull(feed.getDeletedEntries());
+    assertNotNull(feed.getEntries());
+    
+    assertEquals(1, feed.getEntries().size());
+    assertEquals(1, feed.getDeletedEntries().size());
   }
 }


[07/35] git commit: [OLINGO-113] Fixed null compare and added tests

Posted by sk...@apache.org.
[OLINGO-113] Fixed null compare and added tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/42290ba6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/42290ba6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/42290ba6

Branch: refs/heads/master
Commit: 42290ba604a43761820583fb1485b12b3671330b
Parents: 3c327f2
Author: Michael Bolz <mi...@apache.org>
Authored: Thu Jan 9 13:30:21 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Tue Jan 14 12:24:42 2014 +0100

----------------------------------------------------------------------
 .../core/datasource/AnnotationInMemoryDs.java   | 49 +++++++++++++++--
 .../datasource/AnnotationsInMemoryDsTest.java   | 58 ++++++++++++++++++++
 2 files changed, 101 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/42290ba6/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java
index b389fa4..2f8fa10 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java
@@ -17,10 +17,12 @@ package org.apache.olingo.odata2.annotation.processor.core.datasource;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.olingo.odata2.annotation.processor.core.datasource.DataStore.DataStoreException;
 import org.apache.olingo.odata2.annotation.processor.core.util.AnnotationHelper;
 import org.apache.olingo.odata2.annotation.processor.core.util.AnnotationHelper.AnnotatedNavInfo;
 import org.apache.olingo.odata2.annotation.processor.core.util.AnnotationHelper.ODataAnnotationException;
@@ -44,11 +46,11 @@ public class AnnotationInMemoryDs implements DataSource {
   private final Map<String, DataStore<Object>> dataStores = new HashMap<String, DataStore<Object>>();
   private final boolean persistInMemory;
 
-  public AnnotationInMemoryDs(Collection<Class<?>> annotatedClasses) throws ODataException {
+  public AnnotationInMemoryDs(final Collection<Class<?>> annotatedClasses) throws ODataException {
     this(annotatedClasses, true);
   }
 
-  public AnnotationInMemoryDs(Collection<Class<?>> annotatedClasses, boolean persistInMemory) throws ODataException {
+  public AnnotationInMemoryDs(final Collection<Class<?>> annotatedClasses, final boolean persistInMemory) throws ODataException {
     this.persistInMemory = persistInMemory;
     init(annotatedClasses);
   }
@@ -82,6 +84,7 @@ public class AnnotationInMemoryDs implements DataSource {
     }
   }
 
+  @SuppressWarnings("unchecked")
   public <T> DataStore<T> getDataStore(final Class<T> clazz) {
     String entitySetName = ANNOTATION_HELPER.extractEntitySetName(clazz);
     return (DataStore<T>) dataStores.get(entitySetName);
@@ -141,7 +144,26 @@ public class AnnotationInMemoryDs implements DataSource {
           + "', targetStore='" + targetStore + "').");
     }
 
+    List<Object> resultData = readResultData(targetStore, sourceData, sourceField);
+    return extractResultData(targetStore, targetKeys, navInfo, resultData);
+  }
+
+  /**
+   * Read the result data from the target store based on <code>sourceData</code> and <code>sourceField</code>
+   * 
+   * @param targetStore
+   * @param sourceData
+   * @param sourceField
+   * @return
+   * @throws DataStoreException
+   */
+  private List<Object> readResultData(final DataStore<?> targetStore, final Object sourceData, final Field sourceField)
+      throws DataStoreException {
     Object navigationInstance = getValue(sourceField, sourceData);
+    if (navigationInstance == null) {
+      return Collections.emptyList();
+    }
+
     List<Object> resultData = new ArrayList<Object>();
     for (Object targetInstance : targetStore.read()) {
       if (navigationInstance instanceof Collection) {
@@ -154,7 +176,22 @@ public class AnnotationInMemoryDs implements DataSource {
         resultData.add(targetInstance);
       }
     }
+    return resultData;
+  }
 
+  /**
+   * Extract the <code>result data</code> from the <code>resultData</code> list based on 
+   * <code>navigation information</code> and <code>targetKeys</code>.
+   * 
+   * @param targetStore
+   * @param targetKeys
+   * @param navInfo
+   * @param resultData
+   * @return
+   * @throws DataStoreException
+   */
+  private Object extractResultData(final DataStore<?> targetStore, final Map<String, Object> targetKeys,
+      final AnnotatedNavInfo navInfo, final List<Object> resultData) throws DataStoreException {
     if (navInfo.getToMultiplicity() == EdmMultiplicity.MANY) {
       if (targetKeys.isEmpty()) {
         return resultData;
@@ -183,15 +220,15 @@ public class AnnotationInMemoryDs implements DataSource {
     Object data = ANNOTATION_HELPER.getValueForField(mediaLinkEntryData, EdmMediaResourceContent.class);
     Object mimeType = ANNOTATION_HELPER.getValueForField(mediaLinkEntryData, EdmMediaResourceMimeType.class);
 
-    if(data == null && mimeType == null) {
+    if (data == null && mimeType == null) {
       DataStore<Object> dataStore = getDataStore(entitySet);
       Object readEntry = dataStore.read(mediaLinkEntryData);
-      if(readEntry != null) {
+      if (readEntry != null) {
         data = ANNOTATION_HELPER.getValueForField(readEntry, EdmMediaResourceContent.class);
         mimeType = ANNOTATION_HELPER.getValueForField(readEntry, EdmMediaResourceMimeType.class);
       }
     }
-    
+
     return new BinaryData((byte[]) data, String.valueOf(mimeType));
   }
 
@@ -215,7 +252,7 @@ public class AnnotationInMemoryDs implements DataSource {
     try {
       DataStore<Object> dataStore = getDataStore(entitySet);
       Object readEntry = dataStore.read(mediaEntityInstance);
-      if(readEntry == null) {
+      if (readEntry == null) {
         throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
       } else {
         ANNOTATION_HELPER.setValueForAnnotatedField(

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/42290ba6/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java
index cff39b9..3213556 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java
@@ -399,6 +399,64 @@ public class AnnotationsInMemoryDsTest {
   }
 
   @Test
+  @SuppressWarnings("unchecked")
+  public void readRelatedEntity() throws Exception {
+    EdmEntitySet buildingsEntitySet = createMockedEdmEntitySet("Buildings");
+    EdmEntitySet roomsEntitySet = createMockedEdmEntitySet("Rooms");
+
+    Building building = new Building();
+    building.setName("Common Building");
+
+    Room room = new Room(12, "Room 12");
+    room.setBuilding(building);
+    datasource.createData(roomsEntitySet, room);
+    datasource.createData(buildingsEntitySet, building);
+
+    Map<String, Object> keys = new HashMap<String, Object>();
+    keys.put("Id", Integer.valueOf(12));
+    Room read = (Room) datasource.readData(roomsEntitySet, keys);
+    Assert.assertEquals("Room 12", read.getName());
+    Assert.assertEquals("12", read.getId());
+    
+    // execute
+    Object relatedData = datasource.readRelatedData(
+        roomsEntitySet, room, buildingsEntitySet, Collections.EMPTY_MAP);
+
+    // validate
+    Assert.assertTrue("Result is no room.", relatedData instanceof Building);
+    Building b = (Building) relatedData;
+    Assert.assertEquals("Common Building", b.getName());
+  }
+
+  @Test
+  @SuppressWarnings("unchecked")
+  public void readRelatedEntityWithNull() throws Exception {
+    EdmEntitySet buildingsEntitySet = createMockedEdmEntitySet("Buildings");
+    EdmEntitySet roomsEntitySet = createMockedEdmEntitySet("Rooms");
+
+    Building building = new Building();
+    building.setName("Common Building");
+    datasource.createData(buildingsEntitySet, building);
+
+    Room room = new Room(12, "Room 12");
+    room.setBuilding(null);
+    datasource.createData(roomsEntitySet, room);
+    //
+    Map<String, Object> keys = new HashMap<String, Object>();
+    keys.put("Id", Integer.valueOf(12));
+    Room read = (Room) datasource.readData(roomsEntitySet, keys);
+    Assert.assertEquals("Room 12", read.getName());
+    Assert.assertEquals("12", read.getId());
+
+    // execute
+    Object relatedData = datasource.readRelatedData(
+        roomsEntitySet, room, buildingsEntitySet, Collections.EMPTY_MAP);
+
+    // validate
+    Assert.assertNull("Related data must be null.", relatedData);
+  }
+
+  @Test
   public void readRelatedTargetEntity() throws Exception {
     EdmEntitySet buildingsEntitySet = createMockedEdmEntitySet("Buildings");
     EdmEntitySet roomsEntitySet = createMockedEdmEntitySet("Rooms");


[12/35] git commit: [OLINGO-49], [OLINGO-51] Support for A) Linking entities using tag within an OData Entry B) Updating links C) Deleting links D) Code Cleanup

Posted by sk...@apache.org.
[OLINGO-49],[OLINGO-51]
Support for 
A) Linking entities using <link> tag within an OData Entry
B) Updating links
C) Deleting links
D) Code Cleanup

Signed-off-by: Chandan V A <ch...@sap.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/352f5412
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/352f5412
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/352f5412

Branch: refs/heads/master
Commit: 352f5412d79579f4205707ddd88f57e599ff23a2
Parents: fa108dc
Author: Chandan V A <ch...@sap.com>
Authored: Sun Jan 12 23:09:04 2014 +0530
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Tue Jan 14 12:24:43 2014 +0100

----------------------------------------------------------------------
 .../jpa/processor/api/ODataJPAProcessor.java    |   2 +-
 .../api/factory/JPQLBuilderFactory.java         |   2 +-
 .../api/model/JPAEdmComplexTypeView.java        |   4 +-
 .../processor/api/model/JPAEdmPropertyView.java |   9 +
 .../jpa/processor/core/ODataEntityParser.java   | 127 ++++----
 .../core/ODataJPAProcessorDefault.java          |   8 +
 .../processor/core/access/data/JPAEntity.java   |  28 +-
 .../jpa/processor/core/access/data/JPALink.java | 318 ++++++++++++-------
 .../core/access/data/JPAProcessorImpl.java      |  18 +-
 .../access/model/JPAEdmMappingModelService.java |   2 +-
 .../core/access/model/JPAEdmNameBuilder.java    |   9 +-
 .../processor/core/model/JPAEdmMappingImpl.java |   1 -
 .../processor/core/model/JPAEdmProperty.java    |  81 +++--
 .../core/model/JPAEdmReferentialConstraint.java |   2 +-
 .../model/JPAEdmReferentialConstraintRole.java  |   2 +-
 .../processor/core/ODataEntityParserTest.java   | 226 +++++++++++++
 .../core/ODataExpressionParserTest.java         |   1 -
 .../processor/core/ODataJPAContextImplTest.java |   1 -
 .../core/ODataJPAProcessorDefaultTest.java      |   2 +-
 .../core/access/data/JPAEntityParserTest.java   |   1 -
 .../JPAEntityParserTestForStaticMethods.java    |   1 -
 .../core/access/data/JPAEntityTest.java         |   3 +-
 .../core/access/data/JPAExpandCallBackTest.java |   1 -
 .../access/data/JPAFunctionContextTest.java     |   1 -
 .../processor/core/access/data/JPALinkTest.java |   5 +
 .../core/access/data/JPAProcessorImplTest.java  |   2 +-
 .../model/JPAEdmMappingModelServiceTest.java    |   1 -
 .../access/model/JPAEdmNameBuilderTest.java     |   2 -
 .../core/access/model/JPATypeConvertorTest.java |   1 -
 .../edm/ODataJPAEdmProviderNegativeTest.java    |   1 -
 .../core/edm/ODataJPAEdmProviderTest.java       |   1 -
 .../core/jpql/JPQLBuilderFactoryTest.java       |   6 +-
 .../core/jpql/JPQLJoinContextTest.java          |   1 -
 .../jpql/JPQLJoinSelectSingleContextTest.java   |   1 -
 ...PQLJoinSelectSingleStatementBuilderTest.java |   1 -
 .../core/jpql/JPQLJoinStatementBuilderTest.java |   1 -
 .../core/jpql/JPQLSelectContextImplTest.java    |   1 -
 .../jpql/JPQLSelectSingleContextImplTest.java   |   1 -
 .../JPQLSelectSingleStatementBuilderTest.java   |   4 +-
 .../jpql/JPQLSelectStatementBuilderTest.java    |   4 +-
 .../processor/core/mock/ODataContextMock.java   |  48 +++
 .../core/mock/ODataJPAContextMock.java          |  15 +
 .../processor/core/mock/ODataServiceMock.java   | 106 +++++++
 .../jpa/processor/core/mock/PathInfoMock.java   |  51 +++
 .../processor/core/mock/PathSegmentMock.java    |  44 +++
 .../processor/core/mock/data/EdmMockUtilV2.java |  27 +-
 .../core/model/JPAEdmAssociationEndTest.java    |   1 -
 .../core/model/JPAEdmAssociationSetTest.java    |   1 -
 .../core/model/JPAEdmAssociationTest.java       |   5 +-
 .../core/model/JPAEdmBaseViewImplTest.java      |   1 -
 .../core/model/JPAEdmComplexTypeTest.java       |   2 -
 .../core/model/JPAEdmEntityContainerTest.java   |   1 -
 .../core/model/JPAEdmEntitySetTest.java         |   1 -
 .../core/model/JPAEdmEntityTypeTest.java        |   1 -
 .../core/model/JPAEdmFunctionImportTest.java    |   1 -
 .../jpa/processor/core/model/JPAEdmKeyTest.java |   1 -
 .../processor/core/model/JPAEdmModelTest.java   |   1 -
 .../model/JPAEdmNavigationPropertyTest.java     |   1 -
 .../core/model/JPAEdmPropertyTest.java          |   5 +-
 .../JPAEdmReferentialConstraintRoleTest.java    |   2 -
 .../model/JPAEdmReferentialConstraintTest.java  |   1 -
 .../processor/core/model/JPAEdmSchemaTest.java  |   1 -
 .../core/model/JPAEdmTestModelView.java         |  10 +-
 .../core/model/_JPAEdmFunctionImportTest.java   |   1 -
 .../odata2/jpa/processor/ref/model/Address.java |   4 +-
 .../jpa/processor/ref/model/Category.java       |  10 +-
 .../jpa/processor/ref/model/Customer.java       |   6 +-
 .../jpa/processor/ref/model/Material.java       |  14 +-
 .../processor/ref/model/SalesOrderHeader.java   |   4 +-
 .../src/main/resources/META-INF/persistence.xml |   4 +-
 .../jpa/processor/ref/extension/OrderValue.java |   4 +-
 .../SalesOrderProcessingExtension.java          |  12 +-
 72 files changed, 959 insertions(+), 310 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAProcessor.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAProcessor.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAProcessor.java
index d08eee9..127c79a 100644
--- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAProcessor.java
+++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAProcessor.java
@@ -28,7 +28,7 @@ import org.apache.olingo.odata2.jpa.processor.api.factory.ODataJPAFactory;
  * behavior of OData JPA Processor library has to be overwritten.
  * 
  * The class encapsulates a default processor for handling OData requests and
- * a default builder to build an OData response. 
+ * a default builder to build an OData response.
  * 
  */
 public abstract class ODataJPAProcessor extends ODataSingleProcessor {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/factory/JPQLBuilderFactory.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/factory/JPQLBuilderFactory.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/factory/JPQLBuilderFactory.java
index 4880257..08aea25 100644
--- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/factory/JPQLBuilderFactory.java
+++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/factory/JPQLBuilderFactory.java
@@ -19,9 +19,9 @@
 package org.apache.olingo.odata2.jpa.processor.api.factory;
 
 import org.apache.olingo.odata2.jpa.processor.api.access.JPAMethodContext.JPAMethodContextBuilder;
+import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext.JPQLContextBuilder;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextView;
-import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext.JPQLContextBuilder;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLStatement.JPQLStatementBuilder;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmComplexTypeView.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmComplexTypeView.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmComplexTypeView.java
index 8b087c8..3b5a884 100644
--- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmComplexTypeView.java
+++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmComplexTypeView.java
@@ -126,11 +126,11 @@ public interface JPAEdmComplexTypeView extends JPAEdmBaseView {
    * 
    */
   public boolean isReferencedInKey(String complexTypeName);
-  
+
   /**
    * The method sets the given EDM complex type as referenced in an Entity as a key property
    * @param complexTypeName
-   *  EDM complex Type name
+   * EDM complex Type name
    */
   public void setReferencedInKey(String complexTypeName);
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmPropertyView.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmPropertyView.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmPropertyView.java
index c363844..ce06f68 100644
--- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmPropertyView.java
+++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/model/JPAEdmPropertyView.java
@@ -80,6 +80,15 @@ public interface JPAEdmPropertyView extends JPAEdmBaseView {
   Attribute<?, ?> getJPAAttribute();
 
   /**
+   * The method returns a JPA Attribute referenced by a JPA Attribute in the {@link javax.persistence.JoinColumn}
+   * annotation for the given JPA entity type .
+   * 
+   * @return an instance of type {@link javax.persistence.metamodel.Attribute
+   * <?, ?>}
+   */
+  Attribute<?, ?> getJPAReferencedAttribute();
+
+  /**
    * The method returns a JPA EDM navigation property view.
    * 
    * @return an instance of type {@link org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmNavigationPropertyView}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java
index 3823e2c..dccfc6c 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java
@@ -43,6 +43,7 @@ import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeExcep
 public final class ODataEntityParser {
 
   private ODataJPAContext context;
+  private Edm edm;
 
   public ODataEntityParser(final ODataJPAContext context) {
     this.context = context;
@@ -63,21 +64,37 @@ public final class ODataEntityParser {
 
   }
 
-  public final UriInfo parseLinkURI() throws ODataJPARuntimeException {
+  public final UriInfo parseURISegmentWithCustomOptions(final int segmentFromIndex, final int segmentToIndex,
+      final Map<String, String> options) throws ODataJPARuntimeException {
     UriInfo uriInfo = null;
-
-    Edm edm;
+    if (segmentFromIndex == segmentToIndex || segmentFromIndex > segmentToIndex || segmentFromIndex < 0) {
+      return uriInfo;
+    }
     try {
-      edm = context.getODataContext().getService().getEntityDataModel();
-
+      edm = getEdm();
       List<PathSegment> pathSegments = context.getODataContext().getPathInfo().getODataSegments();
-      List<PathSegment> subPathSegments = pathSegments.subList(0, pathSegments.size() - 2);
+      List<PathSegment> subPathSegments = pathSegments.subList(segmentFromIndex, segmentToIndex);
+      uriInfo = UriParser.parse(edm, subPathSegments, options);
+    } catch (ODataException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+    }
+    return uriInfo;
+  }
 
+  public final UriInfo parseURISegment(final int segmentFromIndex, final int segmentToIndex)
+      throws ODataJPARuntimeException {
+    UriInfo uriInfo = null;
+    if (segmentFromIndex == segmentToIndex || segmentFromIndex > segmentToIndex || segmentFromIndex < 0) {
+      return uriInfo;
+    }
+    try {
+      edm = getEdm();
+      List<PathSegment> pathSegments = context.getODataContext().getPathInfo().getODataSegments();
+      List<PathSegment> subPathSegments = pathSegments.subList(segmentFromIndex, segmentToIndex);
       uriInfo = UriParser.parse(edm, subPathSegments, Collections.<String, String> emptyMap());
     } catch (ODataException e) {
       throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
     }
-
     return uriInfo;
   }
 
@@ -86,78 +103,70 @@ public final class ODataEntityParser {
 
     String uriString = null;
     UriInfo uri = null;
-
     try {
       uriString = EntityProvider.readLink(contentType, entitySet, content);
       ODataContext odataContext = context.getODataContext();
       final String serviceRoot = odataContext.getPathInfo().getServiceRoot().toString();
-
       final String path =
           uriString.startsWith(serviceRoot.toString()) ? uriString.substring(serviceRoot.length()) : uriString;
-
-      final PathSegment pathSegment = new PathSegment() {
-        @Override
-        public String getPath() {
-          return path;
-        }
-
-        @Override
-        public Map<String, List<String>> getMatrixParameters() {
-          return null;
-        }
-      };
-
-      final Edm edm = odataContext.getService().getEntityDataModel();
-
+      final PathSegment pathSegment = getPathSegment(path);
+      edm = getEdm();
       uri = UriParser.parse(edm, Arrays.asList(pathSegment), Collections.<String, String> emptyMap());
-
     } catch (ODataException e) {
       throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
     }
-
     return uri;
-
   }
 
-  public List<UriInfo> parseLinks(final EdmEntitySet entitySet, final InputStream content, final String contentType)
+  public UriInfo parseLinkSegments(final List<String> linkSegments, final Map<String, String> options)
       throws ODataJPARuntimeException {
-
-    List<String> uriList = new ArrayList<String>();
-    List<UriInfo> uriInfoList = new ArrayList<UriInfo>();
-
+    List<PathSegment> pathSegments = new ArrayList<PathSegment>();
+    for (String link : linkSegments) {
+      PathSegment pathSegment = getPathSegment(link);
+      pathSegments.add(pathSegment);
+    }
+    UriInfo uriInfo = null;
     try {
+      edm = getEdm();
+      uriInfo = UriParser.parse(edm, pathSegments, options);
+    } catch (ODataException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+    }
+    return uriInfo;
+  }
 
-      uriList = EntityProvider.readLinks(contentType, entitySet, content);
-      ODataContext odataContext = context.getODataContext();
-      final String serviceRoot = odataContext.getPathInfo().getServiceRoot().toString();
-      final int length = serviceRoot.length();
-      final Edm edm = odataContext.getService().getEntityDataModel();
-
-      for (String uriString : uriList) {
-        final String path = uriString.startsWith(serviceRoot) ? uriString.substring(length) : uriString;
-
-        final PathSegment pathSegment = new PathSegment() {
-          @Override
-          public String getPath() {
-            return path;
-          }
-
-          @Override
-          public Map<String, List<String>> getMatrixParameters() {
-            return null;
-          }
-        };
-
-        UriInfo uriInfo = UriParser.parse(edm, Arrays.asList(pathSegment), Collections.<String, String> emptyMap());
-        uriInfoList.add(uriInfo);
-      }
-    } catch (EntityProviderException e) {
-      return null;
+  public UriInfo parseBindingLink(final String link, final Map<String, String> options) throws ODataJPARuntimeException {
+    final PathSegment pathSegment = getPathSegment(link);
+    UriInfo uriInfo = null;
+    try {
+      edm = getEdm();
+      uriInfo = UriParser.parse(edm, Arrays.asList(pathSegment), options);
     } catch (ODataException e) {
       throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
     }
+    return uriInfo;
+  }
 
-    return uriInfoList;
+  private Edm getEdm() throws ODataException {
+    if (edm == null) {
+      edm = context.getODataContext().getService().getEntityDataModel();
+    }
+    return edm;
   }
 
+  private PathSegment getPathSegment(final String path) {
+    final PathSegment pathSegment = new PathSegment() {
+
+      @Override
+      public String getPath() {
+        return path;
+      }
+
+      @Override
+      public Map<String, List<String>> getMatrixParameters() {
+        return null;
+      }
+    };
+    return pathSegment;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefault.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefault.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefault.java
index 96782b8..f59edf9 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefault.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefault.java
@@ -191,4 +191,12 @@ public class ODataJPAProcessorDefault extends ODataJPAProcessor {
     return ODataResponse.newBuilder().build();
   }
 
+  @Override
+  public ODataResponse deleteEntityLink(final DeleteUriInfo uriParserResultView, final String contentType)
+      throws ODataException {
+
+    jpaProcessor.process(uriParserResultView, contentType);
+    return ODataResponse.newBuilder().build();
+
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
index 6a3ab60..64b6f92 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
@@ -100,11 +100,20 @@ public class JPAEntity {
           jpaEntityParser.getJPAEmbeddableKeyMap(jpaEntity.getClass().getName());
       Set<String> propertyNames = null;
       if (embeddableKeys != null) {
-        setEmbeddableKeyProperty(embeddableKeys, oDataEntityType.getKeyProperties(), oDataEntryProperties, jpaEntity);
+        List<String> processedKeys =
+            setEmbeddableKeyProperty(embeddableKeys, oDataEntityType.getKeyProperties(), oDataEntryProperties,
+                jpaEntity);
+
         propertyNames = new HashSet<String>();
         propertyNames.addAll(oDataEntryProperties.keySet());
-        for (String propertyName : oDataEntityType.getKeyPropertyNames()) {
-          propertyNames.remove(propertyName);
+        if (processedKeys.isEmpty()) {
+          for (String key : embeddableKeys.keySet()) {
+            propertyNames.remove(key);
+          }
+        } else {
+          for (String propertyName : processedKeys) {
+            propertyNames.remove(propertyName);
+          }
         }
       } else {
         propertyNames = oDataEntryProperties.keySet();
@@ -212,7 +221,7 @@ public class JPAEntity {
           .throwException(ODataJPARuntimeException.GENERAL, null);
     }
     Map<String, Object> oDataEntryProperties = oDataEntry.getProperties();
-    if(oDataEntry.containsInlineEntry()){
+    if (oDataEntry.containsInlineEntry()) {
       normalizeInlineEntries(oDataEntryProperties);
     }
     write(oDataEntryProperties, false);
@@ -279,7 +288,7 @@ public class JPAEntity {
     }
   }
 
-  protected void setEmbeddableKeyProperty(final HashMap<String, String> embeddableKeys,
+  protected List<String> setEmbeddableKeyProperty(final HashMap<String, String> embeddableKeys,
       final List<EdmProperty> oDataEntryKeyProperties,
       final Map<String, Object> oDataEntryProperties, final Object entity)
       throws ODataJPARuntimeException, EdmException, IllegalAccessException, IllegalArgumentException,
@@ -288,6 +297,7 @@ public class JPAEntity {
     HashMap<String, Object> embeddableObjMap = new HashMap<String, Object>();
     List<EdmProperty> leftODataEntryKeyProperties = new ArrayList<EdmProperty>();
     HashMap<String, String> leftEmbeddableKeys = new HashMap<String, String>();
+    List<String> processedKeys = new ArrayList<String>();
 
     for (EdmProperty edmProperty : oDataEntryKeyProperties) {
       if (oDataEntryProperties.containsKey(edmProperty.getName()) == false) {
@@ -296,6 +306,9 @@ public class JPAEntity {
 
       String edmPropertyName = edmProperty.getName();
       String embeddableKeyNameComposite = embeddableKeys.get(edmPropertyName);
+      if (embeddableKeyNameComposite == null) {
+        continue;
+      }
       String embeddableKeyNameSplit[] = embeddableKeyNameComposite.split("\\.");
       String methodPartName = null;
       Method method = null;
@@ -320,10 +333,13 @@ public class JPAEntity {
         leftODataEntryKeyProperties.add(edmProperty);
         leftEmbeddableKeys
             .put(edmPropertyName, embeddableKeyNameComposite.split(embeddableKeyNameSplit[0] + ".", 2)[1]);
-        setEmbeddableKeyProperty(leftEmbeddableKeys, leftODataEntryKeyProperties, oDataEntryProperties, embeddableObj);
+        processedKeys.addAll(setEmbeddableKeyProperty(leftEmbeddableKeys, leftODataEntryKeyProperties,
+            oDataEntryProperties, embeddableObj));
       }
+      processedKeys.add(edmPropertyName);
 
     }
+    return processedKeys;
   }
 
   protected Object instantiateJPAEntity() throws InstantiationException, IllegalAccessException {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALink.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALink.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALink.java
index 40e0792..f3b821b 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALink.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALink.java
@@ -22,6 +22,8 @@ import java.io.InputStream;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
 
 import javax.persistence.EntityManager;
@@ -30,7 +32,14 @@ import javax.persistence.EntityTransaction;
 import org.apache.olingo.odata2.api.edm.EdmEntitySet;
 import org.apache.olingo.odata2.api.edm.EdmException;
 import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.edm.EdmSimpleType;
+import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.uri.KeyPredicate;
+import org.apache.olingo.odata2.api.uri.NavigationSegment;
 import org.apache.olingo.odata2.api.uri.UriInfo;
+import org.apache.olingo.odata2.api.uri.info.DeleteUriInfo;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
 import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo;
 import org.apache.olingo.odata2.api.uri.info.PostUriInfo;
 import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo;
@@ -43,6 +52,11 @@ import org.apache.olingo.odata2.jpa.processor.core.ODataEntityParser;
 
 public class JPALink {
 
+  private static final String SPACE = " ";
+  private static final String ODATA_COMMAND_FILTER = "$filter";
+  private static final String ODATA_OPERATOR_AND = "and";
+  private static final String ODATA_OPERATOR_NE = "ne";
+
   private ODataJPAContext context;
   private JPAProcessor jpaProcessor;
   private ODataEntityParser parser;
@@ -59,80 +73,106 @@ public class JPALink {
     sourceJPAEntity = jpaEntity;
   }
 
-  public void create(final PostUriInfo uriInfo, final InputStream content, final String requestContentType,
-      final String contentType) throws ODataJPARuntimeException, ODataJPAModelException {
+  public void setTargetJPAEntity(final Object jpaEntity) {
+    targetJPAEntity = jpaEntity;
+  }
 
-    EdmEntitySet targetEntitySet = uriInfo.getTargetEntitySet();
-    String targerEntitySetName;
-    EdmNavigationProperty navigationProperty = null;
-    try {
-      targerEntitySetName = targetEntitySet.getName();
-    } catch (EdmException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
-    }
+  public Object getTargetJPAEntity() {
+    return targetJPAEntity;
+  }
+
+  public Object getSourceJPAEntity() {
+    return sourceJPAEntity;
+  }
 
-    List<UriInfo> uriInfoList = new ArrayList<UriInfo>();
+  public void create(final PostUriInfo uriInfo, final InputStream content, final String requestContentType,
+      final String contentType) throws ODataJPARuntimeException, ODataJPAModelException {
+    modifyLink((UriInfo) uriInfo, content, requestContentType, contentType);
+  }
 
-    if (((UriInfo) uriInfo).isLinks()) {
-      UriInfo getUriInfo = parser.parseLink(targetEntitySet, content, requestContentType);
-      uriInfoList = new ArrayList<UriInfo>();
-      uriInfoList.add(getUriInfo);
-      navigationProperty = uriInfo.getNavigationSegments().get(0).getNavigationProperty();
-    } else {
-      uriInfoList = parser.parseLinks(targetEntitySet, content, contentType);
-    }
+  public void update(final PutMergePatchUriInfo putUriInfo, final InputStream content, final String requestContentType,
+      final String contentType) throws ODataJPARuntimeException, ODataJPAModelException {
+    modifyLink((UriInfo) putUriInfo, content, requestContentType, contentType);
+  }
 
-    if (uriInfoList == null) {
-      return;
-    }
+  public void delete(final DeleteUriInfo uriInfo) throws ODataJPARuntimeException {
     try {
-      for (UriInfo getUriInfo : uriInfoList) {
 
-        if (!getUriInfo.getTargetEntitySet().getName().equals(targerEntitySetName)) {
-          throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RELATIONSHIP_INVALID, null);
-        }
-        if (!((UriInfo) uriInfo).isLinks()) {
-          navigationProperty = getUriInfo.getNavigationSegments().get(0).getNavigationProperty();
+      int index = context.getODataContext().getPathInfo().getODataSegments().size() - 2;
+
+      List<String> linkSegments = new ArrayList<String>();
+      String customLinkSegment = context.getODataContext().getPathInfo().getODataSegments().get(0).getPath();
+      linkSegments.add(customLinkSegment);
+      customLinkSegment = uriInfo.getNavigationSegments().get(0).getNavigationProperty().getName();
+      linkSegments.add(customLinkSegment);
+
+      HashMap<String, String> options = new HashMap<String, String>();
+      List<KeyPredicate> keyPredicates = uriInfo.getNavigationSegments().get(0).getKeyPredicates();
+      StringBuffer condition = new StringBuffer();
+      String literal = null;
+      KeyPredicate keyPredicate = null;
+      int size = keyPredicates.size();
+      for (int i = 0; i < size; i++) {
+        keyPredicate = keyPredicates.get(i);
+
+        literal = ((EdmSimpleType) keyPredicate.getProperty().getType()).toUriLiteral(keyPredicate.getLiteral());
+        condition.append(keyPredicate.getProperty().getName()).append(SPACE);
+        condition.append(ODATA_OPERATOR_NE).append(SPACE);
+        condition.append(literal).append(SPACE);
+        if (i != size - 1) {
+          condition.append(ODATA_OPERATOR_AND).append(SPACE);
         }
+      }
+      options.put(ODATA_COMMAND_FILTER, condition.toString());
 
-        targetJPAEntity = jpaProcessor.process((GetEntityUriInfo) getUriInfo);
-        if (targetJPAEntity != null && ((UriInfo) uriInfo).isLinks()) {
-          getUriInfo = parser.parseLinkURI();
-          sourceJPAEntity = jpaProcessor.process((GetEntityUriInfo) getUriInfo);
-          if (sourceJPAEntity == null) {
-            throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RESOURCE_X_NOT_FOUND
-                .addContent(getUriInfo.getTargetEntitySet().getName()), null);
-          }
+      UriInfo parsedUriInfo = parser.parseLinkSegments(linkSegments, options);
+      List<Object> relatedEntities = jpaProcessor.process((GetEntitySetUriInfo) parsedUriInfo);
+
+      parsedUriInfo = parser.parseURISegment(0, index);
+      if (parsedUriInfo != null) {
+        targetJPAEntity = jpaProcessor.process((GetEntityUriInfo) parsedUriInfo);
+        if (targetJPAEntity == null) {
+          throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RESOURCE_X_NOT_FOUND
+              .addContent(parsedUriInfo.getTargetEntitySet().getName()), null);
         }
+        NavigationSegment navigationSegment = uriInfo.getNavigationSegments().get(0);
+        EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty();
+        delinkJPAEntities(targetJPAEntity, relatedEntities, navigationProperty);
+      }
 
-        JPAEntityParser entityParser = new JPAEntityParser();
-        Method setMethod =
-            entityParser.getAccessModifier(sourceJPAEntity, navigationProperty, JPAEntityParser.ACCESS_MODIFIER_SET);
+    } catch (EdmException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+    } catch (ODataException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+    }
+  }
 
-        Method getMethod =
-            entityParser.getAccessModifier(sourceJPAEntity, navigationProperty, JPAEntityParser.ACCESS_MODIFIER_GET);
+  private void delinkJPAEntities(final Object targetJPAEntity,
+      final List<Object> relatedJPAEntities,
+      final EdmNavigationProperty targetNavigationProperty)
+      throws ODataJPARuntimeException {
 
-        if (getMethod.getReturnType().getTypeParameters() != null) {
-          @SuppressWarnings("unchecked")
-          List<Object> relatedEntities = (List<Object>) getMethod.invoke(sourceJPAEntity);
-          relatedEntities.add(targetJPAEntity);
-          setMethod.invoke(sourceJPAEntity, relatedEntities);
-        } else {
-          setMethod.invoke(sourceJPAEntity, targetJPAEntity);
-        }
+    try {
+      JPAEntityParser entityParser = new JPAEntityParser();
+      Method setMethod = entityParser.getAccessModifier(targetJPAEntity,
+          targetNavigationProperty, JPAEntityParser.ACCESS_MODIFIER_SET);
+
+      Method getMethod = entityParser.getAccessModifier(targetJPAEntity,
+          targetNavigationProperty, JPAEntityParser.ACCESS_MODIFIER_GET);
+
+      if (getMethod.getReturnType().getTypeParameters() != null
+          && getMethod.getReturnType().getTypeParameters().length != 0) {
+        setMethod.invoke(targetJPAEntity, relatedJPAEntities);
+      } else {
+        setMethod.invoke(targetJPAEntity, (Object) null);
       }
     } catch (IllegalAccessException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
-    } catch (IllegalArgumentException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     } catch (InvocationTargetException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
-    } catch (EdmException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     }
-  }
 
-  public void delete() {}
+  }
 
   public void save() {
     EntityManager em = context.getEntityManager();
@@ -140,86 +180,128 @@ public class JPALink {
 
     if (!tx.isActive()) {
       em.getTransaction().begin();
-      em.persist(sourceJPAEntity);
+      if (sourceJPAEntity != null) {
+        em.persist(sourceJPAEntity);
+      }
+      if (targetJPAEntity != null) {
+        em.persist(targetJPAEntity);
+        em.flush();
+      }
       em.getTransaction().commit();
     }
 
   }
 
-  public void update(final PutMergePatchUriInfo putUriInfo, final InputStream content, final String requestContentType,
-      final String contentType) throws ODataJPARuntimeException, ODataJPAModelException {
-    UriInfo uriInfo = (UriInfo) putUriInfo;
-
-    EdmEntitySet targetEntitySet = uriInfo.getTargetEntitySet();
-    String targerEntitySetName;
-    EdmNavigationProperty navigationProperty = null;
+  public void create(final PostUriInfo uriInfo, final ODataEntry oDataEntry) throws ODataJPARuntimeException,
+      ODataJPAModelException {
     try {
-      targerEntitySetName = targetEntitySet.getName();
-    } catch (EdmException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
-    }
+      EdmEntitySet targetEntitySet = uriInfo.getTargetEntitySet();
+      int index = context.getODataContext().getPathInfo().getODataSegments().size() - 2;
+      UriInfo parsedUriInfo = parser.parseURISegment(index, index + 1);
+      Object targetJPAEntity = null;
+
+      if (parsedUriInfo != null) {
+        targetJPAEntity = jpaProcessor.process((GetEntityUriInfo) parsedUriInfo);
+        if (targetJPAEntity == null) {
+          throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RESOURCE_X_NOT_FOUND
+              .addContent(parsedUriInfo.getTargetEntitySet().getName()), null);
+        }
+        linkJPAEntities(sourceJPAEntity, targetJPAEntity, uriInfo.getNavigationSegments().get(0)
+            .getNavigationProperty());
+      }
 
-    List<UriInfo> uriInfoList = new ArrayList<UriInfo>();
+      List<String> navPropertyNames;
+      navPropertyNames = targetEntitySet.getEntityType().getNavigationPropertyNames();
 
-    if (((UriInfo) uriInfo).isLinks()) {
-      UriInfo getUriInfo = parser.parseLink(targetEntitySet, content, requestContentType);
-      uriInfoList = new ArrayList<UriInfo>();
-      uriInfoList.add(getUriInfo);
-      navigationProperty = uriInfo.getNavigationSegments().get(0).getNavigationProperty();
-    } else {
-      uriInfoList = parser.parseLinks(targetEntitySet, content, contentType);
-    }
+      for (String navPropertyName : navPropertyNames) {
+        List<String> links = oDataEntry.getMetadata().getAssociationUris(navPropertyName);
+        if (links != null && links.isEmpty() == false) {
+          for (String link : links) {
+            UriInfo bindingUriInfo = parser.parseBindingLink(link, new HashMap<String, String>());
+            targetJPAEntity = jpaProcessor.process((GetEntityUriInfo) bindingUriInfo);
 
-    if (uriInfoList == null) {
-      return;
+            linkJPAEntities(targetJPAEntity, sourceJPAEntity, (EdmNavigationProperty) targetEntitySet.getEntityType()
+                .getProperty(
+                    navPropertyName));
+          }
+        }
+      }
+    } catch (EdmException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+    } catch (ODataException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
     }
-    try {
-      for (UriInfo getUriInfo : uriInfoList) {
+  }
 
-        if (!getUriInfo.getTargetEntitySet().getName().equals(targerEntitySetName)) {
-          throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RELATIONSHIP_INVALID, null);
-        }
-        if (!((UriInfo) uriInfo).isLinks()) {
-          navigationProperty = getUriInfo.getNavigationSegments().get(0).getNavigationProperty();
-        }
+  private void modifyLink(final UriInfo uriInfo, final InputStream content, final String requestContentType,
+      final String contentType)
+      throws ODataJPARuntimeException, ODataJPAModelException {
+    try {
+      EdmEntitySet targetEntitySet = uriInfo.getTargetEntitySet();
+      String targerEntitySetName = targetEntitySet.getName();
+      EdmNavigationProperty navigationProperty = null;
+      UriInfo getUriInfo = null;
+
+      if (uriInfo.isLinks()) {
+        getUriInfo = parser.parseLink(targetEntitySet, content, requestContentType);
+        navigationProperty = uriInfo.getNavigationSegments().get(0).getNavigationProperty();
+      } else {
+        return;
+      }
 
-        targetJPAEntity = jpaProcessor.process((GetEntityUriInfo) getUriInfo);
-        if (targetJPAEntity != null && ((UriInfo) uriInfo).isLinks()) {
-          getUriInfo = parser.parseLinkURI();
-          sourceJPAEntity = jpaProcessor.process((GetEntityUriInfo) getUriInfo);
-          if (sourceJPAEntity == null) {
-            throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RESOURCE_X_NOT_FOUND
-                .addContent(getUriInfo.getTargetEntitySet().getName()), null);
-          }
-        }
+      if (!getUriInfo.getTargetEntitySet().getName().equals(targerEntitySetName))
+      {
+        throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RELATIONSHIP_INVALID, null);
+      }
 
-        JPAEntityParser entityParser = new JPAEntityParser();
-        Method setMethod =
-            entityParser.getAccessModifier(sourceJPAEntity, navigationProperty, JPAEntityParser.ACCESS_MODIFIER_SET);
-
-        Method getMethod =
-            entityParser.getAccessModifier(sourceJPAEntity, navigationProperty, JPAEntityParser.ACCESS_MODIFIER_GET);
-
-        if (getMethod.getReturnType().getTypeParameters() != null
-            && getMethod.getReturnType().getTypeParameters().length != 0) {
-          @SuppressWarnings("unchecked")
-          List<Object> relatedEntities = (List<Object>) getMethod.invoke(sourceJPAEntity);
-          relatedEntities.add(targetJPAEntity);
-          setMethod.invoke(sourceJPAEntity, relatedEntities);
-        } else {
-          setMethod.invoke(sourceJPAEntity, targetJPAEntity);
+      targetJPAEntity = jpaProcessor.process((GetEntityUriInfo) getUriInfo);
+      if (targetJPAEntity != null && sourceJPAEntity == null) {
+        int index = context.getODataContext().getPathInfo().getODataSegments().size() - 2;
+        getUriInfo = parser.parseURISegment(0, index);
+        sourceJPAEntity = jpaProcessor.process((GetEntityUriInfo) getUriInfo);
+        if (sourceJPAEntity == null) {
+          throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RESOURCE_X_NOT_FOUND
+              .addContent(getUriInfo.getTargetEntitySet().getName()), null);
         }
       }
-    } catch (IllegalAccessException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+      if (targetJPAEntity != null && sourceJPAEntity != null) {
+        linkJPAEntities(targetJPAEntity, sourceJPAEntity, navigationProperty);
+      }
+
     } catch (IllegalArgumentException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
-    } catch (InvocationTargetException e) {
-      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
     } catch (EdmException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
+    } catch (ODataException e) {
       throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
     }
-
   }
 
+  private void
+      linkJPAEntities(final Object targetJPAEntity, final Object sourceJPAEntity,
+          final EdmNavigationProperty navigationProperty)
+          throws ODataJPARuntimeException {
+    try {
+      JPAEntityParser entityParser = new JPAEntityParser();
+      Method setMethod = entityParser.getAccessModifier(sourceJPAEntity,
+          navigationProperty, JPAEntityParser.ACCESS_MODIFIER_SET);
+
+      Method getMethod = entityParser.getAccessModifier(sourceJPAEntity,
+          navigationProperty, JPAEntityParser.ACCESS_MODIFIER_GET);
+
+      if (getMethod.getReturnType().getTypeParameters() != null
+          && getMethod.getReturnType().getTypeParameters().length != 0) {
+        @SuppressWarnings("unchecked")
+        Collection<Object> relatedEntities = (Collection<Object>) getMethod.invoke(sourceJPAEntity);
+        relatedEntities.add(targetJPAEntity);
+        setMethod.invoke(sourceJPAEntity, relatedEntities);
+      } else {
+        setMethod.invoke(sourceJPAEntity, targetJPAEntity);
+      }
+    } catch (IllegalAccessException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
+    } catch (InvocationTargetException e) {
+      throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImpl.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImpl.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImpl.java
index 6ca98e6..9a5b101 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImpl.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImpl.java
@@ -33,6 +33,7 @@ import org.apache.olingo.odata2.api.edm.EdmEntityType;
 import org.apache.olingo.odata2.api.edm.EdmException;
 import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.uri.UriInfo;
 import org.apache.olingo.odata2.api.uri.info.DeleteUriInfo;
 import org.apache.olingo.odata2.api.uri.info.GetEntityCountUriInfo;
 import org.apache.olingo.odata2.api.uri.info.GetEntityLinkUriInfo;
@@ -314,8 +315,8 @@ public class JPAProcessorImpl implements JPAProcessor {
             oDataEntityParser.parseEntry(oDataEntitySet, content, requestedContentType, false);
         virtualJPAEntity.create(oDataEntry);
         JPALink link = new JPALink(oDataJPAContext);
-        link.setSourceJPAEntity(jpaEntity);
-        link.create(createView, content, requestedContentType, requestedContentType);
+        link.setSourceJPAEntity(virtualJPAEntity.getJPAEntity());
+        link.create(createView, oDataEntry);
       } else if (properties != null) {
         virtualJPAEntity.create(properties);
       } else {
@@ -396,6 +397,9 @@ public class JPAProcessorImpl implements JPAProcessor {
     JPQLContextType contextType = null;
     try {
       if (uriParserResultView instanceof DeleteUriInfo) {
+        if (((UriInfo) uriParserResultView).isLinks()) {
+          return deleteLink(uriParserResultView);
+        }
         uriParserResultView = ((DeleteUriInfo) uriParserResultView);
         if (!((DeleteUriInfo) uriParserResultView).getStartEntitySet().getName()
             .equals(((DeleteUriInfo) uriParserResultView).getTargetEntitySet().getName())) {
@@ -409,15 +413,14 @@ public class JPAProcessorImpl implements JPAProcessor {
           ODataJPARuntimeException.GENERAL, e);
     }
 
-    // First read the entity with read operation.
     Object selectedObject = readEntity(uriParserResultView, contextType);
-    // Read operation done. This object would be passed on to entity manager for delete
     if (selectedObject != null) {
       try {
         em.getTransaction().begin();
         em.remove(selectedObject);
         em.flush();
         em.getTransaction().commit();
+
       } catch (Exception e) {
         throw ODataJPARuntimeException.throwException(
             ODataJPARuntimeException.ERROR_JPQL_DELETE_REQUEST, e);
@@ -426,6 +429,13 @@ public class JPAProcessorImpl implements JPAProcessor {
     return selectedObject;
   }
 
+  private Object deleteLink(final DeleteUriInfo uriParserResultView) throws ODataJPARuntimeException {
+    JPALink link = new JPALink(oDataJPAContext);
+    link.delete(uriParserResultView);
+    link.save();
+    return link.getTargetJPAEntity();
+  }
+
   /* Process Get Entity Link Request */
   @Override
   public Object process(final GetEntityLinkUriInfo uriParserResultView)

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelService.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelService.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelService.java
index 97e438e..dd453ac 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelService.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelService.java
@@ -27,11 +27,11 @@ import javax.xml.bind.Unmarshaller;
 import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
 import org.apache.olingo.odata2.jpa.processor.api.access.JPAEdmMappingModelAccess;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
+import org.apache.olingo.odata2.jpa.processor.api.model.mapping.JPAAttributeMapType.JPAAttribute;
 import org.apache.olingo.odata2.jpa.processor.api.model.mapping.JPAEdmMappingModel;
 import org.apache.olingo.odata2.jpa.processor.api.model.mapping.JPAEmbeddableTypeMapType;
 import org.apache.olingo.odata2.jpa.processor.api.model.mapping.JPAEntityTypeMapType;
 import org.apache.olingo.odata2.jpa.processor.api.model.mapping.JPAPersistenceUnitMapType;
-import org.apache.olingo.odata2.jpa.processor.api.model.mapping.JPAAttributeMapType.JPAAttribute;
 import org.apache.olingo.odata2.jpa.processor.api.model.mapping.JPARelationshipMapType.JPARelationship;
 
 public class JPAEdmMappingModelService implements JPAEdmMappingModelAccess {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilder.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilder.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilder.java
index 5c8c999..9c22364 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilder.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilder.java
@@ -22,6 +22,7 @@ import java.lang.reflect.AnnotatedElement;
 import java.lang.reflect.Field;
 
 import javax.persistence.Column;
+import javax.persistence.JoinColumn;
 import javax.persistence.metamodel.Attribute;
 import javax.persistence.metamodel.ManagedType;
 import javax.persistence.metamodel.PluralAttribute;
@@ -149,7 +150,6 @@ public class JPAEdmNameBuilder {
     view.getEdmSimpleProperty().setName(propertyName);
 
     JPAEdmMapping mapping = new JPAEdmMappingImpl();
-    ((Mapping) mapping).setInternalName(jpaAttributeName);
     mapping.setJPAType(jpaAttribute.getJavaType());
 
     AnnotatedElement annotatedElement = (AnnotatedElement) jpaAttribute.getJavaMember();
@@ -157,6 +157,12 @@ public class JPAEdmNameBuilder {
       Column column = annotatedElement.getAnnotation(Column.class);
       if (column != null) {
         mapping.setJPAColumnName(column.name());
+      } else {
+        JoinColumn joinColumn = annotatedElement.getAnnotation(JoinColumn.class);
+        if (joinColumn != null) {
+          mapping.setJPAColumnName(joinColumn.name());
+          jpaAttributeName += "." + view.getJPAReferencedAttribute().getName();
+        }
       }
     } else {
       ManagedType<?> managedType = jpaAttribute.getDeclaringType();
@@ -176,6 +182,7 @@ public class JPAEdmNameBuilder {
       }
 
     }
+    ((Mapping) mapping).setInternalName(jpaAttributeName);
     view.getEdmSimpleProperty().setMapping((Mapping) mapping);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmMappingImpl.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmMappingImpl.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmMappingImpl.java
index f930d20..fc9f3fd 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmMappingImpl.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmMappingImpl.java
@@ -47,5 +47,4 @@ public class JPAEdmMappingImpl extends Mapping implements JPAEdmMapping {
   public Class<?> getJPAType() {
     return type;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
index 0923176..e23f3b1 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmProperty.java
@@ -18,6 +18,7 @@
  ******************************************************************************/
 package org.apache.olingo.odata2.jpa.processor.core.model;
 
+import java.lang.reflect.AnnotatedElement;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -25,8 +26,12 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import javax.persistence.Column;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinColumns;
 import javax.persistence.metamodel.Attribute;
 import javax.persistence.metamodel.Attribute.PersistentAttributeType;
+import javax.persistence.metamodel.EntityType;
 import javax.persistence.metamodel.PluralAttribute;
 import javax.persistence.metamodel.SingularAttribute;
 
@@ -66,6 +71,7 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
   private SimpleProperty currentSimpleProperty = null;
   private ComplexProperty currentComplexProperty = null;
   private Attribute<?, ?> currentAttribute;
+  private Attribute<?, ?> currentRefAttribute;
   private boolean isBuildModeComplexType;
   private Map<String, Integer> associationCount;
 
@@ -118,6 +124,11 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
   }
 
   @Override
+  public Attribute<?, ?> getJPAReferencedAttribute() {
+    return currentRefAttribute;
+  }
+
+  @Override
   public ComplexProperty getEdmComplexProperty() {
     return currentComplexProperty;
   }
@@ -167,9 +178,7 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
      */
     @Override
     public void build() throws ODataJPAModelException, ODataJPARuntimeException {
-
       JPAEdmBuilder keyViewBuilder = null;
-
       properties = new ArrayList<Property>();
 
       List<Attribute<?, ?>> jpaAttributes = null;
@@ -200,29 +209,15 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
 
         switch (attributeType) {
         case BASIC:
-
           currentSimpleProperty = new SimpleProperty();
-          JPAEdmNameBuilder
-              .build((JPAEdmPropertyView) JPAEdmProperty.this, isBuildModeComplexType, skipDefaultNaming);
-
-          EdmSimpleTypeKind simpleTypeKind = JPATypeConvertor
-              .convertToEdmSimpleType(currentAttribute
-                  .getJavaType(), currentAttribute);
-
-          currentSimpleProperty.setType(simpleTypeKind);
-          JPAEdmFacets.setFacets(currentAttribute, currentSimpleProperty);
-
-          properties.add(currentSimpleProperty);
-
+          properties.add(buildSimpleProperty(currentAttribute, currentSimpleProperty));
           if (((SingularAttribute<?, ?>) currentAttribute).isId()) {
             if (keyView == null) {
               keyView = new JPAEdmKey(JPAEdmProperty.this);
               keyViewBuilder = keyView.getBuilder();
             }
-
             keyViewBuilder.build();
           }
-
           break;
         case EMBEDDED:
           ComplexType complexType = complexTypeView
@@ -234,7 +229,6 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
             complexTypeViewLocal.getBuilder().build();
             complexType = complexTypeViewLocal.getEdmComplexType();
             complexTypeView.addJPAEdmCompleTypeView(complexTypeViewLocal);
-
           }
 
           if (isBuildModeComplexType == false
@@ -276,6 +270,8 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
         case ONE_TO_ONE:
         case MANY_TO_ONE:
 
+          addForeignKey(currentAttribute);
+
           JPAEdmAssociationEndView associationEndView = new JPAEdmAssociationEnd(entityTypeView, JPAEdmProperty.this);
           associationEndView.getBuilder().build();
           JPAEdmAssociationView associationView = schemaView.getJPAEdmAssociationView();
@@ -325,6 +321,54 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
 
     }
 
+    private SimpleProperty buildSimpleProperty(final Attribute<?, ?> jpaAttribute, final SimpleProperty simpleProperty)
+        throws ODataJPAModelException,
+        ODataJPARuntimeException {
+
+      JPAEdmNameBuilder
+          .build((JPAEdmPropertyView) JPAEdmProperty.this, isBuildModeComplexType, skipDefaultNaming);
+      EdmSimpleTypeKind simpleTypeKind = JPATypeConvertor
+          .convertToEdmSimpleType(jpaAttribute
+              .getJavaType(), jpaAttribute);
+      simpleProperty.setType(simpleTypeKind);
+      JPAEdmFacets.setFacets(jpaAttribute, simpleProperty);
+
+      return simpleProperty;
+
+    }
+
+    private void addForeignKey(final Attribute<?, ?> jpaAttribute) throws ODataJPAModelException,
+        ODataJPARuntimeException {
+
+      AnnotatedElement annotatedElement = (AnnotatedElement) jpaAttribute.getJavaMember();
+      if (annotatedElement == null) {
+        return;
+      }
+      JoinColumn joinColumn = annotatedElement.getAnnotation(JoinColumn.class);
+      if (joinColumn == null) {
+        JoinColumns joinColumns = annotatedElement.getAnnotation(JoinColumns.class);
+        if (joinColumns != null) {
+          return;
+        }
+      } else {
+        if (joinColumn.insertable() && joinColumn.updatable()) {
+          EntityType<?> referencedEntityType = metaModel.entity(jpaAttribute.getJavaType());
+          for (Attribute<?, ?> referencedAttribute : referencedEntityType.getAttributes()) {
+            AnnotatedElement annotatedElement2 = (AnnotatedElement) referencedAttribute.getJavaMember();
+            if (annotatedElement2 != null) {
+              Column referencedColumn = annotatedElement2.getAnnotation(Column.class);
+              if (referencedColumn != null && referencedColumn.name().equals((joinColumn.referencedColumnName()))) {
+                currentRefAttribute = referencedAttribute;
+                currentSimpleProperty = new SimpleProperty();
+                properties.add(buildSimpleProperty(currentRefAttribute, currentSimpleProperty));
+                break;
+              }
+            }
+          }
+        }
+      }
+    }
+
     @SuppressWarnings("rawtypes")
     private List<Attribute<?, ?>> sortInAscendingOrder(final Set<?> jpaAttributes) {
       List<Attribute<?, ?>> jpaAttributeList = new ArrayList<Attribute<?, ?>>();
@@ -374,4 +418,5 @@ public class JPAEdmProperty extends JPAEdmBaseViewImpl implements
     }
     return isExcluded;
   }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraint.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraint.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraint.java
index cd80e70..07b4480 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraint.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraint.java
@@ -26,8 +26,8 @@ import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmAssociationView;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntityTypeView;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmPropertyView;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmReferentialConstraintRoleView;
-import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmReferentialConstraintView;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmReferentialConstraintRoleView.RoleType;
+import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmReferentialConstraintView;
 
 public class JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements JPAEdmReferentialConstraintView {
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRole.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRole.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRole.java
index 6358774..2a2426b 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRole.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRole.java
@@ -168,7 +168,7 @@ public class JPAEdmReferentialConstraintRole extends JPAEdmBaseViewImpl implemen
 
         if (roleType == RoleType.PRINCIPAL) {
           jpaAttributeType = jpaAttribute.getJavaType().getSimpleName();
-          if (jpaAttributeType.equals("List")) {
+          if (jpaAttribute.isCollection()) {
             Type type =
                 ((ParameterizedType) jpaAttribute.getJavaMember().getDeclaringClass().getDeclaredField(
                     jpaAttribute.getName()).getGenericType()).getActualTypeArguments()[0];

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java
new file mode 100644
index 0000000..93587a8
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java
@@ -0,0 +1,226 @@
+package org.apache.olingo.odata2.jpa.processor.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.uri.PathSegment;
+import org.apache.olingo.odata2.api.uri.UriInfo;
+import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
+import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
+import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
+import org.apache.olingo.odata2.jpa.processor.core.mock.ODataContextMock;
+import org.apache.olingo.odata2.jpa.processor.core.mock.ODataJPAContextMock;
+import org.apache.olingo.odata2.jpa.processor.core.mock.ODataServiceMock;
+import org.apache.olingo.odata2.jpa.processor.core.mock.PathInfoMock;
+import org.apache.olingo.odata2.jpa.processor.core.mock.PathSegmentMock;
+import org.apache.olingo.odata2.jpa.processor.core.mock.data.EdmMockUtilV2;
+import org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock;
+import org.junit.Test;
+
+public class ODataEntityParserTest {
+
+  private ODataEntityParser parser;
+
+  private ODataJPAContext mock(final String path) {
+    ODataServiceMock serviceMock = new ODataServiceMock();
+    ODataContextMock contextMock = new ODataContextMock();
+    PathInfoMock pathInfoMock = new PathInfoMock();
+    PathSegmentMock pathSegmentMock = new PathSegmentMock();
+    ODataJPAContext odataJPAContext = null;
+
+    try {
+
+      pathSegmentMock.setPath(path);
+
+      List<PathSegment> pathSegments = new ArrayList<PathSegment>();
+      pathSegments.add(pathSegmentMock);
+      pathInfoMock.setPathSegments(pathSegments);
+      pathInfoMock.setServiceRootURI(ODataServiceMock.SERVICE_ROOT);
+
+      contextMock.setPathInfo(pathInfoMock.mock());
+      contextMock.setODataService(serviceMock.mock());
+
+      odataJPAContext = ODataJPAContextMock.mockODataJPAContext(contextMock.mock());
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (ODataException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (URISyntaxException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+
+    return odataJPAContext;
+  }
+
+  @Test
+  public void testParseURISegment() {
+
+    try {
+      parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+      UriInfo uriInfo = parser.parseURISegment(0, 1);
+      assertNotNull(uriInfo);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testParseURISegmentInvalidIndex00() {
+    try {
+      parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+      UriInfo uriInfo = parser.parseURISegment(0, 0);
+      assertNull(uriInfo);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testParseURISegmentInvalidIndex01() {
+    try {
+      parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+      UriInfo uriInfo = parser.parseURISegment(-1, -1);
+      assertNull(uriInfo);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testParseURISegmentInvalidIndex02() {
+    try {
+      parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+      UriInfo uriInfo = parser.parseURISegment(3, -1);
+      assertNull(uriInfo);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testParseURISegmentInvalidEntityType() {
+    try {
+      parser = new ODataEntityParser(mock("JPATypeMockInvalid(2)"));
+      parser.parseURISegment(0, 1);
+      fail("Exception Expected");
+    } catch (ODataJPARuntimeException e) {
+      assertEquals(true, true);
+    }
+  }
+
+  @Test
+  public void testParseBindingLink() {
+    try {
+      parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+      UriInfo uriInfo = parser.parseBindingLink("JPATypeMock(2)", new HashMap<String, String>());
+      assertNotNull(uriInfo);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+
+  }
+
+  @Test
+  public void testParseBindingLinkNegative() {
+    try {
+      parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+      parser.parseBindingLink("JPATypeMockInvalid(2)", new HashMap<String, String>());
+      fail("Exception Expected");
+    } catch (ODataJPARuntimeException e) {
+      assertEquals(true, true);
+    }
+  }
+
+  @Test
+  public void testParseLink() {
+    parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+    try {
+      UriInfo uriInfo =
+          parser.parseLink(EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false), mockURIContent(0),
+              "application/json");
+      assertNotNull(uriInfo);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testParseLinkWithoutServiceRoot() {
+    parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+    try {
+      UriInfo uriInfo =
+          parser.parseLink(EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false), mockURIContent(1),
+              "application/json");
+      assertNotNull(uriInfo);
+    } catch (ODataJPARuntimeException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  @Test
+  public void testParseLinkNegative() {
+    parser = new ODataEntityParser(mock("JPATypeMock(2)"));
+    try {
+      parser.parseLink(EdmMockUtilV2.mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false), mockURIContent(2),
+          "application/json");
+      fail("Exception Expected");
+    } catch (ODataJPARuntimeException e) {
+      assertEquals(true, true);
+    } catch (EdmException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+  }
+
+  private InputStream mockURIContent(final int variant) {
+    String uri = null;
+    InputStream is = null;
+    switch (variant) {
+    case 0:
+      uri = "{ \"uri\": \"" + ODataServiceMock.SERVICE_ROOT + "JPATypeMock(2)\" }";
+      break;
+    case 1:
+      uri = "{ \"uri\": \"JPATypeMock(2)\" }";
+      break;
+    case 2:
+      uri = "{ \"uri\": \"" + ODataServiceMock.SERVICE_ROOT + "JPATypeMockInvalid(2)\" }";
+    }
+
+    try {
+      is = new ByteArrayInputStream(uri.getBytes("utf-8"));
+    } catch (UnsupportedEncodingException e) {
+      fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage()
+          + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
+    }
+    return is;
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParserTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParserTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParserTest.java
index c0d364c..422b5ab 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParserTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataExpressionParserTest.java
@@ -48,7 +48,6 @@ import org.apache.olingo.odata2.api.uri.expression.PropertyExpression;
 import org.apache.olingo.odata2.api.uri.expression.UnaryExpression;
 import org.apache.olingo.odata2.api.uri.expression.UnaryOperator;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.jpa.processor.core.ODataExpressionParser;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.easymock.EasyMock;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAContextImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAContextImplTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAContextImplTest.java
index fe981fc..7550c00 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAContextImplTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAContextImplTest.java
@@ -31,7 +31,6 @@ import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
 import org.apache.olingo.odata2.api.processor.ODataContext;
 import org.apache.olingo.odata2.api.processor.ODataProcessor;
 import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
-import org.apache.olingo.odata2.jpa.processor.core.ODataJPAContextImpl;
 import org.apache.olingo.odata2.jpa.processor.core.edm.ODataJPAEdmProvider;
 import org.apache.olingo.odata2.jpa.processor.core.mock.ODataJPAContextMock;
 import org.easymock.EasyMock;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefaultTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefaultTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefaultTest.java
index ced012e..6317a4b 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefaultTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAProcessorDefaultTest.java
@@ -69,7 +69,6 @@ import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo;
 import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.jpa.processor.core.ODataJPAProcessorDefault;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmTestModelView;
 import org.easymock.EasyMock;
@@ -227,6 +226,7 @@ public class ODataJPAProcessorDefaultTest extends JPAEdmTestModelView {
     EasyMock.expect(objUriInfo.getInlineCount()).andStubReturn(getInlineCount());
     EasyMock.expect(objUriInfo.getFilter()).andStubReturn(getFilter());
     EasyMock.expect(objUriInfo.getKeyPredicates()).andStubReturn(getKeyPredicates());
+    EasyMock.expect(objUriInfo.isLinks()).andStubReturn(false);
     EasyMock.replay(objUriInfo);
     return objUriInfo;
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTest.java
index 213b51b..e1c7c35 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTest.java
@@ -38,7 +38,6 @@ import org.apache.olingo.odata2.api.edm.EdmStructuralType;
 import org.apache.olingo.odata2.api.edm.EdmType;
 import org.apache.olingo.odata2.api.edm.EdmTypeKind;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAEntityParser;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.easymock.EasyMock;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java
index d87d2c1..e75b060 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParserTestForStaticMethods.java
@@ -26,7 +26,6 @@ import static org.junit.Assert.fail;
 import java.lang.reflect.Method;
 
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAEntityParser;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
index a93c4e0..6b81805 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityTest.java
@@ -27,14 +27,13 @@ import org.apache.olingo.odata2.api.edm.EdmEntitySet;
 import org.apache.olingo.odata2.api.edm.EdmEntityType;
 import org.apache.olingo.odata2.api.edm.EdmException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAEntity;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.data.EdmMockUtilV2;
 import org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock;
-import org.apache.olingo.odata2.jpa.processor.core.mock.data.ODataEntryMockUtil;
 import org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock.JPARelatedTypeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock.JPATypeEmbeddableMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.data.JPATypeMock.JPATypeEmbeddableMock2;
+import org.apache.olingo.odata2.jpa.processor.core.mock.data.ODataEntryMockUtil;
 import org.junit.Test;
 
 public class JPAEntityTest {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAExpandCallBackTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAExpandCallBackTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAExpandCallBackTest.java
index d6f9153..efa230c 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAExpandCallBackTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAExpandCallBackTest.java
@@ -40,7 +40,6 @@ import org.apache.olingo.odata2.api.ep.callback.WriteFeedCallbackContext;
 import org.apache.olingo.odata2.api.ep.callback.WriteFeedCallbackResult;
 import org.apache.olingo.odata2.api.uri.ExpandSelectTreeNode;
 import org.apache.olingo.odata2.api.uri.NavigationPropertySegment;
-import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAExpandCallBack;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.data.EdmMockUtil;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAFunctionContextTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAFunctionContextTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAFunctionContextTest.java
index 359ddfa..f9d0999 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAFunctionContextTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAFunctionContextTest.java
@@ -37,7 +37,6 @@ import org.apache.olingo.odata2.jpa.processor.api.access.JPAMethodContext;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
-import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAFunctionContext;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmMappingImpl;
 import org.easymock.EasyMock;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java
new file mode 100644
index 0000000..db0f6fb
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java
@@ -0,0 +1,5 @@
+package org.apache.olingo.odata2.jpa.processor.core.access.data;
+
+public class JPALinkTest {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImplTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImplTest.java
index 915a7d3..bafef01 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImplTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAProcessorImplTest.java
@@ -59,7 +59,6 @@ import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
 import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAProcessorImpl;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.easymock.EasyMock;
 import org.junit.Before;
@@ -154,6 +153,7 @@ public class JPAProcessorImplTest {
     EasyMock.expect(objUriInfo.getInlineCount()).andStubReturn(getInlineCount());
     EasyMock.expect(objUriInfo.getFilter()).andStubReturn(getFilter());
     EasyMock.expect(objUriInfo.getKeyPredicates()).andStubReturn(getKeyPredicates());
+    EasyMock.expect(objUriInfo.isLinks()).andStubReturn(false);
     EasyMock.replay(objUriInfo);
     return objUriInfo;
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelServiceTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelServiceTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelServiceTest.java
index 073cd1f..bb0c1d3 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelServiceTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmMappingModelServiceTest.java
@@ -26,7 +26,6 @@ import static org.junit.Assert.assertTrue;
 
 import java.io.InputStream;
 
-import org.apache.olingo.odata2.jpa.processor.core.access.model.JPAEdmMappingModelService;
 import org.apache.olingo.odata2.jpa.processor.core.mock.ODataJPAContextMock;
 import org.junit.BeforeClass;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilderTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilderTest.java
index 73af3e9..542d37f 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilderTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPAEdmNameBuilderTest.java
@@ -26,8 +26,6 @@ import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmComplexPropertyVie
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntityTypeView;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmPropertyView;
 import org.apache.olingo.odata2.jpa.processor.core.ODataJPAContextImpl;
-import org.apache.olingo.odata2.jpa.processor.core.access.model.JPAEdmMappingModelService;
-import org.apache.olingo.odata2.jpa.processor.core.access.model.JPAEdmNameBuilder;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAAttributeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEntityTypeMock;
 import org.easymock.EasyMock;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertorTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertorTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertorTest.java
index cdcf3b1..29462c9 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertorTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/model/JPATypeConvertorTest.java
@@ -26,7 +26,6 @@ import java.util.UUID;
 
 import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
-import org.apache.olingo.odata2.jpa.processor.core.access.model.JPATypeConvertor;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.junit.Test;
 


[11/35] [OLINGO-49], [OLINGO-51] Support for A) Linking entities using tag within an OData Entry B) Updating links C) Deleting links D) Code Cleanup

Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderNegativeTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderNegativeTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderNegativeTest.java
index 3e680f2..f4789c6 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderNegativeTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderNegativeTest.java
@@ -33,7 +33,6 @@ import org.apache.olingo.odata2.api.edm.provider.EntityContainerInfo;
 import org.apache.olingo.odata2.api.edm.provider.Schema;
 import org.apache.olingo.odata2.api.exception.ODataException;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
-import org.apache.olingo.odata2.jpa.processor.core.edm.ODataJPAEdmProvider;
 import org.apache.olingo.odata2.jpa.processor.core.mock.ODataJPAContextMock;
 import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmModel;
 import org.junit.BeforeClass;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderTest.java
index 44d0448..75d849b 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/edm/ODataJPAEdmProviderTest.java
@@ -38,7 +38,6 @@ import org.apache.olingo.odata2.api.edm.provider.Schema;
 import org.apache.olingo.odata2.api.exception.ODataException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
-import org.apache.olingo.odata2.jpa.processor.core.edm.ODataJPAEdmProvider;
 import org.apache.olingo.odata2.jpa.processor.core.mock.ODataJPAContextMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.EdmSchemaMock;
 import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmModel;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLBuilderFactoryTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLBuilderFactoryTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLBuilderFactoryTest.java
index a127e60..dd56f91 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLBuilderFactoryTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLBuilderFactoryTest.java
@@ -51,17 +51,13 @@ import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo;
 import org.apache.olingo.odata2.jpa.processor.api.factory.JPAAccessFactory;
 import org.apache.olingo.odata2.jpa.processor.api.factory.ODataJPAAccessFactory;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext;
-import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext.JPQLContextBuilder;
+import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLStatement.JPQLStatementBuilder;
 import org.apache.olingo.odata2.jpa.processor.core.ODataJPAContextImpl;
 import org.apache.olingo.odata2.jpa.processor.core.access.data.JPAProcessorImplTest;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.factory.ODataJPAFactoryImpl;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLJoinSelectSingleStatementBuilder;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLJoinStatementBuilder;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectSingleStatementBuilder;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectStatementBuilder;
 import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectContext.JPQLSelectContextBuilder;
 import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectSingleContext.JPQLSelectSingleContextBuilder;
 import org.easymock.EasyMock;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinContextTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinContextTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinContextTest.java
index 33e44e2..c94160c 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinContextTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinContextTest.java
@@ -42,7 +42,6 @@ import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
 import org.apache.olingo.odata2.jpa.processor.api.access.JPAJoinClause;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLJoinSelectContext;
 import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLJoinSelectContext.JPQLJoinContextBuilder;
 import org.easymock.EasyMock;
 import org.junit.After;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleContextTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleContextTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleContextTest.java
index de5532c..117d21f 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleContextTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleContextTest.java
@@ -42,7 +42,6 @@ import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo;
 import org.apache.olingo.odata2.jpa.processor.api.access.JPAJoinClause;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLJoinSelectSingleContext;
 import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLJoinSelectSingleContext.JPQLJoinSelectSingleContextBuilder;
 import org.easymock.EasyMock;
 import org.junit.After;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleStatementBuilderTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleStatementBuilderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleStatementBuilderTest.java
index 13f1ca5..b5412a8 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleStatementBuilderTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinSelectSingleStatementBuilderTest.java
@@ -35,7 +35,6 @@ import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeExcep
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLJoinSelectSingleContextView;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLStatement;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLJoinSelectSingleStatementBuilder;
 import org.easymock.EasyMock;
 import org.junit.After;
 import org.junit.AfterClass;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinStatementBuilderTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinStatementBuilderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinStatementBuilderTest.java
index e1637d1..2a0d4f7 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinStatementBuilderTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLJoinStatementBuilderTest.java
@@ -31,7 +31,6 @@ import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeExcep
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLJoinContextView;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLStatement;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLJoinStatementBuilder;
 import org.easymock.EasyMock;
 import org.junit.After;
 import org.junit.AfterClass;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContextImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContextImplTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContextImplTest.java
index 03eb651..e793817 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContextImplTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectContextImplTest.java
@@ -46,7 +46,6 @@ import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeExcep
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectContext;
 import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectContext.JPQLSelectContextBuilder;
 import org.easymock.EasyMock;
 import org.junit.BeforeClass;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleContextImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleContextImplTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleContextImplTest.java
index 69952fd..0394e54 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleContextImplTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleContextImplTest.java
@@ -38,7 +38,6 @@ import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelExcepti
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectSingleContext;
 import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectSingleContext.JPQLSelectSingleContextBuilder;
 import org.easymock.EasyMock;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleStatementBuilderTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleStatementBuilderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleStatementBuilderTest.java
index c65aee4..25fd5ae 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleStatementBuilderTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectSingleStatementBuilderTest.java
@@ -36,10 +36,8 @@ import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext;
-import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext.JPQLContextBuilder;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectSingleContext;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectSingleStatementBuilder;
+import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java
index 7a14f6c..617365b 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/jpql/JPQLSelectStatementBuilderTest.java
@@ -37,10 +37,8 @@ import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPAModelException;
 import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext;
-import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContext.JPQLContextBuilder;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectContext;
-import org.apache.olingo.odata2.jpa.processor.core.jpql.JPQLSelectStatementBuilder;
+import org.apache.olingo.odata2.jpa.processor.api.jpql.JPQLContextType;
 import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataContextMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataContextMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataContextMock.java
new file mode 100644
index 0000000..d4a691e
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataContextMock.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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.odata2.jpa.processor.core.mock;
+
+import org.apache.olingo.odata2.api.ODataService;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataContext;
+import org.apache.olingo.odata2.api.uri.PathInfo;
+import org.easymock.EasyMock;
+
+public class ODataContextMock {
+
+  private ODataService odataService;
+  private PathInfo pathInfo;
+
+  public void setODataService(final ODataService service) {
+    odataService = service;
+  }
+
+  public void setPathInfo(final PathInfo pathInfo) {
+    this.pathInfo = pathInfo;
+  }
+
+  public ODataContext mock() throws ODataException {
+    ODataContext context = EasyMock.createMock(ODataContext.class);
+    EasyMock.expect(context.getService()).andReturn(odataService).anyTimes();
+    EasyMock.expect(context.getPathInfo()).andReturn(pathInfo).anyTimes();
+    EasyMock.replay(context);
+    return context;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAContextMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAContextMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAContextMock.java
index 83ae7c0..4d00503 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAContextMock.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataJPAContextMock.java
@@ -21,6 +21,7 @@ package org.apache.olingo.odata2.jpa.processor.core.mock;
 import javax.persistence.EntityManagerFactory;
 import javax.persistence.metamodel.Metamodel;
 
+import org.apache.olingo.odata2.api.processor.ODataContext;
 import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext;
 import org.easymock.EasyMock;
 
@@ -37,6 +38,20 @@ public abstract class ODataJPAContextMock {
     EasyMock.expect(odataJPAContext.getJPAEdmMappingModel()).andReturn(MAPPING_MODEL);
     EasyMock.expect(odataJPAContext.getJPAEdmExtension()).andReturn(null);
     EasyMock.expect(odataJPAContext.getDefaultNaming()).andReturn(true);
+
+    EasyMock.replay(odataJPAContext);
+    return odataJPAContext;
+  }
+
+  public static ODataJPAContext mockODataJPAContext(final ODataContext context) {
+    ODataJPAContext odataJPAContext = EasyMock.createMock(ODataJPAContext.class);
+    EasyMock.expect(odataJPAContext.getPersistenceUnitName()).andStubReturn(NAMESPACE);
+    EasyMock.expect(odataJPAContext.getEntityManagerFactory()).andReturn(mockEntityManagerFactory());
+    EasyMock.expect(odataJPAContext.getJPAEdmMappingModel()).andReturn(MAPPING_MODEL);
+    EasyMock.expect(odataJPAContext.getJPAEdmExtension()).andReturn(null);
+    EasyMock.expect(odataJPAContext.getDefaultNaming()).andReturn(true);
+    EasyMock.expect(odataJPAContext.getODataContext()).andReturn(context).anyTimes();
+
     EasyMock.replay(odataJPAContext);
     return odataJPAContext;
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataServiceMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataServiceMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataServiceMock.java
new file mode 100644
index 0000000..c5478db
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/ODataServiceMock.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * 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.odata2.jpa.processor.core.mock;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.ODataService;
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmAssociation;
+import org.apache.olingo.odata2.api.edm.EdmComplexType;
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata2.api.edm.EdmServiceMetadata;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.jpa.processor.core.mock.data.EdmMockUtilV2;
+import org.easymock.EasyMock;
+
+public class ODataServiceMock {
+
+  private Edm edmMock = null;
+  public static final String SERVICE_ROOT = "http://apache.odata.org/OData.svc/";
+
+  public ODataService mock() throws ODataException {
+    ODataService odataService = EasyMock.createMock(ODataService.class);
+    EasyMock.expect(odataService.getEntityDataModel()).andReturn(mockEdm());
+    EasyMock.replay(odataService);
+    return odataService;
+
+  }
+
+  private Edm mockEdm() {
+    if (edmMock == null) {
+      edmMock = new EdmMock();
+    }
+    return edmMock;
+  }
+
+  public static class EdmMock implements Edm {
+
+    @Override
+    public EdmEntityContainer getEntityContainer(final String name) throws EdmException {
+      return EdmMockUtilV2.mockEdmEntityContainer(name);
+    }
+
+    @Override
+    public EdmEntityType getEntityType(final String namespace, final String name) throws EdmException {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public EdmComplexType getComplexType(final String namespace, final String name) throws EdmException {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public EdmAssociation getAssociation(final String namespace, final String name) throws EdmException {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public EdmServiceMetadata getServiceMetadata() {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public EdmEntityContainer getDefaultEntityContainer() throws EdmException {
+      return EdmMockUtilV2.mockEdmEntityContainer(null);
+    }
+
+    @Override
+    public List<EdmEntitySet> getEntitySets() throws EdmException {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+    @Override
+    public List<EdmFunctionImport> getFunctionImports() throws EdmException {
+      // TODO Auto-generated method stub
+      return null;
+    }
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/PathInfoMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/PathInfoMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/PathInfoMock.java
new file mode 100644
index 0000000..96a920c
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/PathInfoMock.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.odata2.jpa.processor.core.mock;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.uri.PathInfo;
+import org.apache.olingo.odata2.api.uri.PathSegment;
+import org.easymock.EasyMock;
+
+public class PathInfoMock {
+
+  private List<PathSegment> pathSegments;
+  private URI uri;
+
+  public void setPathSegments(final List<PathSegment> pathSegments) {
+    this.pathSegments = pathSegments;
+  }
+
+  public void setServiceRootURI(final String uriString) throws URISyntaxException {
+    uri = new URI(uriString);
+  }
+
+  public PathInfo mock() {
+    PathInfo pathInfo = EasyMock.createMock(PathInfo.class);
+    EasyMock.expect(pathInfo.getODataSegments()).andReturn(pathSegments);
+    EasyMock.expect(pathInfo.getServiceRoot()).andReturn(uri);
+
+    EasyMock.replay(pathInfo);
+    return pathInfo;
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/PathSegmentMock.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/PathSegmentMock.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/PathSegmentMock.java
new file mode 100644
index 0000000..77d1fbd
--- /dev/null
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/PathSegmentMock.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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.odata2.jpa.processor.core.mock;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.uri.PathSegment;
+
+public class PathSegmentMock implements PathSegment {
+
+  private String path;
+
+  public void setPath(final String path) {
+    this.path = path;
+  }
+
+  @Override
+  public String getPath() {
+    return path;
+  }
+
+  @Override
+  public Map<String, List<String>> getMatrixParameters() {
+    return null;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtilV2.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtilV2.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtilV2.java
index 2189219..2ecf5dd 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtilV2.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/mock/data/EdmMockUtilV2.java
@@ -26,6 +26,7 @@ import java.util.UUID;
 import org.apache.olingo.odata2.api.edm.EdmAssociation;
 import org.apache.olingo.odata2.api.edm.EdmAssociationEnd;
 import org.apache.olingo.odata2.api.edm.EdmComplexType;
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
 import org.apache.olingo.odata2.api.edm.EdmEntitySet;
 import org.apache.olingo.odata2.api.edm.EdmEntityType;
 import org.apache.olingo.odata2.api.edm.EdmException;
@@ -33,7 +34,7 @@ import org.apache.olingo.odata2.api.edm.EdmMapping;
 import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
 import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
 import org.apache.olingo.odata2.api.edm.EdmProperty;
-import org.apache.olingo.odata2.api.edm.EdmType;
+import org.apache.olingo.odata2.api.edm.EdmSimpleType;
 import org.apache.olingo.odata2.api.edm.EdmTypeKind;
 import org.apache.olingo.odata2.api.edm.provider.Mapping;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmMapping;
@@ -49,6 +50,19 @@ public class EdmMockUtilV2 {
 
   }
 
+  public static EdmEntityContainer mockEdmEntityContainer(final String entityName) throws EdmException {
+    EdmEntityContainer entityContainer = EasyMock.createMock(EdmEntityContainer.class);
+    entityContainer = EasyMock.createMock(EdmEntityContainer.class);
+    EasyMock.expect(entityContainer.getEntitySet(JPATypeMock.ENTITY_NAME)).andReturn(
+        mockEdmEntitySet(JPATypeMock.ENTITY_NAME, false));
+    EasyMock.expect(entityContainer.getFunctionImport(JPATypeMock.ENTITY_NAME)).andReturn(null);
+    EasyMock.expect(entityContainer.getEntitySet("JPATypeMockInvalid")).andReturn(null);
+    EasyMock.expect(entityContainer.getFunctionImport("JPATypeMockInvalid")).andReturn(null);
+    EasyMock.replay(entityContainer);
+
+    return entityContainer;
+  }
+
   public static EdmEntityType mockEdmEntityType(final String entityName, final boolean withComplexType)
       throws EdmException {
 
@@ -64,6 +78,7 @@ public class EdmMockUtilV2 {
     EasyMock.expect(entityType.getNavigationPropertyNames()).andReturn(mockNavigationPropertyNames(entityName));
     EasyMock.expect(entityType.getKind()).andReturn(EdmTypeKind.ENTITY);
     EasyMock.expect(entityType.getMapping()).andReturn((EdmMapping) mockEdmMapping(entityName, null, null));
+    EasyMock.expect(entityType.getKeyProperties()).andReturn(mockKeyProperties(entityName)).anyTimes();
     if (entityName.equals(JPATypeMock.ENTITY_NAME)) {
       EasyMock.expect(entityType.getProperty(JPATypeMock.PROPERTY_NAME_MINT)).andReturn(
           mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MINT)).anyTimes();
@@ -89,6 +104,13 @@ public class EdmMockUtilV2 {
     return entityType;
   }
 
+  public static List<EdmProperty> mockKeyProperties(final String entityName) throws EdmException {
+    List<EdmProperty> edmProperties = new ArrayList<EdmProperty>();
+    edmProperties.add(mockEdmProperty(entityName, JPATypeMock.PROPERTY_NAME_MINT));
+
+    return edmProperties;
+  }
+
   public static List<String> mockNavigationPropertyNames(final String entityName) {
     List<String> propertyNames = new ArrayList<String>();
     propertyNames.add(JPATypeMock.NAVIGATION_PROPERTY_X);
@@ -211,9 +233,10 @@ public class EdmMockUtilV2 {
         propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MDOUBLE) ||
         propertyName.equals(JPARelatedTypeMock.PROPERTY_NAME_MBYTEARRAY)) {
 
-      EdmType edmType = EasyMock.createMock(EdmType.class);
+      EdmSimpleType edmType = EasyMock.createMock(EdmSimpleType.class);
       EasyMock.expect(edmProperty.getType()).andReturn(edmType).anyTimes();
       EasyMock.expect(edmType.getKind()).andReturn(EdmTypeKind.SIMPLE).anyTimes();
+      EasyMock.expect(edmType.isCompatible(EasyMock.isA(EdmSimpleType.class))).andReturn(true).anyTimes();
       EasyMock.replay(edmType);
       EasyMock.expect(edmProperty.getName()).andReturn(propertyName).anyTimes();
       EasyMock.expect(edmProperty.getMapping()).andReturn((EdmMapping) mockEdmMapping(entityName, propertyName, null))

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationEndTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationEndTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationEndTest.java
index b756f91..a066972 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationEndTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationEndTest.java
@@ -37,7 +37,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAAttributeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.SimpleType;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.SimpleType.SimpleTypeA;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmAssociationEnd;
 import org.junit.BeforeClass;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationSetTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationSetTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationSetTest.java
index cb7d252..2cf50ca 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationSetTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationSetTest.java
@@ -40,7 +40,6 @@ import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmAssociationView;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntityContainerView;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntitySetView;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmAssociationSet;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationTest.java
index 3923dd8..8c3b119 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmAssociationTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
-
+ * 
  * 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
@@ -48,9 +48,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAAttributeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.SimpleType;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.SimpleType.SimpleTypeA;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmAssociation;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmAssociationEnd;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmReferentialConstraint;
 import org.easymock.EasyMock;
 import org.junit.BeforeClass;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmBaseViewImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmBaseViewImplTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmBaseViewImplTest.java
index 237a6a3..4f4a479 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmBaseViewImplTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmBaseViewImplTest.java
@@ -26,7 +26,6 @@ import javax.persistence.metamodel.Metamodel;
 
 import org.apache.olingo.odata2.jpa.processor.api.access.JPAEdmBuilder;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmBaseViewImpl;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmComplexTypeTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmComplexTypeTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmComplexTypeTest.java
index 9ab7872..ae1c5f1 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmComplexTypeTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmComplexTypeTest.java
@@ -46,8 +46,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEmbeddableMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPASingularAttributeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmComplexType;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmMappingImpl;
 import org.junit.BeforeClass;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityContainerTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityContainerTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityContainerTest.java
index 0d6a2c1..f94fa6f 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityContainerTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityContainerTest.java
@@ -43,7 +43,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEntityTypeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPASingularAttributeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmEntityContainer;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntitySetTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntitySetTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntitySetTest.java
index f8f5321..6994dd9 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntitySetTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntitySetTest.java
@@ -43,7 +43,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEntityTypeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPASingularAttributeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmEntitySet;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityTypeTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityTypeTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityTypeTest.java
index ad1a5c0..8c79ece 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityTypeTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmEntityTypeTest.java
@@ -40,7 +40,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEntityTypeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPASingularAttributeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmEntityType;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFunctionImportTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFunctionImportTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFunctionImportTest.java
index 5992418..db23397 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFunctionImportTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmFunctionImportTest.java
@@ -47,7 +47,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.ODataJPAContextMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPACustomProcessorMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model._JPACustomProcessorNegativeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmFunctionImport;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmKeyTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmKeyTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmKeyTest.java
index 533e4e8..459a2c4 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmKeyTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmKeyTest.java
@@ -42,7 +42,6 @@ import org.apache.olingo.odata2.jpa.processor.core.mock.ODataJPAContextMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAAttributeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.ComplexType.ComplexTypeA;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmKey;
 import org.junit.BeforeClass;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmModelTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmModelTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmModelTest.java
index 354f910..120b209 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmModelTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmModelTest.java
@@ -34,7 +34,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEmbeddableMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPASingularAttributeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmModel;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmNavigationPropertyTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmNavigationPropertyTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmNavigationPropertyTest.java
index 8c7aea6..354fecc 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmNavigationPropertyTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmNavigationPropertyTest.java
@@ -37,7 +37,6 @@ import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntityTypeView;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEntityTypeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAPluralAttributeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmNavigationProperty;
 import org.junit.BeforeClass;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java
index 877d883..c204d1f 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmPropertyTest.java
@@ -47,14 +47,13 @@ import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntityContainerVie
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntitySetView;
 import org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmEntityTypeView;
 import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
+import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.ComplexType;
+import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.SimpleType;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEmbeddableTypeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEntityTypeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAPluralAttributeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPASingularAttributeMock;
-import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.ComplexType;
-import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAEdmMockData.SimpleType;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmProperty;
 import org.junit.Test;
 
 public class JPAEdmPropertyTest extends JPAEdmTestModelView {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRoleTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRoleTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRoleTest.java
index a453984..5737c41 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRoleTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintRoleTest.java
@@ -47,8 +47,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAAttributeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAJavaMemberMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAManagedTypeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmMappingImpl;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmReferentialConstraintRole;
 import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintTest.java
index 885ff86..6e7f6b3 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmReferentialConstraintTest.java
@@ -40,7 +40,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAAttributeMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAJavaMemberMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAManagedTypeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmReferentialConstraint;
 import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmSchemaTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmSchemaTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmSchemaTest.java
index b366191..8408c9f 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmSchemaTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmSchemaTest.java
@@ -28,7 +28,6 @@ import javax.persistence.metamodel.Metamodel;
 
 import org.apache.olingo.odata2.jpa.processor.api.access.JPAEdmBuilder;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model.JPAMetaModelMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmSchema;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmTestModelView.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmTestModelView.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmTestModelView.java
index d145239..7a6f90f 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmTestModelView.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/JPAEdmTestModelView.java
@@ -386,15 +386,21 @@ public class JPAEdmTestModelView implements JPAEdmAssociationEndView, JPAEdmAsso
   }
 
   @Override
-  public boolean isReferencedInKey(String complexTypeName) {
+  public boolean isReferencedInKey(final String complexTypeName) {
     // TODO Auto-generated method stub
     return false;
   }
 
   @Override
-  public void setReferencedInKey(String complexTypeName) {
+  public void setReferencedInKey(final String complexTypeName) {
     // TODO Auto-generated method stub
 
   }
 
+  @Override
+  public Attribute<?, ?> getJPAReferencedAttribute() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/_JPAEdmFunctionImportTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/_JPAEdmFunctionImportTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/_JPAEdmFunctionImportTest.java
index 02b6c9f..e8f3e7b 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/_JPAEdmFunctionImportTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/model/_JPAEdmFunctionImportTest.java
@@ -48,7 +48,6 @@ import org.apache.olingo.odata2.jpa.processor.core.common.ODataJPATestConstants;
 import org.apache.olingo.odata2.jpa.processor.core.mock.ODataJPAContextMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model._JPACustomProcessorMock;
 import org.apache.olingo.odata2.jpa.processor.core.mock.model._JPACustomProcessorNegativeMock;
-import org.apache.olingo.odata2.jpa.processor.core.model.JPAEdmFunctionImport;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java
index ab21848..0ae4adf 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Address.java
@@ -48,7 +48,7 @@ public class Address {
 
   @Column(name = "COUNTRY")
   private String country;
-  
+
   @Column(name = "PINCODE")
   private String pincode;
 
@@ -56,7 +56,7 @@ public class Address {
     return pincode;
   }
 
-  public void setPincode(String pincode) {
+  public void setPincode(final String pincode) {
     this.pincode = pincode;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java
index 34891a7..22e2966 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Category.java
@@ -32,10 +32,10 @@ import javax.persistence.Table;
 public class Category {
 
   @Id
-  @Column(name="CODE")
+  @Column(name = "CODE")
   private char code[] = new char[2];
 
-  @Column(name="DESC")
+  @Column(name = "DESC")
   private String description;
 
   @OneToMany(mappedBy = "category")
@@ -45,7 +45,7 @@ public class Category {
     return materials;
   }
 
-  public void setMaterials(List<Material> materials) {
+  public void setMaterials(final List<Material> materials) {
     this.materials = materials;
   }
 
@@ -53,7 +53,7 @@ public class Category {
     return code;
   }
 
-  public void setCode(char[] code) {
+  public void setCode(final char[] code) {
     this.code = code;
   }
 
@@ -61,7 +61,7 @@ public class Category {
     return description;
   }
 
-  public void setDescription(String description) {
+  public void setDescription(final String description) {
     this.description = description;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
index c28e37e..18f24b4 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Customer.java
@@ -49,7 +49,7 @@ public class Customer {
     return id;
   }
 
-  public void setId(Long id) {
+  public void setId(final Long id) {
     this.id = id;
   }
 
@@ -57,7 +57,7 @@ public class Customer {
     return name;
   }
 
-  public void setName(String name) {
+  public void setName(final String name) {
     this.name = name;
   }
 
@@ -65,7 +65,7 @@ public class Customer {
     return orders;
   }
 
-  public void setOrders(List<SalesOrderHeader> orders) {
+  public void setOrders(final List<SalesOrderHeader> orders) {
     this.orders = orders;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
index 7330042..c4ca423 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/Material.java
@@ -40,7 +40,6 @@ public class Material {
       final String measurementUnit) {
     super();
     this.materialName = materialName;
-    this.typeCode = typeCode;
     this.price = price;
     this.measurementUnit = measurementUnit;
   }
@@ -52,9 +51,6 @@ public class Material {
   @Column(name = "MATERIAL_NAME")
   private String materialName;
 
-  @Column(name = "TYPE_CODE")
-  private char[] typeCode = new char[2];
-
   @Column(name = "PRICE")
   private double price;
 
@@ -80,7 +76,7 @@ public class Material {
     return category;
   }
 
-  public void setCategory(Category category) {
+  public void setCategory(final Category category) {
     this.category = category;
   }
 
@@ -92,14 +88,6 @@ public class Material {
     this.materialName = materialName;
   }
 
-  public char[] getTypeCode() {
-    return typeCode;
-  }
-
-  public void setTypeCode(final char[] typeCode) {
-    this.typeCode = typeCode;
-  }
-
   public double getPrice() {
     return price;
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java
index 3ed1ee5..c6a28c5 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderHeader.java
@@ -98,7 +98,7 @@ public class SalesOrderHeader {
     return customerId;
   }
 
-  public void setCustomerId(Long customerId) {
+  public void setCustomerId(final Long customerId) {
     this.customerId = customerId;
   }
 
@@ -106,7 +106,7 @@ public class SalesOrderHeader {
     return customer;
   }
 
-  public void setCustomer(Customer customer) {
+  public void setCustomer(final Customer customer) {
     this.customer = customer;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml b/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
index b5ff286..29e5007 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
+++ b/odata2-jpa-processor/jpa-ref/src/main/resources/META-INF/persistence.xml
@@ -18,10 +18,10 @@
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.SalesOrderHeader</class>
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.SalesOrderItem</class>
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Note</class>
-		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Material</class>
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Store</class>
-		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Category</class>
 		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Customer</class>
+		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Category</class>
+		<class>org.apache.olingo.odata2.jpa.processor.ref.model.Material</class>
 		<properties>
 			<property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" />
 			<property name="javax.persistence.jdbc.url"

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OrderValue.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OrderValue.java b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OrderValue.java
index 9dde58f..7b056e0 100644
--- a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OrderValue.java
+++ b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/OrderValue.java
@@ -27,7 +27,7 @@ public class OrderValue {
     return amount;
   }
 
-  public void setAmount(double amount) {
+  public void setAmount(final double amount) {
     this.amount = amount;
   }
 
@@ -35,7 +35,7 @@ public class OrderValue {
     return currency;
   }
 
-  public void setCurrency(String currency) {
+  public void setCurrency(final String currency) {
     this.currency = currency;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/352f5412/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderProcessingExtension.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderProcessingExtension.java b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderProcessingExtension.java
index 94aad4f..3133944 100644
--- a/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderProcessingExtension.java
+++ b/odata2-jpa-processor/jpa-web/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/extension/SalesOrderProcessingExtension.java
@@ -39,24 +39,24 @@ public class SalesOrderProcessingExtension implements JPAEdmExtension {
 
   private ComplexType getComplexType() {
     ComplexType complexType = new ComplexType();
-    
+
     List<Property> properties = new ArrayList<Property>();
     SimpleProperty property = new SimpleProperty();
-    
+
     property.setName("Amount");
     property.setType(EdmSimpleTypeKind.Double);
     properties.add(property);
-    
+
     property = new SimpleProperty();
     property.setName("Currency");
     property.setType(EdmSimpleTypeKind.String);
     properties.add(property);
-    
+
     complexType.setName("OrderValue");
     complexType.setProperties(properties);
-    
+
     return complexType;
-    
+
   }
 
   @Override


[08/35] git commit: [OLINGO-113] Fixed too long line (checkstyle)

Posted by sk...@apache.org.
[OLINGO-113] Fixed too long line (checkstyle)


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/d98180e6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/d98180e6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/d98180e6

Branch: refs/heads/master
Commit: d98180e6e0e77fde212d6e84ecf3450db4c55dcb
Parents: 42290ba
Author: Michael Bolz <mi...@apache.org>
Authored: Thu Jan 9 13:59:00 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Tue Jan 14 12:24:42 2014 +0100

----------------------------------------------------------------------
 .../processor/core/datasource/AnnotationInMemoryDs.java           | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d98180e6/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java
index 2f8fa10..db5b79b 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java
@@ -50,7 +50,8 @@ public class AnnotationInMemoryDs implements DataSource {
     this(annotatedClasses, true);
   }
 
-  public AnnotationInMemoryDs(final Collection<Class<?>> annotatedClasses, final boolean persistInMemory) throws ODataException {
+  public AnnotationInMemoryDs(final Collection<Class<?>> annotatedClasses, final boolean persistInMemory) 
+      throws ODataException {
     this.persistInMemory = persistInMemory;
     init(annotatedClasses);
   }


[05/35] git commit: [OLINGO-88] Added default values

Posted by sk...@apache.org.
[OLINGO-88] Added default values


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/10af6980
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/10af6980
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/10af6980

Branch: refs/heads/master
Commit: 10af698022d62129f1aa36b603a613742c19fbe0
Parents: 17a1b04
Author: Michael Bolz <mi...@apache.org>
Authored: Fri Jan 10 07:57:36 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Tue Jan 14 12:24:42 2014 +0100

----------------------------------------------------------------------
 .../main/resources/META-INF/maven/archetype-metadata.xml | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/10af6980/odata2-sample/cars-annotation-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
----------------------------------------------------------------------
diff --git a/odata2-sample/cars-annotation-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/odata2-sample/cars-annotation-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
index 81286c8..10d3ba2 100644
--- a/odata2-sample/cars-annotation-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/odata2-sample/cars-annotation-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -4,6 +4,17 @@
   name="olingo-odata2-sample-cars-annotation-incubating"
   xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <requiredProperties>
+    <requiredProperty key="groupId">
+      <defaultValue>org.apache.olingo</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="artifactId">
+      <defaultValue>cars-annotations-sample</defaultValue>
+    </requiredProperty>
+    <requiredProperty key="version">
+      <defaultValue>1.0.0-SNAPSHOT</defaultValue>
+    </requiredProperty>
+  </requiredProperties>
   <fileSets>
     <fileSet filtered="true" packaged="true" encoding="UTF-8">
       <directory>src/main/java</directory>


[22/35] git commit: [OLINGO-117] TDD Unit test and API design

Posted by sk...@apache.org.
[OLINGO-117] TDD Unit test and API design


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/d8159ab0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/d8159ab0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/d8159ab0

Branch: refs/heads/master
Commit: d8159ab0fe7e6528288e23e0eebd0cc6bec9c366
Parents: 0efcc30
Author: Stephan Klevenz <sk...@apache.org>
Authored: Mon Jan 20 15:10:04 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Mon Jan 20 15:10:04 2014 +0100

----------------------------------------------------------------------
 .../olingo/odata2/api/ep/feed/ODataFeed.java    |  15 ++
 .../odata2/core/ep/feed/ODataFeedImpl.java      |  19 ++
 .../JsonFeedWithDeltaLinkProducerTest.java      |   2 +-
 .../odata2/fit/client/ClientDeltaResponse.java  |  83 --------
 .../fit/client/ClientDeltaResponseTest.java     | 197 +++++++++++++++++++
 .../olingo/odata2/fit/client/util/Client.java   |  27 ++-
 6 files changed, 251 insertions(+), 92 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d8159ab0/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java
index 9b98ec9..bd76e48 100644
--- a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java
+++ b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java
@@ -20,6 +20,7 @@ package org.apache.olingo.odata2.api.ep.feed;
 
 import java.util.List;
 
+import org.apache.olingo.odata2.api.ep.entry.EntryMetadata;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
 
 /**
@@ -40,4 +41,18 @@ public interface ODataFeed {
    */
   public FeedMetadata getFeedMetadata();
 
+  /**
+   * Delta responses can contain changed feed data and deleted entries metadata. A delta response it the result of
+   * a delta link.
+   * @return true in case of feed is result of a delta response (contains changed feed entries and deleted entries)
+   */
+  public boolean isDeltaFeed();
+
+  /**
+   * Delta responses can contain changed feed data and deleted entries metadata. A delta response it the result of
+   * a delta link.
+   * @return metadata of deleted entries in case of feed is result of a delta response
+   */
+  public List<EntryMetadata> getDeletedEntries();
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d8159ab0/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataFeedImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataFeedImpl.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataFeedImpl.java
index 634c0bc..c81890a 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataFeedImpl.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataFeedImpl.java
@@ -20,6 +20,7 @@ package org.apache.olingo.odata2.core.ep.feed;
 
 import java.util.List;
 
+import org.apache.olingo.odata2.api.ep.entry.EntryMetadata;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
 import org.apache.olingo.odata2.api.ep.feed.FeedMetadata;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
@@ -28,11 +29,19 @@ public class ODataFeedImpl implements ODataFeed {
 
   private final List<ODataEntry> entries;
   private final FeedMetadata feedMetadata;
+  private boolean isDeltaFeed = false;
+  private List<EntryMetadata> deletedEntries = null;
 
   public ODataFeedImpl(final List<ODataEntry> entries, final FeedMetadata feedMetadata) {
     this.entries = entries;
     this.feedMetadata = feedMetadata;
+  }
 
+  public ODataFeedImpl(final List<ODataEntry> entries, final FeedMetadata feedMetadata, boolean isDeltaFeed,
+      List<EntryMetadata> deletedEntries) {
+    this(entries, feedMetadata);
+    this.isDeltaFeed = isDeltaFeed;
+    this.deletedEntries = deletedEntries;
   }
 
   @Override
@@ -45,4 +54,14 @@ public class ODataFeedImpl implements ODataFeed {
     return feedMetadata;
   }
 
+  @Override
+  public boolean isDeltaFeed() {
+    return isDeltaFeed;
+  }
+
+  @Override
+  public List<EntryMetadata> getDeletedEntries() {
+    return deletedEntries;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d8159ab0/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
index d1ff8ee..4dddc31 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
@@ -52,7 +52,7 @@ public class JsonFeedWithDeltaLinkProducerTest extends BaseTest {
       EntityProviderWriteProperties.serviceRoot(URI.create(BASE_URI)).build();
 
   private ArrayList<Map<String, Object>> deletedRoomData;
-  protected ArrayList<Map<String, Object>> roomsData;
+  private ArrayList<Map<String, Object>> roomsData;
 
   private Gson gson = new Gson();
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d8159ab0/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponse.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponse.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponse.java
deleted file mode 100644
index 32f70af..0000000
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponse.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.apache.olingo.odata2.fit.client;
-
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.*;
-
-import java.io.IOException;
-import java.net.Proxy;
-import java.util.List;
-
-import org.apache.olingo.odata2.api.ODataService;
-import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
-import org.apache.olingo.odata2.api.edm.Edm;
-import org.apache.olingo.odata2.api.edm.EdmEntitySetInfo;
-import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
-import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
-import org.apache.olingo.odata2.api.exception.ODataException;
-import org.apache.olingo.odata2.api.processor.ODataResponse;
-import org.apache.olingo.odata2.api.processor.ODataSingleProcessor;
-import org.apache.olingo.odata2.api.processor.part.MetadataProcessor;
-import org.apache.olingo.odata2.api.uri.info.GetMetadataUriInfo;
-import org.apache.olingo.odata2.core.processor.ODataSingleProcessorService;
-import org.apache.olingo.odata2.fit.client.util.Client;
-import org.apache.olingo.odata2.fit.client.util.HttpException;
-import org.apache.olingo.odata2.ref.edm.ScenarioEdmProvider;
-import org.apache.olingo.odata2.testutil.fit.AbstractFitTest;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class ClientDeltaResponse extends AbstractFitTest {
-
-  private Client client;
-
-  @Before
-  @Override
-  public void before() {
-    super.before();
-    try {
-      client = new Client(getEndpoint().toASCIIString());
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  private class StubProcessor extends ODataSingleProcessor {
-    
-  }
-  
-  @Override
-  protected ODataService createService() throws ODataException {
-    EdmProvider provider = new ScenarioEdmProvider();
-    ODataSingleProcessor processor = new StubProcessor();
-    
-     return new ODataSingleProcessorService(provider, processor);
-  }
-
-  @Test
-  public void dummy() throws Exception {}
-
-  @Test
-  public void testEdm() throws Exception {
-    Edm edm = client.getEdm();
-    assertNotNull(edm);
-    assertNotNull(edm.getDefaultEntityContainer());
-
-    System.out.println(edm.getDefaultEntityContainer().getName());
-  }
-
-  @Test
-  public void testEntitySets() throws Exception {
-    List<EdmEntitySetInfo> sets = client.getEntitySets();
-    assertNotNull(sets);
-    assertEquals(6, sets.size());
-  }
-
-  @Test
-  public void testEntity() throws Exception {
-    ODataFeed feed = client.readFeed("Container1", "Rooms", "application/atom+xml");
-    assertNotNull(feed);
-  }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d8159ab0/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
new file mode 100644
index 0000000..f641577
--- /dev/null
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
@@ -0,0 +1,197 @@
+package org.apache.olingo.odata2.fit.client;
+
+import static org.junit.Assert.*;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.ODataCallback;
+import org.apache.olingo.odata2.api.ODataService;
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmEntitySetInfo;
+import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
+import org.apache.olingo.odata2.api.ep.EntityProvider;
+import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
+import org.apache.olingo.odata2.api.ep.callback.TombstoneCallback;
+import org.apache.olingo.odata2.api.ep.entry.EntryMetadata;
+import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.api.processor.ODataSingleProcessor;
+import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo;
+import org.apache.olingo.odata2.core.ep.producer.TombstoneCallbackImpl;
+import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
+import org.apache.olingo.odata2.core.processor.ODataSingleProcessorService;
+import org.apache.olingo.odata2.fit.client.util.Client;
+import org.apache.olingo.odata2.ref.edm.ScenarioEdmProvider;
+import org.apache.olingo.odata2.testutil.fit.AbstractFitTest;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class ClientDeltaResponseTest extends AbstractFitTest {
+
+  private static final String DELTATOKEN_1234 = "!deltatoken=1234";
+
+  private Client client;
+
+  private ArrayList<Map<String, Object>> createRoomData() {
+
+    Map<String, Object> roomData1 = new HashMap<String, Object>();
+    roomData1.put("Id", "1");
+    roomData1.put("Seats", 123);
+    roomData1.put("Version", 1);
+    Map<String, Object> roomData2 = new HashMap<String, Object>();
+    roomData2.put("Id", "2");
+    roomData2.put("Seats", 66);
+    roomData2.put("Version", 2);
+
+    ArrayList<Map<String, Object>> roomsData = new ArrayList<Map<String, Object>>();
+    roomsData.add(roomData1);
+    roomsData.add(roomData2);
+
+    return roomsData;
+  }
+
+  private ArrayList<Map<String, Object>> createDeletedRoomData() {
+    Map<String, Object> roomData1 = new HashMap<String, Object>();
+    roomData1.put("Id", "3");
+    roomData1.put("Seats", 123);
+    roomData1.put("Version", 1);
+    Map<String, Object> roomData2 = new HashMap<String, Object>();
+    roomData2.put("Id", "4");
+    roomData2.put("Seats", 66);
+    roomData2.put("Version", 2);
+
+    ArrayList<Map<String, Object>> deletedRoomData = new ArrayList<Map<String, Object>>();
+    deletedRoomData.add(roomData1);
+    deletedRoomData.add(roomData2);
+    return deletedRoomData;
+  }
+
+  @Before
+  @Override
+  public void before() {
+    super.before();
+    try {
+      client = new Client(getEndpoint().toASCIIString());
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+
+    createRoomData();
+  }
+
+  private class StubProcessor extends ODataSingleProcessor {
+
+    @Override
+    public ODataResponse readEntitySet(GetEntitySetUriInfo uriInfo, String contentType) throws ODataException {
+      try {
+        ArrayList<Map<String, Object>> deletedRoomData = null;
+        ODataResponse response = null;
+        EntityProviderWriteProperties properties = null;
+
+        URI requestUri = getContext().getPathInfo().getRequestUri();
+
+        if (requestUri.getQuery() != null && requestUri.getQuery().contains(DELTATOKEN_1234)) {
+          deletedRoomData = createDeletedRoomData();
+        }
+
+        URI deltaLink;
+        deltaLink =
+            new URI(requestUri.getScheme(), requestUri.getUserInfo(), requestUri.getHost(), requestUri.getPort(),
+                requestUri.getPath(), DELTATOKEN_1234, requestUri.getFragment());
+
+        TombstoneCallback tombstoneCallback =
+            new TombstoneCallbackImpl(deletedRoomData, deltaLink.toASCIIString());
+
+        HashMap<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
+        callbacks.put(TombstoneCallback.CALLBACK_KEY_TOMBSTONE, tombstoneCallback);
+
+        properties =
+            EntityProviderWriteProperties.serviceRoot(getContext().getPathInfo().getServiceRoot()).callbacks(callbacks)
+                .build();
+
+        response = EntityProvider.writeFeed(contentType, uriInfo.getTargetEntitySet(), createRoomData(), properties);
+
+        return response;
+      } catch (URISyntaxException e) {
+        throw new ODataRuntimeException(e);
+
+      }
+    }
+  }
+
+  @Override
+  protected ODataService createService() throws ODataException {
+    EdmProvider provider = new ScenarioEdmProvider();
+    ODataSingleProcessor processor = new StubProcessor();
+
+    return new ODataSingleProcessorService(provider, processor);
+  }
+
+  @Test
+  public void dummy() throws Exception {}
+
+  @Test
+  public void testEdm() throws Exception {
+    Edm edm = client.getEdm();
+    assertNotNull(edm);
+    assertNotNull(edm.getDefaultEntityContainer());
+
+    System.out.println(edm.getDefaultEntityContainer().getName());
+  }
+
+  @Test
+  public void testEntitySets() throws Exception {
+    List<EdmEntitySetInfo> sets = client.getEntitySets();
+    assertNotNull(sets);
+    assertEquals(6, sets.size());
+  }
+
+  private void testDeltaFeedWithDeltaLink(String contentType) throws Exception {
+    ODataFeed feed = client.readFeed("Container1", "Rooms", contentType);
+    String deltaLink = feed.getFeedMetadata().getDeltaLink();
+
+    assertNotNull(feed);
+    assertEquals(2, feed.getEntries().size());
+    assertEquals(getEndpoint().toASCIIString() + "Rooms?" + DELTATOKEN_1234, feed.getFeedMetadata().getDeltaLink());
+    assertFalse(feed.isDeltaFeed());
+
+    URI uri = new URI(deltaLink);
+    String query = uri.getQuery();
+    ODataFeed deltaFeed = client.readFeed("Container1", "Rooms", contentType, query);
+
+    assertNotNull(deltaFeed);
+    assertEquals(2, deltaFeed.getEntries().size());
+    assertEquals(uri.toASCIIString(), deltaFeed.getFeedMetadata().getDeltaLink());
+
+    assertTrue(deltaFeed.isDeltaFeed());
+    List<EntryMetadata> deletedEntries = deltaFeed.getDeletedEntries();
+    assertNotNull(deletedEntries);
+    assertEquals(2, deletedEntries.size());
+
+    assertEquals("3", deletedEntries.get(0).getId());
+    assertEquals("uri3", deletedEntries.get(0).getUri());
+
+    assertEquals("4", deletedEntries.get(1).getId());
+    assertEquals("uri4", deletedEntries.get(1).getUri());
+  }
+
+  @Test
+  public void testDeltaFeedWithDeltaLinkXml() throws Exception {
+    testDeltaFeedWithDeltaLink("application/atom+xml");
+  }
+
+  @Test
+  @Ignore("not implemented")
+  public void testFeedWithDeltaLinkJson() throws Exception {
+    testDeltaFeedWithDeltaLink("application/json");
+  }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/d8159ab0/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
index ef68b58..bf682b5 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
@@ -37,7 +37,8 @@ public class Client {
 
   private Edm edm;
 
-  public Client(String serviceUrl, Proxy.Type protocol, String proxy, int port) throws IOException, ODataException, HttpException {
+  public Client(String serviceUrl, Proxy.Type protocol, String proxy, int port) throws IOException, ODataException,
+      HttpException {
     this.serviceUrl = serviceUrl;
     this.protocol = protocol;
     this.proxy = proxy;
@@ -56,7 +57,8 @@ public class Client {
     edm = getEdmInternal();
   }
 
-  public Client(String serviceUrl, Proxy.Type protocol, String proxy, int port, String username, String password) throws IOException, ODataException, HttpException {
+  public Client(String serviceUrl, Proxy.Type protocol, String proxy, int port, String username, String password)
+      throws IOException, ODataException, HttpException {
     this.serviceUrl = serviceUrl;
     this.protocol = protocol;
     this.proxy = proxy;
@@ -80,7 +82,7 @@ public class Client {
   }
 
   private Edm getEdmInternal() throws IOException, ODataException, HttpException {
-    HttpURLConnection connection = connect(METADATA, APPLICATION_XML, "GET");
+    HttpURLConnection connection = connect(METADATA, null, APPLICATION_XML, "GET");
     edm = EntityProvider.readMetadata((InputStream) connection.getContent(), false);
     return edm;
   }
@@ -100,7 +102,13 @@ public class Client {
     return edm.getServiceMetadata().getEntitySetInfos();
   }
 
-  public ODataFeed readFeed(String entityContainerName, String entitySetName, String contentType) throws IOException, ODataException, HttpException {
+  public ODataFeed readFeed(String entityContainerName, String entitySetName, String contentType) throws IOException,
+      ODataException, HttpException {
+    return readFeed(entityContainerName, entitySetName, contentType, null);
+  }
+
+  public ODataFeed readFeed(String entityContainerName, String entitySetName, String contentType, String query)
+      throws IOException, ODataException, HttpException {
     EdmEntityContainer entityContainer = edm.getEntityContainer(entityContainerName);
     String relativeUri;
     if (entityContainer.isDefaultEntityContainer()) {
@@ -109,12 +117,15 @@ public class Client {
       relativeUri = entityContainerName + "." + entitySetName;
     }
 
-    InputStream content = (InputStream) connect(relativeUri, contentType, "GET").getContent();
-    return EntityProvider.readFeed(contentType, entityContainer.getEntitySet(entitySetName), content, EntityProviderReadProperties.init().build());
+    InputStream content = (InputStream) connect(relativeUri, query, contentType, "GET").getContent();
+    return EntityProvider.readFeed(contentType, entityContainer.getEntitySet(entitySetName), content,
+        EntityProviderReadProperties.init().build());
   }
 
-  private HttpURLConnection connect(String relativeUri, String contentType, String httpMethod) throws IOException, HttpException {
-    URL url = new URL(serviceUrl + relativeUri);
+  private HttpURLConnection connect(String relativeUri, String query, String contentType, String httpMethod)
+      throws IOException,
+      HttpException {
+    URL url = new URL(serviceUrl + relativeUri + (query != null ? "?" + query : ""));
     HttpURLConnection connection;
     if (useProxy) {
       Proxy proxy = new Proxy(protocol, new InetSocketAddress(this.proxy, port));


[20/35] git commit: [OLINGO-117] prepare for TDD

Posted by sk...@apache.org.
[OLINGO-117] prepare for TDD


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/255fcc05
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/255fcc05
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/255fcc05

Branch: refs/heads/master
Commit: 255fcc05ad0f2ee0cb25175d420bc442fd9ffd0e
Parents: f9d2a01
Author: Stephan Klevenz <st...@klaeff.de>
Authored: Fri Jan 17 18:04:28 2014 +0100
Committer: Stephan Klevenz <st...@klaeff.de>
Committed: Fri Jan 17 18:04:28 2014 +0100

----------------------------------------------------------------------
 .../odata2/fit/client/ClientDeltaResponse.java  |  84 +++++++++++
 .../olingo/odata2/fit/client/util/Client.java   | 140 +++++++++++++++++++
 .../odata2/fit/client/util/HttpException.java   |  19 +++
 3 files changed, 243 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/255fcc05/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponse.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponse.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponse.java
new file mode 100644
index 0000000..6c8ef5b
--- /dev/null
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponse.java
@@ -0,0 +1,84 @@
+package org.apache.olingo.odata2.fit.client;
+
+import static org.junit.Assert.*;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.*;
+
+import java.io.IOException;
+import java.net.Proxy;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.ODataService;
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmEntitySetInfo;
+import org.apache.olingo.odata2.api.edm.provider.EdmProvider;
+import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.api.processor.ODataSingleProcessor;
+import org.apache.olingo.odata2.api.processor.part.MetadataProcessor;
+import org.apache.olingo.odata2.api.uri.info.GetMetadataUriInfo;
+import org.apache.olingo.odata2.core.processor.ODataSingleProcessorService;
+import org.apache.olingo.odata2.fit.client.util.Client;
+import org.apache.olingo.odata2.fit.client.util.HttpException;
+import org.apache.olingo.odata2.ref.edm.ScenarioEdmProvider;
+import org.apache.olingo.odata2.testutil.fit.AbstractFitTest;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class ClientDeltaResponse extends AbstractFitTest {
+
+  private Client client;
+
+  @Before
+  @Override
+  public void before() {
+    super.before();
+    try {
+      client = new Client(getEndpoint().toASCIIString());
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  private class StubProcessor extends ODataSingleProcessor {
+    
+  }
+  
+  @Override
+  protected ODataService createService() throws ODataException {
+    EdmProvider provider = new ScenarioEdmProvider();
+    ODataSingleProcessor processor = new StubProcessor();
+    
+     return new ODataSingleProcessorService(provider, processor);
+  }
+
+  @Test
+  public void dummy() throws Exception {}
+
+  @Test
+  public void testEdm() throws Exception {
+    Edm edm = client.getEdm();
+    assertNotNull(edm);
+    assertNotNull(edm.getDefaultEntityContainer());
+
+    System.out.println(edm.getDefaultEntityContainer().getName());
+  }
+
+  @Test
+  public void testEntitySets() throws Exception {
+    List<EdmEntitySetInfo> sets = client.getEntitySets();
+    assertNotNull(sets);
+    assertEquals(6, sets.size());
+  }
+
+  @Test
+//  @Ignore
+  public void testEntity() throws Exception {
+    ODataFeed feed = client.readFeed("Container1", "Rooms", "application/atom+xml");
+    assertNotNull(feed);
+  }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/255fcc05/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
new file mode 100644
index 0000000..ef68b58
--- /dev/null
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/Client.java
@@ -0,0 +1,140 @@
+package org.apache.olingo.odata2.fit.client.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmEntitySetInfo;
+import org.apache.olingo.odata2.api.ep.EntityProvider;
+import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
+import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
+import org.apache.olingo.odata2.api.exception.ODataException;
+
+public class Client {
+
+  public static final String APPLICATION_JSON = "application/json";
+  public static final String APPLICATION_XML = "application/xml";
+  public static final String APPLICATION_ATOM_XML = "application/atom+xml";
+
+  public static final String METADATA = "$metadata";
+
+  private String serviceUrl;
+  private Proxy.Type protocol;
+  private String proxy;
+  private int port;
+  private boolean useProxy;
+  private String username;
+  private String password;
+  private boolean useAuthentication;
+
+  private Edm edm;
+
+  public Client(String serviceUrl, Proxy.Type protocol, String proxy, int port) throws IOException, ODataException, HttpException {
+    this.serviceUrl = serviceUrl;
+    this.protocol = protocol;
+    this.proxy = proxy;
+    this.port = port;
+    this.useProxy = true;
+    this.useAuthentication = false;
+
+    edm = getEdmInternal();
+  }
+
+  public Client(String serviceUrl) throws IOException, ODataException, HttpException {
+    this.serviceUrl = serviceUrl;
+    this.useProxy = false;
+    this.useAuthentication = false;
+
+    edm = getEdmInternal();
+  }
+
+  public Client(String serviceUrl, Proxy.Type protocol, String proxy, int port, String username, String password) throws IOException, ODataException, HttpException {
+    this.serviceUrl = serviceUrl;
+    this.protocol = protocol;
+    this.proxy = proxy;
+    this.port = port;
+    this.useProxy = true;
+    this.username = username;
+    this.password = password;
+    this.useAuthentication = true;
+
+    edm = getEdmInternal();
+  }
+
+  public Client(String serviceUrl, String username, String password) throws IOException, ODataException, HttpException {
+    this.serviceUrl = serviceUrl;
+    this.useProxy = false;
+    this.username = username;
+    this.password = password;
+    this.useAuthentication = true;
+
+    edm = getEdmInternal();
+  }
+
+  private Edm getEdmInternal() throws IOException, ODataException, HttpException {
+    HttpURLConnection connection = connect(METADATA, APPLICATION_XML, "GET");
+    edm = EntityProvider.readMetadata((InputStream) connection.getContent(), false);
+    return edm;
+  }
+
+  private void checkStatus(HttpURLConnection connection) throws IOException, HttpException {
+    if (400 <= connection.getResponseCode() && connection.getResponseCode() <= 599) {
+      HttpStatusCodes httpStatusCode = HttpStatusCodes.fromStatusCode(connection.getResponseCode());
+      throw new HttpException(httpStatusCode, httpStatusCode.getStatusCode() + " " + httpStatusCode.toString());
+    }
+  }
+
+  public Edm getEdm() {
+    return edm;
+  }
+
+  public List<EdmEntitySetInfo> getEntitySets() throws ODataException {
+    return edm.getServiceMetadata().getEntitySetInfos();
+  }
+
+  public ODataFeed readFeed(String entityContainerName, String entitySetName, String contentType) throws IOException, ODataException, HttpException {
+    EdmEntityContainer entityContainer = edm.getEntityContainer(entityContainerName);
+    String relativeUri;
+    if (entityContainer.isDefaultEntityContainer()) {
+      relativeUri = entitySetName;
+    } else {
+      relativeUri = entityContainerName + "." + entitySetName;
+    }
+
+    InputStream content = (InputStream) connect(relativeUri, contentType, "GET").getContent();
+    return EntityProvider.readFeed(contentType, entityContainer.getEntitySet(entitySetName), content, EntityProviderReadProperties.init().build());
+  }
+
+  private HttpURLConnection connect(String relativeUri, String contentType, String httpMethod) throws IOException, HttpException {
+    URL url = new URL(serviceUrl + relativeUri);
+    HttpURLConnection connection;
+    if (useProxy) {
+      Proxy proxy = new Proxy(protocol, new InetSocketAddress(this.proxy, port));
+      connection = (HttpURLConnection) url.openConnection(proxy);
+    } else {
+      connection = (HttpURLConnection) url.openConnection();
+    }
+    connection.setRequestMethod(httpMethod);
+    connection.setRequestProperty("Accept", contentType);
+
+    if (useAuthentication) {
+      String authorization = "Basic ";
+      authorization += new String(Base64.encodeBase64((this.username + ":" + this.password).getBytes()));
+      connection.setRequestProperty("Authorization", authorization);
+    }
+
+    connection.connect();
+
+    checkStatus(connection);
+
+    return connection;
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/255fcc05/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/HttpException.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/HttpException.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/HttpException.java
new file mode 100644
index 0000000..cb35db1
--- /dev/null
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/util/HttpException.java
@@ -0,0 +1,19 @@
+package org.apache.olingo.odata2.fit.client.util;
+
+import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
+
+public class HttpException extends Exception {
+
+  private static final long serialVersionUID = 1L;
+
+  private HttpStatusCodes httpStatusCode;
+
+  public HttpException(HttpStatusCodes httpStatusCode, String message) {
+    super(message);
+    this.httpStatusCode = httpStatusCode;
+  }
+
+  public HttpStatusCodes getHttpStatusCode() {
+    return httpStatusCode;
+  }
+}
\ No newline at end of file


[29/35] git commit: [olingo-117] checkstyle issues

Posted by sk...@apache.org.
[olingo-117] checkstyle issues


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/38d06b2b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/38d06b2b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/38d06b2b

Branch: refs/heads/master
Commit: 38d06b2b6e7fa453f8f42858fba3a04b8c9e9ed8
Parents: 75e0e53
Author: Stephan Klevenz <sk...@apache.org>
Authored: Thu Jan 23 17:26:49 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Thu Jan 23 17:26:49 2014 +0100

----------------------------------------------------------------------
 .../odata2/annotation/processor/api/AnnotationServiceFactory.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/38d06b2b/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/AnnotationServiceFactory.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/AnnotationServiceFactory.java b/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/AnnotationServiceFactory.java
index dc9ff12..171101c 100644
--- a/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/AnnotationServiceFactory.java
+++ b/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/AnnotationServiceFactory.java
@@ -113,7 +113,8 @@ public abstract class AnnotationServiceFactory {
    * for model definition and data access.
    * @throws ODataException if an error during initialization occurs
    */
-  public static ODataService createAnnotationService(final Collection<Class<?>> annotatedClasses) throws ODataException {
+  public static ODataService createAnnotationService(final Collection<Class<?>> annotatedClasses)
+      throws ODataException {
     return getInstance().createAnnotationService(annotatedClasses);
   }
 }


[31/35] git commit: [OLINGO-117] refactor unit tests

Posted by sk...@apache.org.
[OLINGO-117] refactor unit tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/567103a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/567103a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/567103a5

Branch: refs/heads/master
Commit: 567103a5ecc17bf309b590bc772704fc5772239e
Parents: 674f0fa
Author: Stephan Klevenz <sk...@apache.org>
Authored: Fri Jan 24 09:21:59 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Fri Jan 24 09:21:59 2014 +0100

----------------------------------------------------------------------
 .../fit/client/ClientDeltaResponseTest.java     | 33 ++++++++++++--------
 1 file changed, 20 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/567103a5/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
index 909ce19..1b939be 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
@@ -57,6 +57,9 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
 
   private static final String DELTATOKEN_1234 = "!deltatoken=1234";
 
+  private static int roomDataCount = 2;
+  private static int deletedRoomDataCount = 2;
+
   private Client client;
   StubProcessor processor;
 
@@ -81,9 +84,6 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
 
   private class StubProcessor extends ODataSingleProcessor {
 
-    private int roomDataCount = 2;
-    private int deletedRoomDataCount = 2;
-
     @Override
     public ODataResponse readEntitySet(final GetEntitySetUriInfo uriInfo, final String contentType)
         throws ODataException {
@@ -172,47 +172,54 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
   }
 
   private void testDeltaFeedWithDeltaLink(final String contentType) throws Exception {
+    roomDataCount = 3;
+    deletedRoomDataCount = 4;
+
     ODataFeed feed = client.readFeed("Container1", "Rooms", contentType);
     String deltaLink = feed.getFeedMetadata().getDeltaLink();
 
     assertNotNull(feed);
-    assertEquals(2, feed.getEntries().size());
+    assertEquals(roomDataCount, feed.getEntries().size());
     assertEquals(getEndpoint().toASCIIString() + "Rooms?" + DELTATOKEN_1234, feed.getFeedMetadata().getDeltaLink());
 
     ODataDeltaFeed deltaFeed = client.readDeltaFeed("Container1", "Rooms", contentType, deltaLink);
 
     assertNotNull(deltaFeed);
-    assertEquals(2, deltaFeed.getEntries().size());
+    assertEquals(roomDataCount, deltaFeed.getEntries().size());
     assertEquals(deltaLink, deltaFeed.getFeedMetadata().getDeltaLink());
 
     List<DeletedEntryMetadata> deletedEntries = deltaFeed.getDeletedEntries();
     assertNotNull(deletedEntries);
-    assertEquals(2, deletedEntries.size());
+    assertEquals(deletedRoomDataCount, deletedEntries.size());
 
-    assertEquals("http://localhost:19000/abc/ClientDeltaResponseTest/Rooms('3')", deletedEntries.get(0).getUri());
-    assertEquals("http://localhost:19000/abc/ClientDeltaResponseTest/Rooms('4')", deletedEntries.get(1).getUri());
+    for (int i = 0; i < deletedRoomDataCount; i++)
+    {
+      assertEquals("http://localhost:19000/abc/ClientDeltaResponseTest/Rooms('" + (roomDataCount + i + 1) + "')",
+          deletedEntries.get(i).getUri());
+      assertNotNull(deletedEntries.get(i).getWhen());
+    }
   }
 
   private void testDeltaFeedWithZeroEntries(final String contentType) throws Exception {
-    processor.roomDataCount = 0;
-    processor.deletedRoomDataCount = 0;
+    roomDataCount = 0;
+    deletedRoomDataCount = 0;
 
     ODataFeed feed = client.readFeed("Container1", "Rooms", contentType);
     String deltaLink = feed.getFeedMetadata().getDeltaLink();
 
     assertNotNull(feed);
-    assertEquals(0, feed.getEntries().size());
+    assertEquals(roomDataCount, feed.getEntries().size());
     assertEquals(getEndpoint().toASCIIString() + "Rooms?" + DELTATOKEN_1234, feed.getFeedMetadata().getDeltaLink());
 
     ODataDeltaFeed deltaFeed = client.readDeltaFeed("Container1", "Rooms", contentType, deltaLink);
 
     assertNotNull(deltaFeed);
-    assertEquals(0, deltaFeed.getEntries().size());
+    assertEquals(roomDataCount, deltaFeed.getEntries().size());
     assertEquals(deltaLink, deltaFeed.getFeedMetadata().getDeltaLink());
 
     List<DeletedEntryMetadata> deletedEntries = deltaFeed.getDeletedEntries();
     assertNotNull(deletedEntries);
-    assertEquals(0, deletedEntries.size());
+    assertEquals(deletedRoomDataCount, deletedEntries.size());
   }
 
   @Test


[23/35] git commit: [OLINGO-117] TDD implementation

Posted by sk...@apache.org.
[OLINGO-117] TDD implementation


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/2de6df26
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/2de6df26
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/2de6df26

Branch: refs/heads/master
Commit: 2de6df2619e987c4a36f299c9e311b9d405c1f2a
Parents: d8159ab
Author: Stephan Klevenz <sk...@apache.org>
Authored: Tue Jan 21 12:25:48 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Tue Jan 21 13:37:06 2014 +0100

----------------------------------------------------------------------
 .../olingo/odata2/api/ep/feed/ODataFeed.java    |   4 +-
 .../core/ep/consumer/XmlFeedConsumer.java       |  11 +-
 .../olingo/odata2/core/ep/util/FormatXml.java   |   2 +
 .../core/ep/consumer/XmlFeedConsumerTest.java   |  28 ++++-
 .../resources/feed_with_deleted_entries.xml     |  40 ++++++
 .../fit/client/ClientDeltaResponseTest.java     | 122 ++++++++++++-------
 6 files changed, 157 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2de6df26/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java
index bd76e48..ee7ff88 100644
--- a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java
+++ b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataFeed.java
@@ -50,8 +50,8 @@ public interface ODataFeed {
 
   /**
    * Delta responses can contain changed feed data and deleted entries metadata. A delta response it the result of
-   * a delta link.
-   * @return metadata of deleted entries in case of feed is result of a delta response
+   * a delta link. If the feed is not a delta feed then the list of deleted entries is null.
+   * @return metadata of deleted entries in case of feed is result of a delta response or null 
    */
   public List<EntryMetadata> getDeletedEntries();
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2de6df26/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java
index 5cd1258..a20f2f2 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java
@@ -30,6 +30,7 @@ import javax.xml.stream.XMLStreamReader;
 import org.apache.olingo.odata2.api.edm.Edm;
 import org.apache.olingo.odata2.api.ep.EntityProviderException;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
+import org.apache.olingo.odata2.api.ep.entry.EntryMetadata;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.core.ep.aggregator.EntityInfoAggregator;
@@ -96,6 +97,14 @@ public class XmlFeedConsumer {
     FeedMetadataImpl metadata = new FeedMetadataImpl();
     XmlEntryConsumer xec = new XmlEntryConsumer();
     List<ODataEntry> results = new ArrayList<ODataEntry>();
+    List<EntryMetadata> deletedEntries = null;
+
+    boolean isDeltaFeed = false;
+    String tombstonePrefix = reader.getNamespaceContext().getPrefix(FormatXml.ATOM_TOMBSTONE_NAMESPACE);
+    if (tombstonePrefix != null) {
+      isDeltaFeed = true;
+      deletedEntries = new ArrayList<EntryMetadata>();
+    }
 
     while (reader.hasNext() && !isFeedEndTag(reader)) {
       if (FormatXml.ATOM_ENTRY.equals(reader.getLocalName())) {
@@ -136,7 +145,7 @@ public class XmlFeedConsumer {
       }
       readTillNextStartTag(reader);
     }
-    return new ODataFeedImpl(results, metadata);
+    return new ODataFeedImpl(results, metadata, isDeltaFeed, deletedEntries);
   }
 
   private void readTillNextStartTag(final XMLStreamReader reader) throws XMLStreamException {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2de6df26/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/FormatXml.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/FormatXml.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/FormatXml.java
index 153647b..8ad0181 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/FormatXml.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/util/FormatXml.java
@@ -91,4 +91,6 @@ public class FormatXml {
   public static final String ATOM_TOMBSTONE_REF = "ref";
   public static final String ATOM_TOMBSTONE_WHEN = "when";
   public static final String ATOM_TOMBSTONE_DELETED_ENTRY = "deleted-entry";
+  public static final String ATOM_TOMBSTONE_NAMESPACE = "http://purl.org/atompub/tombstones/1.0";
+  public static final String ATOM_TOMBSTONE_PREFIX = "at";
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2de6df26/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java
index 27132df..b2c6267 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java
@@ -19,7 +19,7 @@
 package org.apache.olingo.odata2.core.ep.consumer;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.*;
 
 import java.io.InputStream;
 
@@ -50,6 +50,8 @@ public class XmlFeedConsumerTest extends AbstractXmlConsumerTest {
             .getEntitySet(
                 "Employees"), file, DEFAULT_PROPERTIES);
     assertNotNull(feed);
+    assertFalse(feed.isDeltaFeed());
+    assertNull(feed.getDeletedEntries());
 
     FeedMetadata feedMetadata = feed.getFeedMetadata();
     assertNotNull(feedMetadata);
@@ -71,6 +73,8 @@ public class XmlFeedConsumerTest extends AbstractXmlConsumerTest {
 
     ODataFeed feed = xec.readFeed(entitySet, reqContent, consumerProperties);
     assertNotNull(feed);
+    assertFalse(feed.isDeltaFeed());
+    assertNull(feed.getDeletedEntries());
 
     FeedMetadata feedMetadata = feed.getFeedMetadata();
     assertNotNull(feedMetadata);
@@ -86,7 +90,6 @@ public class XmlFeedConsumerTest extends AbstractXmlConsumerTest {
   public void readEmployeesFeedWithInlineCountNegative() throws Exception {
     // prepare
     String content = readFile("feed_employees_full.xml").replace("<m:count>6</m:count>", "<m:count>-1</m:count>");
-    ;
     assertNotNull(content);
 
     EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
@@ -111,7 +114,6 @@ public class XmlFeedConsumerTest extends AbstractXmlConsumerTest {
   public void readEmployeesFeedWithInlineCountLetters() throws Exception {
     // prepare
     String content = readFile("feed_employees_full.xml").replace("<m:count>6</m:count>", "<m:count>AAA</m:count>");
-    ;
     assertNotNull(content);
 
     EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
@@ -131,4 +133,24 @@ public class XmlFeedConsumerTest extends AbstractXmlConsumerTest {
 
     Assert.fail("Exception expected");
   }
+
+  @Test
+  public void readDeltaFeed() throws Exception {
+    // prepare
+    String content = readFile("feed_with_deleted_entries.xml");
+    assertNotNull(content);
+
+    EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
+    InputStream reqContent = createContentAsStream(content);
+
+    XmlEntityConsumer xec = new XmlEntityConsumer();
+    EntityProviderReadProperties consumerProperties = EntityProviderReadProperties.init().build();
+
+    ODataFeed feed = xec.readFeed(entitySet, reqContent, consumerProperties);
+    
+    assertNotNull(feed);
+    assertTrue(feed.isDeltaFeed());
+    
+    assertNotNull(feed.getDeletedEntries());
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2de6df26/odata2-lib/odata-core/src/test/resources/feed_with_deleted_entries.xml
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/resources/feed_with_deleted_entries.xml b/odata2-lib/odata-core/src/test/resources/feed_with_deleted_entries.xml
new file mode 100644
index 0000000..78c187e
--- /dev/null
+++ b/odata2-lib/odata-core/src/test/resources/feed_with_deleted_entries.xml
@@ -0,0 +1,40 @@
+<?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. -->
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
+    xmlns:at="http://purl.org/atompub/tombstones/1.0" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
+    xml:base="https://olingoodata.neo.ondemand.com:443/com.sap.olingo.web/ReferenceScenario.svc/">
+    <id>https://olingoodata.neo.ondemand.com:443/com.sap.olingo.web/ReferenceScenario.svc/Rooms</id>
+    <title type="text">Rooms</title>
+    <updated>2014-01-21T09:15:52.473Z</updated>
+    <author>
+        <name />
+    </author>
+    <link href="Rooms" rel="self" title="Rooms" />
+    <entry m:etag="W/&quot;1&quot;">
+        <id>http://host:123/odata/Rooms('1')</id>
+        <title type="text">Room 1</title>
+        <updated>2014-01-21T09:15:52.474Z</updated>
+        <category term="RefScenario.Room" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
+        <link href="Rooms('1')" rel="edit" title="Room" />
+        <link href="Rooms('1')/nr_Employees" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Employees"
+            title="nr_Employees" type="application/atom+xml;type=feed" />
+        <link href="Rooms('1')/nr_Building" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Building"
+            title="nr_Building" type="application/atom+xml;type=entry" />
+        <content type="application/xml">
+            <m:properties>
+                <d:Id>1</d:Id>
+                <d:Name>Room 1</d:Name>
+                <d:Seats>1</d:Seats>
+                <d:Version>1</d:Version>
+            </m:properties>
+        </content>
+    </entry>
+    <at:deleted-entry ref="http://host:123/odata/Rooms('2')" when="2014-01-14T18:11:06.682+01:00" />
+    <link href="http://host:123/odata/Rooms?$skiptoken=97" rel="delta" />
+</feed>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/2de6df26/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
index f641577..43111fd 100644
--- a/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
+++ b/odata2-lib/odata-fit/src/test/java/org/apache/olingo/odata2/fit/client/ClientDeltaResponseTest.java
@@ -1,10 +1,12 @@
 package org.apache.olingo.odata2.fit.client;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -39,40 +41,7 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
   private static final String DELTATOKEN_1234 = "!deltatoken=1234";
 
   private Client client;
-
-  private ArrayList<Map<String, Object>> createRoomData() {
-
-    Map<String, Object> roomData1 = new HashMap<String, Object>();
-    roomData1.put("Id", "1");
-    roomData1.put("Seats", 123);
-    roomData1.put("Version", 1);
-    Map<String, Object> roomData2 = new HashMap<String, Object>();
-    roomData2.put("Id", "2");
-    roomData2.put("Seats", 66);
-    roomData2.put("Version", 2);
-
-    ArrayList<Map<String, Object>> roomsData = new ArrayList<Map<String, Object>>();
-    roomsData.add(roomData1);
-    roomsData.add(roomData2);
-
-    return roomsData;
-  }
-
-  private ArrayList<Map<String, Object>> createDeletedRoomData() {
-    Map<String, Object> roomData1 = new HashMap<String, Object>();
-    roomData1.put("Id", "3");
-    roomData1.put("Seats", 123);
-    roomData1.put("Version", 1);
-    Map<String, Object> roomData2 = new HashMap<String, Object>();
-    roomData2.put("Id", "4");
-    roomData2.put("Seats", 66);
-    roomData2.put("Version", 2);
-
-    ArrayList<Map<String, Object>> deletedRoomData = new ArrayList<Map<String, Object>>();
-    deletedRoomData.add(roomData1);
-    deletedRoomData.add(roomData2);
-    return deletedRoomData;
-  }
+  StubProcessor processor;
 
   @Before
   @Override
@@ -83,12 +52,21 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
+  }
 
-    createRoomData();
+  @Override
+  protected ODataService createService() throws ODataException {
+    EdmProvider provider = new ScenarioEdmProvider();
+    processor = new StubProcessor();
+
+    return new ODataSingleProcessorService(provider, processor);
   }
 
   private class StubProcessor extends ODataSingleProcessor {
 
+    private int roomDataCount = 2;
+    private int deletedRoomDataCount = 2;
+
     @Override
     public ODataResponse readEntitySet(GetEntitySetUriInfo uriInfo, String contentType) throws ODataException {
       try {
@@ -125,14 +103,35 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
 
       }
     }
-  }
 
-  @Override
-  protected ODataService createService() throws ODataException {
-    EdmProvider provider = new ScenarioEdmProvider();
-    ODataSingleProcessor processor = new StubProcessor();
+    private ArrayList<Map<String, Object>> createRoomData() {
+      ArrayList<Map<String, Object>> roomsData = new ArrayList<Map<String, Object>>();
 
-    return new ODataSingleProcessorService(provider, processor);
+      for (int i = 1; i <= roomDataCount; i++) {
+        Map<String, Object> roomData = new HashMap<String, Object>();
+        roomData.put("Id", String.valueOf(i));
+        roomData.put("Seats", i);
+        roomData.put("Version", i);
+        roomsData.add(roomData);
+      }
+
+      return roomsData;
+    }
+
+    private ArrayList<Map<String, Object>> createDeletedRoomData() {
+      ArrayList<Map<String, Object>> deletedRoomData = new ArrayList<Map<String, Object>>();
+
+      for (int i = roomDataCount + 1; i < roomDataCount + 1 + deletedRoomDataCount; i++) {
+        Map<String, Object> roomData = new HashMap<String, Object>();
+        roomData.put("Id", String.valueOf(i));
+        roomData.put("Seats", i);
+        roomData.put("Version", i);
+
+        deletedRoomData.add(roomData);
+      }
+
+      return deletedRoomData;
+    }
   }
 
   @Test
@@ -183,15 +182,50 @@ public class ClientDeltaResponseTest extends AbstractFitTest {
     assertEquals("uri4", deletedEntries.get(1).getUri());
   }
 
+  private void testDeltaFeedWithZeroEntries(String contentType) throws Exception {
+    processor.roomDataCount = 0;
+    processor.deletedRoomDataCount = 0;
+
+    ODataFeed feed = client.readFeed("Container1", "Rooms", contentType);
+    String deltaLink = feed.getFeedMetadata().getDeltaLink();
+
+    assertNotNull(feed);
+    assertEquals(0, feed.getEntries().size());
+    assertEquals(getEndpoint().toASCIIString() + "Rooms?" + DELTATOKEN_1234, feed.getFeedMetadata().getDeltaLink());
+    assertFalse(feed.isDeltaFeed());
+
+    URI uri = new URI(deltaLink);
+    String query = uri.getQuery();
+    ODataFeed deltaFeed = client.readFeed("Container1", "Rooms", contentType, query);
+
+    assertNotNull(deltaFeed);
+    assertEquals(0, deltaFeed.getEntries().size());
+    assertEquals(uri.toASCIIString(), deltaFeed.getFeedMetadata().getDeltaLink());
+
+    assertTrue(deltaFeed.isDeltaFeed());
+    List<EntryMetadata> deletedEntries = deltaFeed.getDeletedEntries();
+    assertNotNull(deletedEntries);
+    assertEquals(0, deletedEntries.size());
+  }
+
   @Test
   public void testDeltaFeedWithDeltaLinkXml() throws Exception {
     testDeltaFeedWithDeltaLink("application/atom+xml");
   }
 
   @Test
-  @Ignore("not implemented")
   public void testFeedWithDeltaLinkJson() throws Exception {
     testDeltaFeedWithDeltaLink("application/json");
   }
 
+  @Test
+  public void testDeltaFeedWithZeroEntriesXml() throws Exception {
+    testDeltaFeedWithZeroEntries("application/atom+xml");
+  }
+
+  @Test
+  public void testFeedWithZeroEntriesJson() throws Exception {
+    testDeltaFeedWithZeroEntries("application/json");
+  }
+
 }
\ No newline at end of file


[17/35] git commit: [OLINGO-117] more junit tests

Posted by sk...@apache.org.
[OLINGO-117] more junit tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/61547345
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/61547345
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/61547345

Branch: refs/heads/master
Commit: 61547345e9f7190dec0e078813939ccddfad88ce
Parents: c3930ed
Author: Stephan Klevenz <sk...@apache.org>
Authored: Thu Jan 16 15:56:48 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Thu Jan 16 15:57:39 2014 +0100

----------------------------------------------------------------------
 .../odata2/core/commons/XmlHelperTest.java      | 76 +++++++++++++++++---
 1 file changed, 67 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/61547345/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/commons/XmlHelperTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/commons/XmlHelperTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/commons/XmlHelperTest.java
index 0d2c7b2..55c9df0 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/commons/XmlHelperTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/commons/XmlHelperTest.java
@@ -18,8 +18,10 @@
  ******************************************************************************/
 package org.apache.olingo.odata2.core.commons;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
@@ -33,8 +35,11 @@ import org.apache.olingo.odata2.api.ep.EntityProvider;
 import org.apache.olingo.odata2.api.ep.EntityProviderException;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
 import org.apache.olingo.odata2.testutil.mock.MockFacade;
+import org.junit.Ignore;
 import org.junit.Test;
 
+import com.ctc.wstx.exc.WstxParsingException;
+
 public class XmlHelperTest {
 
   public static String XML =
@@ -69,6 +74,18 @@ public class XmlHelperTest {
           "    ]>" +
           "    <lolz>&lol9;</lolz>";
 
+  public static String XML_DOCTYPE =
+      "<?xml version=\"1.0\" standalone=\"yes\"?>" +
+          "<!DOCTYPE hallo [<!ELEMENT hallo (#PCDATA)>]>" +
+          "<hallo>Hallo Welt!</hallo>";
+
+  public static String XML_PROCESSING =
+      "<?xml version=\"1.0\"?>" +
+          "<?apache include file=\"somefile.html\" ?>" +
+          "<extract>" +
+          "  <data>&rules;</data>" +
+          "</extract>";
+
   @Test
   public void createReader() throws Exception {
     InputStream content = new ByteArrayInputStream(XML.getBytes("UTF-8"));
@@ -127,20 +144,61 @@ public class XmlHelperTest {
     }
   }
 
-  @Test(expected = EntityProviderException.class)
+  @Test
   public void lolApiWithProtection() throws Exception {
-    InputStream content = new ByteArrayInputStream(XML_LOL.getBytes("UTF-8"));
-    EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
-
-    EntityProvider.readEntry("application/xml", entitySet, content, EntityProviderReadProperties.init().build());
+    try {
+      InputStream content = new ByteArrayInputStream(XML_LOL.getBytes("UTF-8"));
+      EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
+      EntityProvider.readEntry("application/xml", entitySet, content, EntityProviderReadProperties.init().build());
+
+      fail();
+    } catch (EntityProviderException e) {
+      assertEquals(WstxParsingException.class, e.getCause().getClass());
+    }
   }
 
-  @Test(expected = EntityProviderException.class)
+  @Test
   public void xxeApiWithProtection() throws Exception {
-    InputStream content = new ByteArrayInputStream(XML_XXE.getBytes("UTF-8"));
-    EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
+    try {
+      InputStream content = new ByteArrayInputStream(XML_XXE.getBytes("UTF-8"));
+      EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
 
-    EntityProvider.readEntry("application/xml", entitySet, content, EntityProviderReadProperties.init().build());
+      EntityProvider.readEntry("application/xml", entitySet, content, EntityProviderReadProperties.init().build());
+
+      fail();
+    } catch (EntityProviderException e) {
+      assertEquals(WstxParsingException.class, e.getCause().getClass());
+    }
+  }
+
+  @Test
+  public void xmlDoctypeApiWithProtection() throws Exception {
+    try {
+      InputStream content = new ByteArrayInputStream(XML_DOCTYPE.getBytes("UTF-8"));
+      EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
+
+      EntityProvider.readEntry("application/xml", entitySet, content, EntityProviderReadProperties.init().build());
+
+      fail();
+    } catch (EntityProviderException e) {
+      assertEquals(WstxParsingException.class, e.getCause().getClass());
+    }
   }
 
+
+  @Test
+  @Ignore("not way to disable in parser")
+  public void xmlProcessingApiWithProtection() throws Exception {
+    try {
+      InputStream content = new ByteArrayInputStream(XML_PROCESSING.getBytes("UTF-8"));
+      EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees");
+
+      EntityProvider.readEntry("application/xml", entitySet, content, EntityProviderReadProperties.init().build());
+
+      fail();
+    } catch (EntityProviderException e) {
+      e.printStackTrace();
+      assertEquals(WstxParsingException.class, e.getCause().getClass());
+    }
+  }
 }


[10/35] git commit: Added missing licence header

Posted by sk...@apache.org.
Added missing licence header


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/faf0709c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/faf0709c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/faf0709c

Branch: refs/heads/master
Commit: faf0709ca778ffe3a9ea4c0713e802e7946f07b9
Parents: 352f541
Author: Michael Bolz <mi...@apache.org>
Authored: Mon Jan 13 07:50:43 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Tue Jan 14 12:24:43 2014 +0100

----------------------------------------------------------------------
 .../jpa/processor/core/ODataEntityParserTest.java | 18 ++++++++++++++++++
 .../processor/core/access/data/JPALinkTest.java   | 18 ++++++++++++++++++
 2 files changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/faf0709c/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java
index 93587a8..adf7b80 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParserTest.java
@@ -1,3 +1,21 @@
+/*******************************************************************************
+ * 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.odata2.jpa.processor.core;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/faf0709c/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java
index db0f6fb..7a0b754 100644
--- a/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java
+++ b/odata2-jpa-processor/jpa-core/src/test/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPALinkTest.java
@@ -1,3 +1,21 @@
+/*******************************************************************************
+ * 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.odata2.jpa.processor.core.access.data;
 
 public class JPALinkTest {


[15/35] git commit: [OLINGO-117] deleted entries support]

Posted by sk...@apache.org.
[OLINGO-117] deleted entries support]


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/0848b544
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/0848b544
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/0848b544

Branch: refs/heads/master
Commit: 0848b5448db49d097fb91f6339f81cfe6bc298db
Parents: 171352a
Author: Stephan Klevenz <sk...@apache.org>
Authored: Tue Jan 14 09:50:51 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Tue Jan 14 12:26:56 2014 +0100

----------------------------------------------------------------------
 .../JsonDeletedEntryEntityProducer.java         | 26 ++++++++-
 .../JsonFeedWithDeltaLinkProducerTest.java      | 57 ++++++++++++++++----
 2 files changed, 72 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/0848b544/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
index 88f54f2..14baf52 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
@@ -1,3 +1,21 @@
+/*******************************************************************************
+ * 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.odata2.core.ep.producer;
 
 import java.io.IOException;
@@ -25,6 +43,7 @@ public class JsonDeletedEntryEntityProducer {
     try {
       if (deletedEntries.size() > 0) {
         jsonStreamWriter.separator();
+        int counter = 0;
         for (Map<String, Object> deletedEntry : deletedEntries) {
           jsonStreamWriter.beginObject();
 
@@ -35,8 +54,13 @@ public class JsonDeletedEntryEntityProducer {
           jsonStreamWriter.namedStringValue(FormatJson.ODATA_CONTEXT, odataContextValue);
           jsonStreamWriter.separator();
           jsonStreamWriter.namedStringValue(FormatJson.ID, idValue);
-
           jsonStreamWriter.endObject();
+
+          if (counter < deletedEntries.size()) {
+            jsonStreamWriter.separator();
+          }
+
+          counter++;
         }
       }
     } catch (final IOException e) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/0848b544/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
index 03d7e0c..a3c5fc0 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
@@ -1,15 +1,33 @@
+/*******************************************************************************
+ * 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.odata2.core.ep.producer;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.lang.reflect.Type;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 import org.apache.olingo.odata2.api.ODataCallback;
@@ -26,8 +44,6 @@ import org.junit.Before;
 import org.junit.Test;
 
 import com.google.gson.Gson;
-import com.google.gson.internal.StringMap;
-import com.google.gson.reflect.TypeToken;
 
 public class JsonFeedWithDeltaLinkProducerTest extends BaseTest {
 
@@ -38,6 +54,8 @@ public class JsonFeedWithDeltaLinkProducerTest extends BaseTest {
   private ArrayList<Map<String, Object>> deletedRoomData;
   protected ArrayList<Map<String, Object>> roomsData;
 
+  private Gson gson = new Gson();
+
   private void initializeRoomData() {
     Map<String, Object> roomData1 = new HashMap<String, Object>();
     roomData1.put("Id", "1");
@@ -55,7 +73,7 @@ public class JsonFeedWithDeltaLinkProducerTest extends BaseTest {
 
   private void initializeDeletedRoomData() {
     deletedRoomData = new ArrayList<Map<String, Object>>();
-    for (int i = 2; i <= roomsData.size(); i = i + 2) {
+    for (int i = roomsData.size() + 1; i <= roomsData.size() + 1 + 2; i++) {
       HashMap<String, Object> tmp = new HashMap<String, Object>();
       tmp.put("Id", "" + i);
       tmp.put("Name", "Neu Schwanstein" + i);
@@ -93,9 +111,7 @@ public class JsonFeedWithDeltaLinkProducerTest extends BaseTest {
 
     final String json = writeRoomData(entitySet, tombstoneCallback);
 
-    assertTrue("Somthing wring with @odata.context!", json
-        .contains("{\"@odata.context\":\"$metadata#Rooms/$deletedEntity\",\""));
-    System.out.println(json);
+    assertDeletedEntries(json);
   }
 
   @Test
@@ -109,8 +125,21 @@ public class JsonFeedWithDeltaLinkProducerTest extends BaseTest {
 
     assertTrue("Delta Link missing or wrong!", json
         .contains("__delta\":\"http://host:80/service/Rooms?!deltatoken=1234"));
-    assertTrue("Somthing wring with @odata.context!", json
+    assertDeletedEntries(json);
+  }
+
+  private void assertDeletedEntries(final String json) {
+    assertTrue("Somthing wrong with @odata.context!", json
         .contains("{\"@odata.context\":\"$metadata#Rooms/$deletedEntity\",\""));
+    assertTrue(
+        "Somthing wrong with deleted entry!",
+        json.contains("{\"@odata.context\":\"$metadata#Rooms/$deletedEntity\",\"id\":\"http://host:80/service/Rooms('3')\"}"));
+    assertTrue(
+        "Somthing wrong with deleted entry!",
+        json.contains("{\"@odata.context\":\"$metadata#Rooms/$deletedEntity\",\"id\":\"http://host:80/service/Rooms('4')\"}"));
+    assertTrue(
+        "Somthing wrong with deleted entry!",
+        json.contains("{\"@odata.context\":\"$metadata#Rooms/$deletedEntity\",\"id\":\"http://host:80/service/Rooms('5')\"}"));
   }
 
   private String writeRoomData(final EdmEntitySet entitySet, TombstoneCallback tombstoneCallback)
@@ -129,7 +158,15 @@ public class JsonFeedWithDeltaLinkProducerTest extends BaseTest {
 
     final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
     assertNotNull(json);
+
+    validate(json);
+
     return json;
   }
 
+  private void validate(String json) {
+    Object obj = gson.fromJson(json, Object.class);
+    assertNotNull(obj);
+  }
+
 }


[18/35] git commit: [OLINGO-117] fix checkstyle issues

Posted by sk...@apache.org.
[OLINGO-117] fix checkstyle issues


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/677bea9c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/677bea9c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/677bea9c

Branch: refs/heads/master
Commit: 677bea9c4d4bbd6941dc8906d72453ec8a4f3700
Parents: 6154734
Author: Stephan Klevenz <sk...@apache.org>
Authored: Thu Jan 16 16:01:53 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Thu Jan 16 16:01:53 2014 +0100

----------------------------------------------------------------------
 .../core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/677bea9c/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
index 3095b7a..d1ff8ee 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
@@ -147,13 +147,16 @@ public class JsonFeedWithDeltaLinkProducerTest extends BaseTest {
         .contains("{\"@odata.context\":\"$metadata#Rooms/$deletedEntity\",\""));
     assertTrue(
         "Somthing wrong with deleted entry!",
-        json.contains("{\"@odata.context\":\"$metadata#Rooms/$deletedEntity\",\"id\":\"http://host:80/service/Rooms('3')\"}"));
+        json.contains("{\"@odata.context\":\"$metadata#Rooms/$deletedEntity\",\"id\":\"http://"
+            + "host:80/service/Rooms('3')\"}"));
     assertTrue(
         "Somthing wrong with deleted entry!",
-        json.contains("{\"@odata.context\":\"$metadata#Rooms/$deletedEntity\",\"id\":\"http://host:80/service/Rooms('4')\"}"));
+        json.contains("{\"@odata.context\":\"$metadata#Rooms/$deletedEntity\",\"id\":\"http://"
+            + "host:80/service/Rooms('4')\"}"));
     assertTrue(
         "Somthing wrong with deleted entry!",
-        json.contains("{\"@odata.context\":\"$metadata#Rooms/$deletedEntity\",\"id\":\"http://host:80/service/Rooms('5')\"}"));
+        json.contains("{\"@odata.context\":\"$metadata#Rooms/$deletedEntity\",\"id\":\"http://"
+            + "host:80/service/Rooms('5')\"}"));
   }
 
   private String writeRoomData(final EdmEntitySet entitySet, TombstoneCallback tombstoneCallback)


[09/35] git commit: [OLINGO-115] Junit test verified that it works

Posted by sk...@apache.org.
[OLINGO-115] Junit test verified that it works


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/ae15d1d0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/ae15d1d0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/ae15d1d0

Branch: refs/heads/master
Commit: ae15d1d05450a10892cdd349d042008c35e88b79
Parents: faf0709
Author: Christian Amend <ch...@apache.org>
Authored: Mon Jan 13 10:44:10 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Tue Jan 14 12:24:43 2014 +0100

----------------------------------------------------------------------
 .../jpa/processor/core/ODataEntityParser.java   |  3 +-
 .../ep/ProducerConsumerIntegrationTest.java     | 83 ++++++++++++++++++++
 2 files changed, 85 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ae15d1d0/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java
index dccfc6c..0da3bcd 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataEntityParser.java
@@ -135,7 +135,8 @@ public final class ODataEntityParser {
     return uriInfo;
   }
 
-  public UriInfo parseBindingLink(final String link, final Map<String, String> options) throws ODataJPARuntimeException {
+  public UriInfo parseBindingLink(final String link, final Map<String, String> options) 
+      throws ODataJPARuntimeException {
     final PathSegment pathSegment = getPathSegment(link);
     UriInfo uriInfo = null;
     try {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ae15d1d0/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProducerConsumerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProducerConsumerIntegrationTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProducerConsumerIntegrationTest.java
new file mode 100644
index 0000000..e7aec79
--- /dev/null
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/ProducerConsumerIntegrationTest.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * 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.odata2.core.ep;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.ep.EntityProvider;
+import org.apache.olingo.odata2.api.ep.EntityProviderException;
+import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
+import org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties;
+import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
+import org.apache.olingo.odata2.api.processor.ODataResponse;
+import org.apache.olingo.odata2.testutil.mock.MockFacade;
+import org.junit.Test;
+
+public class ProducerConsumerIntegrationTest {
+  protected static final URI BASE_URI;
+
+  static {
+    try {
+      BASE_URI = new URI("http://host:80/service/");
+    } catch (URISyntaxException e) {
+      throw new RuntimeException(e);
+    }
+  }
+  private static final EntityProviderReadProperties DEFAULT_READ_PROPERTIES = EntityProviderReadProperties.init()
+      .build();
+  private static final EntityProviderWriteProperties DEFAULT_WRITE_PROPERTIES = EntityProviderWriteProperties
+      .serviceRoot(
+          BASE_URI).build();
+  private static final String XML = "application/xml";
+  private static final String JSON = "application/json";
+
+  @Test
+  public void produceRoomAndThenConsumeIt() throws Exception {
+    EdmEntitySet roomSet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
+    Map<String, Object> localRoomData = new HashMap<String, Object>();
+    localRoomData.put("Id", "1");
+    localRoomData.put("Name", "Neu \n Schwanstein蝴蝶");
+
+    Map<String, Object> properties = execute(localRoomData, roomSet, XML);
+    assertEquals("1", properties.get("Id"));
+    assertEquals("Neu \n Schwanstein蝴蝶", properties.get("Name"));
+
+    Map<String, Object> properties2 = execute(localRoomData, roomSet, JSON);
+    assertEquals("1", properties2.get("Id"));
+    assertEquals("Neu \n Schwanstein蝴蝶", properties2.get("Name"));
+  }
+
+  private Map<String, Object> execute(Map<String, Object> localRoomData, EdmEntitySet roomSet, String contentType)
+      throws EntityProviderException {
+    ODataResponse response = EntityProvider.writeEntry(contentType, roomSet, localRoomData, DEFAULT_WRITE_PROPERTIES);
+    InputStream content = (InputStream) response.getEntity();
+
+    ODataEntry entry = EntityProvider.readEntry(contentType, roomSet, content, DEFAULT_READ_PROPERTIES);
+    Map<String, Object> properties = entry.getProperties();
+    return properties;
+  }
+
+}


[28/35] git commit: [olingo-117] cleanup, rat and checkstyle issues

Posted by sk...@apache.org.
[olingo-117] cleanup, rat and checkstyle issues


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/75e0e533
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/75e0e533
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/75e0e533

Branch: refs/heads/master
Commit: 75e0e533a50830d6d36ce1dba71d476c147a2b42
Parents: cdad25d
Author: Stephan Klevenz <sk...@apache.org>
Authored: Thu Jan 23 17:18:53 2014 +0100
Committer: Stephan Klevenz <sk...@apache.org>
Committed: Thu Jan 23 17:21:32 2014 +0100

----------------------------------------------------------------------
 .../processor/api/AnnotationServiceFactory.java |  35 +--
 .../core/AnnotationServiceFactoryImpl.java      |   4 +-
 .../processor/core/ListsProcessor.java          |   8 +-
 .../core/datasource/AnnotationInMemoryDs.java   |   4 +-
 .../core/datasource/AnnotationValueAccess.java  |   2 +-
 .../processor/core/datasource/DataStore.java    |  20 +-
 .../processor/core/util/AnnotationHelper.java   |  10 +-
 .../processor/core/util/ClassHelper.java        |   7 +-
 .../core/AnnotationServiceFactoryImplTest.java  |  12 +-
 .../processor/core/ListsProcessorTest.java      |   8 +-
 .../datasource/AnnotationValueAccessTest.java   |  78 ++++---
 .../datasource/AnnotationsInMemoryDsTest.java   |  58 +++--
 .../processor/core/model/Building.java          |   2 +-
 .../annotation/processor/core/model/Room.java   |   2 +-
 .../core/util/AnnotationHelperTest.java         |  32 +--
 .../processor/core/util/ClassHelperTest.java    |  19 +-
 .../ref/AnnotationRefServiceFactory.java        |   6 +-
 .../processor/ref/ServiceJsonTest.java          |   4 +-
 .../processor/ref/ServiceXmlTest.java           |   2 +-
 .../processor/core/access/data/JPAEntity.java   |   2 +-
 .../core/access/data/JPAEntityParser.java       |   2 +-
 .../jpa/processor/ref/model/SalesOrderItem.java | 219 +++++++++----------
 .../olingo/odata2/api/ep/EntityProvider.java    |   5 +-
 .../api/ep/entry/DeletedEntryMetadata.java      |   2 +-
 .../odata2/api/ep/feed/ODataDeltaFeed.java      |   4 +-
 .../odata2/core/ep/AtomEntityProvider.java      |   4 +-
 .../odata2/core/ep/JsonEntityProvider.java      |   4 +-
 .../odata2/core/ep/ProviderFacadeImpl.java      |   7 +-
 .../core/ep/consumer/XmlFeedConsumer.java       |   3 +-
 .../core/ep/entry/DeletedEntryMetadataImpl.java |  24 +-
 .../odata2/core/ep/feed/ODataDeltaFeedImpl.java |   2 +-
 .../JsonDeletedEntryEntityProducer.java         |   5 +-
 .../ep/producer/JsonFeedEntityProducer.java     |   5 +-
 .../odata2/core/commons/XmlHelperTest.java      |   5 +-
 .../core/ep/consumer/XmlFeedConsumerTest.java   |   6 +-
 .../JsonFeedWithDeltaLinkProducerTest.java      |   6 +-
 .../fit/client/ClientDeltaResponseTest.java     |  25 ++-
 .../olingo/odata2/fit/client/util/Client.java   |  63 ++++--
 .../odata2/fit/client/util/HttpException.java   |  20 +-
 .../odata2/ref/processor/ListsProcessor.java    |  14 +-
 .../ref/processor/ScenarioDataSource.java       |   2 +-
 .../ref/processor/ListsProcessorTest.java       |   6 +-
 42 files changed, 407 insertions(+), 341 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/AnnotationServiceFactory.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/AnnotationServiceFactory.java b/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/AnnotationServiceFactory.java
index 38fe73a..dc9ff12 100644
--- a/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/AnnotationServiceFactory.java
+++ b/odata2-annotation-processor/annotation-processor-api/src/main/java/org/apache/olingo/odata2/annotation/processor/api/AnnotationServiceFactory.java
@@ -30,7 +30,7 @@ import org.apache.olingo.odata2.api.exception.ODataException;
  */
 public abstract class AnnotationServiceFactory {
 
-  private static final String IMPLEMENTATION = 
+  private static final String IMPLEMENTATION =
       "org.apache.olingo.odata2.annotation.processor.core.AnnotationServiceFactoryImpl";
 
   /**
@@ -59,60 +59,61 @@ public abstract class AnnotationServiceFactory {
 
   /**
    * Interface to be implemented for an instance of a {@link AnnotationServiceFactoryInstance} which
-   * provides an {@link ODataService} based on annotation from 
+   * provides an {@link ODataService} based on annotation from
    * <code>org.apache.olingo.olingo-odata2-api-annotation</code> module
    * (see package <code>org.apache.olingo.odata2.api.annotation.edm</code>).
    */
   public interface AnnotationServiceFactoryInstance {
     /**
-     * Create an {@link ODataService} which is based on an EDM and Processor which are using the annotations from 
+     * Create an {@link ODataService} which is based on an EDM and Processor which are using the annotations from
      * <code>org.apache.olingo.olingo-odata2-api-annotation</code> module
      * (see package <code>org.apache.olingo.odata2.api.annotation.edm</code>) to define the model and access the data.
      * 
      * @param modelPackage package name which is scanned for annotated classes
-     * @return service an {@link ODataService} based on on an EDM and Processor which are using annotations 
-     *            for model definition and data access.
+     * @return service an {@link ODataService} based on on an EDM and Processor which are using annotations
+     * for model definition and data access.
      * @throws ODataException if an error during initialization occurs
      */
     public ODataService createAnnotationService(String modelPackage) throws ODataException;
+
     /**
-     * Create an {@link ODataService} which is based on an EDM and Processor which are using the annotations from 
+     * Create an {@link ODataService} which is based on an EDM and Processor which are using the annotations from
      * <code>org.apache.olingo.olingo-odata2-api-annotation</code> module
      * (see package <code>org.apache.olingo.odata2.api.annotation.edm</code>) to define the model and access the data.
      * 
      * @param modelPackage classes (which are annotated) which will be used for EDM definition and data access.
-     * @return service an {@link ODataService} based on on an EDM and Processor which are using annotations 
-     *            for model definition and data access.
+     * @return service an {@link ODataService} based on on an EDM and Processor which are using annotations
+     * for model definition and data access.
      * @throws ODataException if an error during initialization occurs
      */
     public ODataService createAnnotationService(Collection<Class<?>> annotatedClasses) throws ODataException;
   }
 
   /**
-   * Create an {@link ODataService} which is based on an EDM and Processor which are using the annotations from 
+   * Create an {@link ODataService} which is based on an EDM and Processor which are using the annotations from
    * <code>org.apache.olingo.olingo-odata2-api-annotation</code> module
    * (see package <code>org.apache.olingo.odata2.api.annotation.edm</code>) to define the model and access the data.
    * 
    * @param modelPackage package name which is scanned for annotated classes
-   * @return service an {@link ODataService} based on on an EDM and Processor which are using annotations 
-   *            for model definition and data access.
+   * @return service an {@link ODataService} based on on an EDM and Processor which are using annotations
+   * for model definition and data access.
    * @throws ODataException if an error during initialization occurs
    */
-  public static ODataService createAnnotationService(String modelPackage) throws ODataException {
+  public static ODataService createAnnotationService(final String modelPackage) throws ODataException {
     return getInstance().createAnnotationService(modelPackage);
   }
-  
+
   /**
-   * Create an {@link ODataService} which is based on an EDM and Processor which are using the annotations from 
+   * Create an {@link ODataService} which is based on an EDM and Processor which are using the annotations from
    * <code>org.apache.olingo.olingo-odata2-api-annotation</code> module
    * (see package <code>org.apache.olingo.odata2.api.annotation.edm</code>) to define the model and access the data.
    * 
    * @param modelPackage classes (which are annotated) which will be used for EDM definition and data access.
-   * @return service an {@link ODataService} based on on an EDM and Processor which are using annotations 
-   *            for model definition and data access.
+   * @return service an {@link ODataService} based on on an EDM and Processor which are using annotations
+   * for model definition and data access.
    * @throws ODataException if an error during initialization occurs
    */
-  public static ODataService createAnnotationService(Collection<Class<?>> annotatedClasses) throws ODataException {
+  public static ODataService createAnnotationService(final Collection<Class<?>> annotatedClasses) throws ODataException {
     return getInstance().createAnnotationService(annotatedClasses);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/AnnotationServiceFactoryImpl.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/AnnotationServiceFactoryImpl.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/AnnotationServiceFactoryImpl.java
index 7947d6b..d8e0c7e 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/AnnotationServiceFactoryImpl.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/AnnotationServiceFactoryImpl.java
@@ -37,7 +37,7 @@ public class AnnotationServiceFactoryImpl implements AnnotationServiceFactoryIns
    * {@inheritDoc}
    */
   @Override
-  public ODataService createAnnotationService(String modelPackage) throws ODataException {
+  public ODataService createAnnotationService(final String modelPackage) throws ODataException {
     AnnotationEdmProvider edmProvider = new AnnotationEdmProvider(modelPackage);
     AnnotationInMemoryDs dataSource = new AnnotationInMemoryDs(modelPackage);
     AnnotationValueAccess valueAccess = new AnnotationValueAccess();
@@ -51,7 +51,7 @@ public class AnnotationServiceFactoryImpl implements AnnotationServiceFactoryIns
    * {@inheritDoc}
    */
   @Override
-  public ODataService createAnnotationService(Collection<Class<?>> annotatedClasses) throws ODataException {
+  public ODataService createAnnotationService(final Collection<Class<?>> annotatedClasses) throws ODataException {
     AnnotationEdmProvider edmProvider = new AnnotationEdmProvider(annotatedClasses);
     AnnotationInMemoryDs dataSource = new AnnotationInMemoryDs(annotatedClasses);
     AnnotationValueAccess valueAccess = new AnnotationValueAccess();

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/ListsProcessor.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/ListsProcessor.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/ListsProcessor.java
index 7e637f9..e65fd2b 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/ListsProcessor.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/ListsProcessor.java
@@ -205,11 +205,11 @@ public class ListsProcessor extends DataSourceProcessor {
     return ODataResponse.fromResponse(response).build();
   }
 
-  String percentEncodeNextLink(String link) {
-    if(link == null) {
+  String percentEncodeNextLink(final String link) {
+    if (link == null) {
       return null;
     }
-       
+
     return link.replaceAll("\\$skiptoken=.+?(?:&|$)", "")
         .replaceAll("\\$skip=.+?(?:&|$)", "")
         .replaceFirst("(?:\\?|&)$", ""); // Remove potentially trailing "?" or "&" left over from remove actions
@@ -906,7 +906,7 @@ public class ListsProcessor extends DataSourceProcessor {
           keys.isEmpty() ?
               dataSource.readData(startEntitySet) : dataSource.readData(startEntitySet, keys) :
           dataSource.readData(functionImport, functionImportParameters, keys);
-  
+
       EdmEntitySet currentEntitySet =
           functionImport == null ? startEntitySet : functionImport.getEntitySet();
       for (NavigationSegment navigationSegment : navigationSegments) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java
index db5b79b..90794cc 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationInMemoryDs.java
@@ -50,7 +50,7 @@ public class AnnotationInMemoryDs implements DataSource {
     this(annotatedClasses, true);
   }
 
-  public AnnotationInMemoryDs(final Collection<Class<?>> annotatedClasses, final boolean persistInMemory) 
+  public AnnotationInMemoryDs(final Collection<Class<?>> annotatedClasses, final boolean persistInMemory)
       throws ODataException {
     this.persistInMemory = persistInMemory;
     init(annotatedClasses);
@@ -181,7 +181,7 @@ public class AnnotationInMemoryDs implements DataSource {
   }
 
   /**
-   * Extract the <code>result data</code> from the <code>resultData</code> list based on 
+   * Extract the <code>result data</code> from the <code>resultData</code> list based on
    * <code>navigation information</code> and <code>targetKeys</code>.
    * 
    * @param targetStore

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationValueAccess.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationValueAccess.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationValueAccess.java
index cc36d2a..9989e8f 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationValueAccess.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationValueAccess.java
@@ -71,7 +71,7 @@ public class AnnotationValueAccess implements ValueAccess {
    */
   @Override
   public <T> Class<?> getPropertyType(final T data, final EdmProperty property) throws ODataException {
-    if(data == null) {
+    if (data == null) {
       return null;
     } else if (annotationHelper.isEdmAnnotated(data)) {
       Class<?> fieldType = annotationHelper.getFieldTypeForProperty(data, property.getName());

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/DataStore.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/DataStore.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/DataStore.java
index 57b3d8c..7be4abe 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/DataStore.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/datasource/DataStore.java
@@ -138,7 +138,7 @@ public class DataStore<T> {
       return dataStore.remove(keyElement);
     }
   }
-  
+
   /**
    * Are the key values equal for both instances.
    * If all compared key values are <code>null</code> this also means equal.
@@ -150,36 +150,34 @@ public class DataStore<T> {
   public boolean isKeyEqual(final T first, final T second) {
     KeyElement firstKeys = getKeys(first);
     KeyElement secondKeys = getKeys(second);
-    
+
     return firstKeys.equals(secondKeys);
   }
-  
+
   /**
    * Are the key values equal for both instances.
    * If all compared key values are <code>null</code> this also means equal.
    * Before object (keys) are compared it is validated that both object instance are NOT null
    * and that both are from the same class as this {@link DataStore} (see {@link #dataTypeClass}).
-   * For the equal check on {@link #dataTypeClass} instances without validation see
-   * {@link #isKeyEqual(Object, Object)}.
+   * For the equal check on {@link #dataTypeClass} instances without validation see {@link #isKeyEqual(Object, Object)}.
    * 
    * @param first first instance to check for key equal
    * @param second second instance to check for key equal
    * @return <code>true</code> if object instance have equal keys set.
    */
   @SuppressWarnings("unchecked")
-  public boolean isKeyEqualChecked(Object first, Object second) throws DataStoreException {
-    if(first == null || second == null) {
+  public boolean isKeyEqualChecked(final Object first, final Object second) throws DataStoreException {
+    if (first == null || second == null) {
       throw new DataStoreException("Tried to compare null values which is not allowed.");
-    } else if(first.getClass() != dataTypeClass) {
+    } else if (first.getClass() != dataTypeClass) {
       throw new DataStoreException("First value is no instance from required class '" + dataTypeClass + "'.");
-    } else if(second.getClass() != dataTypeClass) {
+    } else if (second.getClass() != dataTypeClass) {
       throw new DataStoreException("Second value is no instance from required class '" + dataTypeClass + "'.");
     }
-    
+
     return isKeyEqual((T) first, (T) second);
   }
 
-
   private class KeyElement {
     private int cachedHashCode = 42;
     private final List<Object> keyValues;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelper.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelper.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelper.java
index 54ffb49..acf1deb 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelper.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelper.java
@@ -63,7 +63,7 @@ public class AnnotationHelper {
 
     Map<String, Object> firstKeyFields = getValueForAnnotatedFields(firstInstance, EdmKey.class);
     Map<String, Object> secondKeyFields = getValueForAnnotatedFields(secondInstance, EdmKey.class);
-    if(firstKeyFields.isEmpty() && secondKeyFields.isEmpty()) {
+    if (firstKeyFields.isEmpty() && secondKeyFields.isEmpty()) {
       throw new ODataRuntimeException("Both object instances does not have EdmKey fields defined ["
           + "firstClass=" + firstInstance.getClass().getName()
           + " secondClass=" + secondInstance.getClass().getName() + "].");
@@ -87,7 +87,7 @@ public class AnnotationHelper {
   private boolean keyValuesMatch(final Map<String, Object> firstKeyValues, final Map<String, Object> secondKeyValues) {
     if (firstKeyValues.size() != secondKeyValues.size()) {
       return false;
-    } else if(firstKeyValues.isEmpty()) {
+    } else if (firstKeyValues.isEmpty()) {
       throw new ODataRuntimeException("No keys given for key value matching.");
     } else {
       Set<Map.Entry<String, Object>> entries = firstKeyValues.entrySet();
@@ -519,9 +519,9 @@ public class AnnotationHelper {
     return fieldName2Value;
   }
 
-  private String extractPropertyName(Field field) {
+  private String extractPropertyName(final Field field) {
     final EdmProperty property = field.getAnnotation(EdmProperty.class);
-    if(property == null || property.name().isEmpty()) {
+    if (property == null || property.name().isEmpty()) {
       return getCanonicalName(field);
     } else {
       return property.name();
@@ -664,7 +664,7 @@ public class AnnotationHelper {
       return type.getEdmSimpleTypeInstance().valueOfString(propertyValue,
           EdmLiteralKind.DEFAULT, null, fieldClass);
     } catch (EdmSimpleTypeException ex) {
-      throw new ODataRuntimeException("Conversion failed for string property [" 
+      throw new ODataRuntimeException("Conversion failed for string property ["
           + propertyValue + "] on field ["
           + field + "] with error: " + ex.getMessage(), ex);
     }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
index 27f9cdb..66f7860 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java
@@ -104,7 +104,7 @@ public class ClassHelper {
     return annotatedClasses;
   }
 
-  private static boolean isJarFile(URL url) {
+  private static boolean isJarFile(final URL url) {
     String filename = url.getFile();
     int index = filename.indexOf(JAR_RESOURCE_SEPARATOR);
     if (index > JAR_FILE_ENDING.length()) {
@@ -114,7 +114,8 @@ public class ClassHelper {
     return false;
   }
 
-  private static Collection<String> getClassFqnFromDir(final FilenameFilter ff, File folder, String packageToScan) {
+  private static Collection<String> getClassFqnFromDir(final FilenameFilter ff, final File folder,
+      final String packageToScan) {
     List<String> classFiles = new ArrayList<String>();
     String[] classFilesForFolder = folder.list(ff);
     for (String name : classFilesForFolder) {
@@ -130,7 +131,7 @@ public class ClassHelper {
     return classFiles;
   }
 
-  private static Collection<String> getClassFqnFromJar(String filepath, String packageToScan) {
+  private static Collection<String> getClassFqnFromJar(final String filepath, final String packageToScan) {
     JarFile jarFile = null;
 
     final String jarFilePath;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/AnnotationServiceFactoryImplTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/AnnotationServiceFactoryImplTest.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/AnnotationServiceFactoryImplTest.java
index 4feaac7..ddac573 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/AnnotationServiceFactoryImplTest.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/AnnotationServiceFactoryImplTest.java
@@ -40,10 +40,10 @@ public class AnnotationServiceFactoryImplTest {
   public void createFromPackage() throws ODataException {
     AnnotationServiceFactoryImpl factory = new AnnotationServiceFactoryImpl();
     ODataService service = factory.createAnnotationService(Building.class.getPackage().getName());
-    
+
     Assert.assertNotNull(service);
   }
-  
+
   @Test
   public void createFromAnnotatedClasses() throws ODataException {
     AnnotationServiceFactoryImpl factory = new AnnotationServiceFactoryImpl();
@@ -56,19 +56,19 @@ public class AnnotationServiceFactoryImplTest {
     annotatedClasses.add(Room.class);
     annotatedClasses.add(Team.class);
     ODataService service = factory.createAnnotationService(annotatedClasses);
-    
+
     Assert.assertNotNull(service);
   }
 
-  @Test(expected=ODataException.class)
+  @Test(expected = ODataException.class)
   public void createFromClasses() throws ODataException {
     AnnotationServiceFactoryImpl factory = new AnnotationServiceFactoryImpl();
-    
+
     final Collection<Class<?>> notAnnotatedClasses = new ArrayList<Class<?>>();
     notAnnotatedClasses.add(String.class);
     notAnnotatedClasses.add(Long.class);
     ODataService service = factory.createAnnotationService(notAnnotatedClasses);
-    
+
     Assert.assertNotNull(service);
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/ListsProcessorTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/ListsProcessorTest.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/ListsProcessorTest.java
index 82b857c..89c83da 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/ListsProcessorTest.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/ListsProcessorTest.java
@@ -33,16 +33,16 @@ public class ListsProcessorTest {
   private ListsProcessor listsProcessor;
   private DataSource mockedDataSource = Mockito.mock(DataSource.class);
   private ValueAccess mockedValueAccess = Mockito.mock(ValueAccess.class);
-  
+
   @Test
   public void init() throws ODataException {
     DataSource dataSource = new AnnotationInMemoryDs(Building.class.getPackage().getName());
     ValueAccess valueAccess = new AnnotationValueAccess();
     ListsProcessor lp = new ListsProcessor(dataSource, valueAccess);
-    
+
     Assert.assertNotNull(lp);
   }
-  
+
   public ListsProcessorTest() {
     listsProcessor = new ListsProcessor(mockedDataSource, mockedValueAccess);
   }
@@ -82,7 +82,7 @@ public class ListsProcessorTest {
     String url = "Rooms?$orderby=Seats%20desc&$skiptoken=213&$top=200";
     String result = listsProcessor.percentEncodeNextLink(url);
     Assert.assertEquals("Rooms?$orderby=Seats%20desc&$top=200", result);
-    
+
     String url2 = "Rooms?$orderby=Seats%20desc&$skiptoken=213";
     String result2 = listsProcessor.percentEncodeNextLink(url2);
     Assert.assertEquals("Rooms?$orderby=Seats%20desc", result2);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationValueAccessTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationValueAccessTest.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationValueAccessTest.java
index df7b3a4..25b2fe9 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationValueAccessTest.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationValueAccessTest.java
@@ -39,7 +39,7 @@ public class AnnotationValueAccessTest {
     EdmProperty property = mockProperty("Name");
 
     Class<?> type = ava.getPropertyType(data, property);
-    
+
     Assert.assertEquals(String.class, type);
   }
 
@@ -49,20 +49,18 @@ public class AnnotationValueAccessTest {
     EdmProperty property = mockProperty("Name");
 
     Class<?> type = ava.getPropertyType(null, property);
-    
+
     Assert.assertNull(type);
   }
 
-  
-  @Test(expected=ODataNotImplementedException.class)
+  @Test(expected = ODataNotImplementedException.class)
   public void getPropertyTypeNotAnnotated() throws ODataException {
     AnnotationValueAccess ava = new AnnotationValueAccess();
     NotAnnotatedBean data = new NotAnnotatedBean();
-    data.name = "A Name";
     EdmProperty property = mockProperty("Name");
 
     Class<?> type = ava.getPropertyType(data, property);
-    
+
     Assert.assertEquals(String.class, type);
   }
 
@@ -74,7 +72,7 @@ public class AnnotationValueAccessTest {
     EdmProperty property = mockProperty("Name");
 
     Object value = ava.getPropertyValue(data, property);
-    
+
     Assert.assertEquals(String.class, value.getClass());
     Assert.assertEquals("A Name", value);
   }
@@ -86,7 +84,7 @@ public class AnnotationValueAccessTest {
     EdmProperty property = mockProperty("Name");
 
     Object value = ava.getPropertyValue(data, property);
-    
+
     Assert.assertNull(value);
   }
 
@@ -97,15 +95,14 @@ public class AnnotationValueAccessTest {
     EdmProperty property = mockProperty("Name");
 
     Object value = ava.getPropertyValue(data, property);
-    
+
     Assert.assertNull(value);
   }
 
-  @Test(expected=ODataNotImplementedException.class)
+  @Test(expected = ODataNotImplementedException.class)
   public void getPropertyValueNotAnnotated() throws ODataException {
     AnnotationValueAccess ava = new AnnotationValueAccess();
     NotAnnotatedBean data = new NotAnnotatedBean();
-    data.name = "A Name";
     EdmProperty property = mockProperty("Name");
 
     Object value = ava.getPropertyValue(data, property);
@@ -118,20 +115,19 @@ public class AnnotationValueAccessTest {
     SimpleEntity data = new SimpleEntity();
     data.name = "A Name";
     EdmProperty property = mockProperty("Name");
-    
+
     Object value = "Another Name";
     ava.setPropertyValue(data, property, value);
-    
+
     Assert.assertEquals("Another Name", data.name);
   }
 
-  @Test(expected=ODataNotImplementedException.class)
+  @Test(expected = ODataNotImplementedException.class)
   public void setPropertyValueNotAnnotated() throws ODataException {
     AnnotationValueAccess ava = new AnnotationValueAccess();
     NotAnnotatedBean data = new NotAnnotatedBean();
-    data.name = "A Name";
     EdmProperty property = mockProperty("Name");
-    
+
     Object value = "Another Name";
     ava.setPropertyValue(data, property, value);
   }
@@ -142,9 +138,9 @@ public class AnnotationValueAccessTest {
     SimpleEntity data = new SimpleEntity();
     data.name = "A Name";
     EdmProperty property = mockProperty("Name");
-    
+
     ava.setPropertyValue(data, property, null);
-    
+
     Assert.assertNull(null, data.name);
   }
 
@@ -153,9 +149,9 @@ public class AnnotationValueAccessTest {
     AnnotationValueAccess ava = new AnnotationValueAccess();
     SimpleEntity data = null;
     EdmProperty property = mockProperty("Name");
-    
+
     ava.setPropertyValue(data, property, null);
-    
+
     // no exception is thrown, all fine
   }
 
@@ -165,9 +161,9 @@ public class AnnotationValueAccessTest {
     SimpleEntity data = new SimpleEntity();
     data.myMappedProperty = "mapped property value";
     EdmMapping mapping = mockMapping("MyMappedProperty");
-    
+
     Object value = ava.getMappingValue(data, mapping);
-    
+
     Assert.assertEquals(String.class, value.getClass());
     Assert.assertEquals("mapped property value", value);
   }
@@ -178,9 +174,9 @@ public class AnnotationValueAccessTest {
     SimpleEntity data = new SimpleEntity();
     data.myMappedProperty = "property";
     EdmMapping mapping = null;
-    
+
     Object value = ava.getMappingValue(data, mapping);
-    
+
     Assert.assertNull(value);
   }
 
@@ -190,9 +186,9 @@ public class AnnotationValueAccessTest {
     SimpleEntity data = new SimpleEntity();
     data.myMappedProperty = null;
     EdmMapping mapping = mockMapping("MyMappedProperty");
-    
+
     Object value = ava.getMappingValue(data, mapping);
-    
+
     Assert.assertNull(value);
   }
 
@@ -202,10 +198,10 @@ public class AnnotationValueAccessTest {
     SimpleEntity data = new SimpleEntity();
     data.myMappedProperty = "mapped property value";
     EdmMapping mapping = mockMapping("MyMappedProperty");
-    
+
     Object value = "Changed mapped property value";
     ava.setMappingValue(data, mapping, value);
-    
+
     Assert.assertEquals("Changed mapped property value", data.myMappedProperty);
   }
 
@@ -215,10 +211,10 @@ public class AnnotationValueAccessTest {
     SimpleEntity data = new SimpleEntity();
     data.myMappedProperty = "mapped property value";
     EdmMapping mapping = mockMapping("MyMappedProperty");
-    
+
     Object value = null;
     ava.setMappingValue(data, mapping, value);
-    
+
     Assert.assertNull(data.myMappedProperty);
   }
 
@@ -228,20 +224,20 @@ public class AnnotationValueAccessTest {
     SimpleEntity data = new SimpleEntity();
     data.myMappedProperty = "mapped property value";
     EdmMapping mapping = null;
-    
+
     Object value = null;
     ava.setMappingValue(data, mapping, value);
-    
+
     Assert.assertEquals("mapped property value", data.myMappedProperty);
   }
-  
-  private EdmProperty mockProperty(String name) throws EdmException {
+
+  private EdmProperty mockProperty(final String name) throws EdmException {
     EdmProperty property = Mockito.mock(EdmProperty.class);
     Mockito.when(property.getName()).thenReturn(name);
     return property;
   }
 
-  private EdmMapping mockMapping(String mimeTypeKey) throws EdmException {
+  private EdmMapping mockMapping(final String mimeTypeKey) throws EdmException {
     EdmMapping mapping = Mockito.mock(EdmMapping.class);
     Mockito.when(mapping.getMediaResourceMimeTypeKey()).thenReturn(mimeTypeKey);
     return mapping;
@@ -249,11 +245,11 @@ public class AnnotationValueAccessTest {
 
   @EdmEntityType
   private class SimpleEntity {
-    @org.apache.olingo.odata2.api.annotation.edm.EdmProperty String name;
-    @org.apache.olingo.odata2.api.annotation.edm.EdmProperty String myMappedProperty;
-  }
-  
-  private class NotAnnotatedBean {
-    private String name;
+    @org.apache.olingo.odata2.api.annotation.edm.EdmProperty
+    String name;
+    @org.apache.olingo.odata2.api.annotation.edm.EdmProperty
+    String myMappedProperty;
   }
+
+  private class NotAnnotatedBean {}
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java
index 3213556..c0fe898 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/datasource/AnnotationsInMemoryDsTest.java
@@ -119,7 +119,7 @@ public class AnnotationsInMemoryDsTest {
             localDs.createData(edmEntitySet, se);
           } catch (Exception ex) {
             throw new RuntimeException(ex);
-          }finally{
+          } finally {
             latch.countDown();
           }
         }
@@ -160,7 +160,7 @@ public class AnnotationsInMemoryDsTest {
 
     return new Thread(run);
   }
-  
+
   @Test
   public void readBinaryData() throws Exception {
     EdmEntitySet entitySet = createMockedEdmEntitySet("Photos");
@@ -178,7 +178,7 @@ public class AnnotationsInMemoryDsTest {
     keys.put("Name", "SomePic");
     keys.put("ImageFormat", "PNG");
     Photo toReadPhoto = (Photo) datasource.readData(entitySet, keys);
-    
+
     // execute
     BinaryData readBinaryData = datasource.readBinaryData(entitySet, toReadPhoto);
 
@@ -200,7 +200,7 @@ public class AnnotationsInMemoryDsTest {
     photo.setImage(image);
     photo.setImageType("image/png");
     photoDataStore.create(photo);
-    
+
     Photo toReadPhoto = new Photo();
     toReadPhoto.setName("SomePic");
     toReadPhoto.setType("PNG");
@@ -208,13 +208,12 @@ public class AnnotationsInMemoryDsTest {
     toReadPhoto.setImageType(null);
 
     BinaryData readBinaryData = datasource.readBinaryData(entitySet, toReadPhoto);
-    
+
     Assert.assertEquals("binary", new String(readBinaryData.getData(), Charset.defaultCharset()));
     Assert.assertArrayEquals(image, readBinaryData.getData());
     Assert.assertEquals("image/png", readBinaryData.getMimeType());
   }
 
-  
   @Test
   public void writeBinaryData() throws Exception {
     EdmEntitySet entitySet = createMockedEdmEntitySet("Photos");
@@ -241,7 +240,7 @@ public class AnnotationsInMemoryDsTest {
     Assert.assertEquals("image/png", storedPhoto.getImageType());
   }
 
-  @Test(expected=ODataNotFoundException.class)
+  @Test(expected = ODataNotFoundException.class)
   public void writeBinaryDataNotFound() throws Exception {
     EdmEntitySet entitySet = createMockedEdmEntitySet("Photos");
 
@@ -255,12 +254,11 @@ public class AnnotationsInMemoryDsTest {
     datasource.writeBinaryData(entitySet, toWritePhoto, writeBinaryData);
   }
 
-  
   @Test
   public void newDataObject() throws Exception {
     EdmEntitySet roomsEntitySet = createMockedEdmEntitySet("Rooms");
     Room room = (Room) datasource.newDataObject(roomsEntitySet);
-    
+
     Assert.assertNotNull(room);
   }
 
@@ -294,7 +292,7 @@ public class AnnotationsInMemoryDsTest {
     Building readBuilding = (Building) relatedData;
     Assert.assertEquals("Common Building", readBuilding.getName());
     Assert.assertEquals("1", readBuilding.getId());
-    
+
     Collection<Room> relatedRooms = readBuilding.getRooms();
     Assert.assertEquals(roomsCount, relatedRooms.size());
     for (Room room : relatedRooms) {
@@ -304,7 +302,7 @@ public class AnnotationsInMemoryDsTest {
     }
   }
 
-  @Test(expected=ODataRuntimeException.class)
+  @Test(expected = ODataRuntimeException.class)
   public void readUnknownEntity() throws Exception {
     EdmEntitySet unknownEntitySet = Mockito.mock(EdmEntitySet.class);
     Mockito.when(unknownEntitySet.getName()).thenReturn("UnknownEntity");
@@ -315,7 +313,7 @@ public class AnnotationsInMemoryDsTest {
     datasource.readData(unknownEntitySet, keys);
   }
 
-  @Test(expected=ODataRuntimeException.class)
+  @Test(expected = ODataRuntimeException.class)
   public void readUnknownEntities() throws Exception {
     EdmEntitySet unknownEntitySet = Mockito.mock(EdmEntitySet.class);
     Mockito.when(unknownEntitySet.getName()).thenReturn("UnknownEntity");
@@ -354,7 +352,6 @@ public class AnnotationsInMemoryDsTest {
     }
   }
 
-  
   @Test
   @SuppressWarnings("unchecked")
   public void readRelatedEntities() throws Exception {
@@ -417,7 +414,7 @@ public class AnnotationsInMemoryDsTest {
     Room read = (Room) datasource.readData(roomsEntitySet, keys);
     Assert.assertEquals("Room 12", read.getName());
     Assert.assertEquals("12", read.getId());
-    
+
     // execute
     Object relatedData = datasource.readRelatedData(
         roomsEntitySet, room, buildingsEntitySet, Collections.EMPTY_MAP);
@@ -622,8 +619,7 @@ public class AnnotationsInMemoryDsTest {
     Assert.assertEquals("image/jpg", readUpdated.getImageType());
     Assert.assertEquals("https://localhost/image.jpg", readUpdated.getImageUri());
   }
-  
-  
+
   @Test
   public void deleteSimpleEntity() throws Exception {
     EdmEntitySet edmEntitySet = createMockedEdmEntitySet("Buildings");
@@ -642,15 +638,15 @@ public class AnnotationsInMemoryDsTest {
 
     //
     datasource.deleteData(edmEntitySet, keys);
-    
+
     // validate
     try {
       Building readAfterDelete = (Building) datasource.readData(edmEntitySet, keys);
       Assert.fail("Expected " + ODataNotFoundException.class + "was not thrown for '" + readAfterDelete + "'.");
-    } catch (ODataNotFoundException e) { }
+    } catch (ODataNotFoundException e) {}
   }
 
-  @Test(expected=ODataRuntimeException.class)
+  @Test(expected = ODataRuntimeException.class)
   public void unknownEntitySetForEntity() throws Exception {
     String entitySetName = "Unknown";
     FullQualifiedName entityType = new FullQualifiedName(DEFAULT_CONTAINER, entitySetName);
@@ -660,14 +656,14 @@ public class AnnotationsInMemoryDsTest {
     EdmEntityType edmEntityType = Mockito.mock(EdmEntityType.class);
     Mockito.when(edmEntitySet.getEntityType()).thenReturn(edmEntityType);
     Mockito.when(edmEntityType.getName()).thenReturn(entityType.getName());
-      
+
     Map<String, Object> keys = new HashMap<String, Object>();
     keys.put("Id", "1");
     //
     datasource.readData(edmEntitySet, keys);
   }
 
-  @Test(expected=ODataRuntimeException.class)
+  @Test(expected = ODataRuntimeException.class)
   public void unknownEntitySetForEntities() throws Exception {
     String entitySetName = "Unknown";
     FullQualifiedName entityType = new FullQualifiedName(DEFAULT_CONTAINER, entitySetName);
@@ -677,12 +673,11 @@ public class AnnotationsInMemoryDsTest {
     EdmEntityType edmEntityType = Mockito.mock(EdmEntityType.class);
     Mockito.when(edmEntitySet.getEntityType()).thenReturn(edmEntityType);
     Mockito.when(edmEntityType.getName()).thenReturn(entityType.getName());
-      
+
     //
     datasource.readData(edmEntitySet);
   }
 
-
   @Test
   public void writeRelations() throws Exception {
     DataStore<Building> buildingStore = DataStore.createInMemory(Building.class, true);
@@ -696,35 +691,36 @@ public class AnnotationsInMemoryDsTest {
     Building created = buildingStore.create(building);
 
     Room room = new Room(42, "Room with Number");
-    room.setSeats(123);;
+    room.setSeats(123);
+    ;
     room.setVersion(4711);
     roomStore.create(room);
-    
+
     Map<String, Object> targetEntityKeyValues = new HashMap<String, Object>();
     targetEntityKeyValues.put("Id", 42);
-    
+
     // execute
     datasource.writeRelation(buildingsEntitySet, building, roomsEntitySet, targetEntityKeyValues);
-    
+
     // validate
     Building readBuilding = buildingStore.read(created);
     Room readRoom = roomStore.read(new Room(42, ""));
-    
+
     List<Room> readRooms = readBuilding.getRooms();
     Assert.assertEquals(1, readRooms.size());
     Assert.assertEquals(readRoom, readRooms.get(0));
-    
+
     Assert.assertEquals("42", readRoom.getId());
     Assert.assertEquals(123, readRoom.getSeats());
     Assert.assertEquals(4711, readRoom.getVersion());
     Assert.assertEquals(readBuilding, readRoom.getBuilding());
   }
-  
+
   private EdmEntitySet createMockedEdmEntitySet(final String entitySetName) throws ODataException {
     return createMockedEdmEntitySet(edmProvider, entitySetName);
   }
 
-  private EdmEntitySet createMockedEdmEntitySet(AnnotationEdmProvider edmProvider, final String entitySetName)
+  private EdmEntitySet createMockedEdmEntitySet(final AnnotationEdmProvider edmProvider, final String entitySetName)
       throws ODataException {
     EntitySet entitySet = edmProvider.getEntitySet(DEFAULT_CONTAINER, entitySetName);
     FullQualifiedName entityType = entitySet.getEntityType();

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/model/Building.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/model/Building.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/model/Building.java
index bc9f54b..350ef16 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/model/Building.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/model/Building.java
@@ -53,7 +53,7 @@ public class Building {
     return id;
   }
 
-  public void setId(String id) {
+  public void setId(final String id) {
     this.id = id;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/model/Room.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/model/Room.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/model/Room.java
index 57e42db..c808cbd 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/model/Room.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/model/Room.java
@@ -42,7 +42,7 @@ public class Room extends RefBase {
   public Room() {
     this(0, null);
   }
-  
+
   public Room(final int id, final String name) {
     super(id, name);
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelperTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelperTest.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelperTest.java
index 2e95f82..7bd35ad 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelperTest.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/AnnotationHelperTest.java
@@ -196,7 +196,7 @@ public class AnnotationHelperTest {
   public void setValueForPropertyNullInstance() throws Exception {
     annotationHelper.setValueForProperty(null, "", null);
   }
-  
+
   @Test
   public void extractEntitySetNameObject() {
     Assert.assertNull(annotationHelper.extractEntitySetName(Object.class));
@@ -213,7 +213,7 @@ public class AnnotationHelperTest {
     Assert.assertEquals("RefScenario", fqn.getNamespace());
     Assert.assertEquals("c_Location", fqn.getName());
   }
-  
+
   @Test
   public void convert() throws Exception {
     ConversionProperty cp = new ConversionProperty();
@@ -223,7 +223,7 @@ public class AnnotationHelperTest {
     annotationHelper.setValueForProperty(cp, "FloatProp", "43");
     annotationHelper.setValueForProperty(cp, "DoubleProp", "42.00");
     annotationHelper.setValueForProperty(cp, "ByteProp", "1");
-    
+
     Assert.assertEquals("42", cp.stringProp);
     Assert.assertEquals(Integer.valueOf(420), cp.integerProp);
     Assert.assertEquals(Long.valueOf("4200"), cp.longProp);
@@ -242,7 +242,7 @@ public class AnnotationHelperTest {
 
     public SimpleEntity() {}
 
-    public SimpleEntity(Long id, String name) {
+    public SimpleEntity(final Long id, final String name) {
       this.id = id;
       this.name = name;
     }
@@ -256,15 +256,19 @@ public class AnnotationHelperTest {
   }
 
   private class ConversionProperty {
-    @EdmProperty(type=EdmType.STRING) String stringProp;
-    @EdmProperty(type=EdmType.INT32) Integer integerProp;
-    @EdmProperty(type=EdmType.INT64) Long longProp;
-    @EdmProperty(type=EdmType.DECIMAL) Float floatProp;
-    @EdmProperty(type=EdmType.DOUBLE) Double doubleProp;
-    @EdmProperty(type=EdmType.BYTE) Byte byteProp;
-  }
-  
-  private class NotAnnotatedBean {
-    private String name;
+    @EdmProperty(type = EdmType.STRING)
+    String stringProp;
+    @EdmProperty(type = EdmType.INT32)
+    Integer integerProp;
+    @EdmProperty(type = EdmType.INT64)
+    Long longProp;
+    @EdmProperty(type = EdmType.DECIMAL)
+    Float floatProp;
+    @EdmProperty(type = EdmType.DOUBLE)
+    Double doubleProp;
+    @EdmProperty(type = EdmType.BYTE)
+    Byte byteProp;
   }
+
+  private class NotAnnotatedBean {}
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java
index 0e7c406..393b651 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java
@@ -34,7 +34,7 @@ public class ClassHelperTest {
 
   private final ClassValidator annotatedTestEntityInnerClasses = new ClassValidator() {
     @Override
-    public boolean isClassValid(Class<?> c) {
+    public boolean isClassValid(final Class<?> c) {
       return c.isAnnotationPresent(EdmEntityType.class)
           && c.getName().contains(ClassHelperTest.class.getSimpleName());
     }
@@ -42,7 +42,7 @@ public class ClassHelperTest {
 
   private final ClassValidator annotatedEntityClasses = new ClassValidator() {
     @Override
-    public boolean isClassValid(Class<?> c) {
+    public boolean isClassValid(final Class<?> c) {
       return c.isAnnotationPresent(EdmEntityType.class);
     }
   };
@@ -58,7 +58,7 @@ public class ClassHelperTest {
     Assert.assertEquals(1, loadedClasses.size());
     Assert.assertEquals(SimpleEntity.class.getName(), loadedClasses.get(0).getName());
   }
-  
+
   @Test
   public void loadSingleEntityFromJar() throws ODataException {
     String packageToScan = AnnotatedEntity.class.getPackage().getName();
@@ -71,7 +71,6 @@ public class ClassHelperTest {
     Assert.assertEquals(AnnotatedEntity.class.getName(), loadedClasses.get(0).getName());
   }
 
-
   //
   // The below classes are 'unused' within the code but must be declared for loading via
   // the 'ClassHelper'
@@ -85,17 +84,5 @@ public class ClassHelperTest {
     Long id;
     @EdmProperty
     String name;
-
-    public SimpleEntity() {}
-
-    public SimpleEntity(Long id, String name) {
-      this.id = id;
-      this.name = name;
-    }
-  }
-
-  @SuppressWarnings("unused")
-  private class NotAnnotatedBean {
-    private String name;
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/AnnotationRefServiceFactory.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/AnnotationRefServiceFactory.java b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/AnnotationRefServiceFactory.java
index ccaca81..5a3766f 100644
--- a/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/AnnotationRefServiceFactory.java
+++ b/odata2-annotation-processor/annotation-processor-ref/src/main/java/org/apache/olingo/odata2/annotation/processor/ref/AnnotationRefServiceFactory.java
@@ -56,7 +56,7 @@ public class AnnotationRefServiceFactory extends ODataServiceFactory {
     final static String MODEL_PACKAGE = "org.apache.olingo.odata2.annotation.processor.ref.model";
 
     final static ODataService ANNOTATION_ODATA_SERVICE;
-    
+
     static {
       try {
         ANNOTATION_ODATA_SERVICE = AnnotationServiceFactory.createAnnotationService(MODEL_PACKAGE);
@@ -116,10 +116,10 @@ public class AnnotationRefServiceFactory extends ODataServiceFactory {
 
   }
 
-  private static <T> DataStore<T> getDataStore(Class<T> clz) throws DataStoreException {
+  private static <T> DataStore<T> getDataStore(final Class<T> clz) throws DataStoreException {
     return DataStore.createInMemory(clz, true);
   }
-  
+
   private static void initializeSampleData() throws ODataApplicationException {
     DataStore<Team> teamDs = getDataStore(Team.class);
     teamDs.create(createTeam("Team Alpha", true));

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceJsonTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceJsonTest.java b/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceJsonTest.java
index 4813690..66d3ff2 100644
--- a/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceJsonTest.java
+++ b/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceJsonTest.java
@@ -53,11 +53,11 @@ public class ServiceJsonTest extends AbstractRefTest {
     Assert.assertTrue(jsonDataResponseContains(body, "Teams"));
   }
 
-  private boolean jsonDataResponseContains(String content, String containingValue) {
+  private boolean jsonDataResponseContains(final String content, final String containingValue) {
     return content.matches("\\{\"d\":\\{\"EntitySets\":\\[.*"
         + containingValue + ".*\"\\]\\}\\}");
   }
-  
+
   @Test
   public void serviceDocumentAcceptHeaderJson() throws Exception {
     final HttpResponse response = callUri("", HttpHeaders.ACCEPT, HttpContentType.APPLICATION_JSON);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceXmlTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceXmlTest.java b/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceXmlTest.java
index 4d49883..a864c6a 100644
--- a/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceXmlTest.java
+++ b/odata2-annotation-processor/annotation-processor-ref/src/test/java/org/apache/olingo/odata2/annotation/processor/ref/ServiceXmlTest.java
@@ -41,7 +41,7 @@ public class ServiceXmlTest extends AbstractRefXmlTest {
     final HttpResponse response = callUri("/");
     checkMediaType(response, HttpContentType.APPLICATION_ATOM_SVC_UTF8);
     final String body = getBody(response);
-    
+
     assertXpathEvaluatesTo("Employees", "/app:service/app:workspace/app:collection[@href=\"Employees\"]", body);
     assertXpathEvaluatesTo("Teams", "/app:service/app:workspace/app:collection[@href=\"Teams\"]", body);
     assertXpathEvaluatesTo("Rooms", "/app:service/app:workspace/app:collection[@href=\"Rooms\"]", body);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
index f6cf6c1..239e16c 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
@@ -53,7 +53,7 @@ public class JPAEntity {
   private ODataJPAContext oDataJPAContext;
   public HashMap<EdmNavigationProperty, EdmEntitySet> inlinedEntities = null;
 
-  public JPAEntity(final EdmEntityType oDataEntityType, final EdmEntitySet oDataEntitySet, 
+  public JPAEntity(final EdmEntityType oDataEntityType, final EdmEntitySet oDataEntitySet,
       final ODataJPAContext context) {
     this.oDataEntityType = oDataEntityType;
     this.oDataEntitySet = oDataEntitySet;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParser.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParser.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParser.java
index 45e517d..63f258d 100644
--- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParser.java
+++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntityParser.java
@@ -314,7 +314,7 @@ public final class JPAEntityParser {
         } catch (SecurityException e1) {
           throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e1);
         }
-        if (acceserMethod != null){
+        if (acceserMethod != null) {
           accessModifierMap.put(
               propertyName,
               acceserMethod);

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderItem.java
----------------------------------------------------------------------
diff --git a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderItem.java b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderItem.java
index 9ee0f19..76d28e2 100644
--- a/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderItem.java
+++ b/odata2-jpa-processor/jpa-ref/src/main/java/org/apache/olingo/odata2/jpa/processor/ref/model/SalesOrderItem.java
@@ -30,116 +30,115 @@ import javax.persistence.Transient;
 @Table(name = "T_SALESORDERITEM")
 public class SalesOrderItem {
 
-	public SalesOrderItem() {
-	}
+  public SalesOrderItem() {}
 
-	public SalesOrderItem(final int quantity, final double amount,
-			final double discount, final Material material) {
-		super();
-		this.quantity = quantity;
-		this.amount = amount;
-		this.discount = discount;
-		this.material = material;
-	}
-
-	@EmbeddedId
-	private SalesOrderItemKey salesOrderItemKey;
-
-	@Column(name = "Material_Id", nullable = false)
-	private long matId;
-
-	@Column
-	private int quantity;
-
-	@Column
-	private double amount;
-
-	@Column
-	private double discount;
-
-	@Transient
-	private double netAmount;
-	
-	@Column
-	private boolean delivered;
-
-	public Boolean isDelivered() {
-		return delivered;
-	}
-
-	public void setDelivered(final Boolean deliveryStatus) {
-		this.delivered = deliveryStatus;
-	}
-
-	@JoinColumn(name = "Material_Id", referencedColumnName = "MATERIAL_ID", insertable = false, updatable = false)
-	@ManyToOne
-	private Material material;
-
-	@JoinColumn(name = "Sales_Order_Id", referencedColumnName = "SO_ID", insertable = false, updatable = false)
-	@ManyToOne
-	private SalesOrderHeader salesOrderHeader;
-
-	public SalesOrderItemKey getSalesOrderItemKey() {
-		return salesOrderItemKey;
-	}
-
-	public void setSalesOrderItemKey(final SalesOrderItemKey salesOrderItemKey) {
-		this.salesOrderItemKey = salesOrderItemKey;
-	}
-
-	public long getMatId() {
-		return matId;
-	}
-
-	public void setMatId(final long matId) {
-		this.matId = matId;
-	}
-
-	public int getQuantity() {
-		return quantity;
-	}
-
-	public void setQuantity(final int quantity) {
-		this.quantity = quantity;
-	}
-
-	public double getAmount() {
-		return amount;
-	}
-
-	public void setAmount(final double amount) {
-		this.amount = amount;
-	}
-
-	public double getDiscount() {
-		return discount;
-	}
-
-	public void setDiscount(final double discount) {
-		this.discount = discount;
-	}
-
-	public double getNetAmount() {
-		return netAmount;
-	}
-
-	public void setNetAmount(final double netAmount) {
-		this.netAmount = netAmount;
-	}
-
-	public Material getMaterial() {
-		return material;
-	}
-
-	public void setMaterial(final Material material) {
-		this.material = material;
-	}
-
-	public SalesOrderHeader getSalesOrderHeader() {
-		return salesOrderHeader;
-	}
+  public SalesOrderItem(final int quantity, final double amount,
+      final double discount, final Material material) {
+    super();
+    this.quantity = quantity;
+    this.amount = amount;
+    this.discount = discount;
+    this.material = material;
+  }
 
-	public void setSalesOrderHeader(final SalesOrderHeader salesOrderHeader) {
-		this.salesOrderHeader = salesOrderHeader;
-	}
+  @EmbeddedId
+  private SalesOrderItemKey salesOrderItemKey;
+
+  @Column(name = "Material_Id", nullable = false)
+  private long matId;
+
+  @Column
+  private int quantity;
+
+  @Column
+  private double amount;
+
+  @Column
+  private double discount;
+
+  @Transient
+  private double netAmount;
+
+  @Column
+  private boolean delivered;
+
+  public Boolean isDelivered() {
+    return delivered;
+  }
+
+  public void setDelivered(final Boolean deliveryStatus) {
+    delivered = deliveryStatus;
+  }
+
+  @JoinColumn(name = "Material_Id", referencedColumnName = "MATERIAL_ID", insertable = false, updatable = false)
+  @ManyToOne
+  private Material material;
+
+  @JoinColumn(name = "Sales_Order_Id", referencedColumnName = "SO_ID", insertable = false, updatable = false)
+  @ManyToOne
+  private SalesOrderHeader salesOrderHeader;
+
+  public SalesOrderItemKey getSalesOrderItemKey() {
+    return salesOrderItemKey;
+  }
+
+  public void setSalesOrderItemKey(final SalesOrderItemKey salesOrderItemKey) {
+    this.salesOrderItemKey = salesOrderItemKey;
+  }
+
+  public long getMatId() {
+    return matId;
+  }
+
+  public void setMatId(final long matId) {
+    this.matId = matId;
+  }
+
+  public int getQuantity() {
+    return quantity;
+  }
+
+  public void setQuantity(final int quantity) {
+    this.quantity = quantity;
+  }
+
+  public double getAmount() {
+    return amount;
+  }
+
+  public void setAmount(final double amount) {
+    this.amount = amount;
+  }
+
+  public double getDiscount() {
+    return discount;
+  }
+
+  public void setDiscount(final double discount) {
+    this.discount = discount;
+  }
+
+  public double getNetAmount() {
+    return netAmount;
+  }
+
+  public void setNetAmount(final double netAmount) {
+    this.netAmount = netAmount;
+  }
+
+  public Material getMaterial() {
+    return material;
+  }
+
+  public void setMaterial(final Material material) {
+    this.material = material;
+  }
+
+  public SalesOrderHeader getSalesOrderHeader() {
+    return salesOrderHeader;
+  }
+
+  public void setSalesOrderHeader(final SalesOrderHeader salesOrderHeader) {
+    this.salesOrderHeader = salesOrderHeader;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProvider.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProvider.java b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProvider.java
index 447df31..4ce2dac 100644
--- a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProvider.java
+++ b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProvider.java
@@ -663,8 +663,9 @@ public final class EntityProvider {
    * @return an {@link ODataDeltaFeed} object
    * @throws EntityProviderException if reading of data (de-serialization) fails
    */
-  public static ODataDeltaFeed readDeltaFeed(String contentType, EdmEntitySet entitySet, InputStream content,
-      EntityProviderReadProperties properties) throws EntityProviderException {
+  public static ODataDeltaFeed readDeltaFeed(final String contentType, final EdmEntitySet entitySet,
+      final InputStream content,
+      final EntityProviderReadProperties properties) throws EntityProviderException {
     return createEntityProvider().readDeltaFeed(contentType, entitySet, content, properties);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/DeletedEntryMetadata.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/DeletedEntryMetadata.java b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/DeletedEntryMetadata.java
index be5601e..f1e46a5 100644
--- a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/DeletedEntryMetadata.java
+++ b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/entry/DeletedEntryMetadata.java
@@ -38,5 +38,5 @@ public interface DeletedEntryMetadata {
    * @return the when date
    */
   Date getWhen();
-  
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataDeltaFeed.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataDeltaFeed.java b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataDeltaFeed.java
index c068772..2211624 100644
--- a/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataDeltaFeed.java
+++ b/odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/feed/ODataDeltaFeed.java
@@ -27,10 +27,8 @@ public interface ODataDeltaFeed extends ODataFeed {
   /**
    * Delta responses can contain changed feed data and deleted entries metadata. A delta response it the result of
    * a delta link. If the feed is not a delta feed then the list of deleted entries is null.
-   * @return metadata of deleted entries in case of feed is result of a delta response or null 
+   * @return metadata of deleted entries in case of feed is result of a delta response or null
    */
   public List<DeletedEntryMetadata> getDeletedEntries();
 
-
-  
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/AtomEntityProvider.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/AtomEntityProvider.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/AtomEntityProvider.java
index c0e88d1..7024d02 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/AtomEntityProvider.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/AtomEntityProvider.java
@@ -363,8 +363,8 @@ public class AtomEntityProvider implements ContentTypeBasedEntityProvider {
   }
 
   @Override
-  public ODataDeltaFeed readDeltaFeed(EdmEntitySet entitySet, InputStream content,
-      EntityProviderReadProperties properties) throws EntityProviderException {
+  public ODataDeltaFeed readDeltaFeed(final EdmEntitySet entitySet, final InputStream content,
+      final EntityProviderReadProperties properties) throws EntityProviderException {
     XmlEntityConsumer xec = new XmlEntityConsumer();
     return xec.readFeed(entitySet, content, properties);
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java
index 8f11653..442e273 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/JsonEntityProvider.java
@@ -336,8 +336,8 @@ public class JsonEntityProvider implements ContentTypeBasedEntityProvider {
   }
 
   @Override
-  public ODataDeltaFeed readDeltaFeed(EdmEntitySet entitySet, InputStream content,
-      EntityProviderReadProperties properties) throws EntityProviderException {
+  public ODataDeltaFeed readDeltaFeed(final EdmEntitySet entitySet, final InputStream content,
+      final EntityProviderReadProperties properties) throws EntityProviderException {
     return null;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImpl.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImpl.java
index f1f250e..128f730 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImpl.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/ProviderFacadeImpl.java
@@ -161,11 +161,12 @@ public class ProviderFacadeImpl implements EntityProviderInterface {
   }
 
   @Override
-  public ODataDeltaFeed readDeltaFeed(String contentType, EdmEntitySet entitySet, InputStream content,
-      EntityProviderReadProperties properties)  throws EntityProviderException {
+  public ODataDeltaFeed readDeltaFeed(final String contentType, final EdmEntitySet entitySet,
+      final InputStream content,
+      final EntityProviderReadProperties properties) throws EntityProviderException {
     return create(contentType).readDeltaFeed(entitySet, content, properties);
   }
-  
+
   @Override
   public ODataEntry readEntry(final String contentType, final EdmEntitySet entitySet, final InputStream content,
       final EntityProviderReadProperties properties) throws EntityProviderException {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java
index 4ad55b6..2ffec2e 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumer.java
@@ -157,7 +157,8 @@ public class XmlFeedConsumer {
     }
   }
 
-  private void readInlineCount(final XMLStreamReader reader, FeedMetadataImpl metadata) throws XMLStreamException,
+  private void readInlineCount(final XMLStreamReader reader, final FeedMetadataImpl metadata)
+      throws XMLStreamException,
       EntityProviderException {
     String inlineCountString = reader.getElementText();
     if (inlineCountString != null) {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/entry/DeletedEntryMetadataImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/entry/DeletedEntryMetadataImpl.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/entry/DeletedEntryMetadataImpl.java
index 8fc2cce..2b90870 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/entry/DeletedEntryMetadataImpl.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/entry/DeletedEntryMetadataImpl.java
@@ -1,3 +1,21 @@
+/*******************************************************************************
+ * 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.odata2.core.ep.entry;
 
 import java.util.Date;
@@ -8,7 +26,7 @@ public class DeletedEntryMetadataImpl implements DeletedEntryMetadata {
 
   private String uri;
   private Date when;
-  
+
   @Override
   public String getUri() {
     return uri;
@@ -19,11 +37,11 @@ public class DeletedEntryMetadataImpl implements DeletedEntryMetadata {
     return when;
   }
 
-  public void setUri(String uri) {
+  public void setUri(final String uri) {
     this.uri = uri;
   }
 
-  public void setWhen(Date when) {
+  public void setWhen(final Date when) {
     this.when = when;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataDeltaFeedImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataDeltaFeedImpl.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataDeltaFeedImpl.java
index 1ffa765..253492d 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataDeltaFeedImpl.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/feed/ODataDeltaFeedImpl.java
@@ -36,7 +36,7 @@ public class ODataDeltaFeedImpl implements ODataDeltaFeed {
   }
 
   public ODataDeltaFeedImpl(final List<ODataEntry> entries, final FeedMetadata feedMetadata,
-      List<DeletedEntryMetadata> deletedEntries) {
+      final List<DeletedEntryMetadata> deletedEntries) {
     this.entries = entries;
     this.feedMetadata = feedMetadata;
     this.deletedEntries = deletedEntries;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
index 14baf52..598f710 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonDeletedEntryEntityProducer.java
@@ -33,11 +33,12 @@ public class JsonDeletedEntryEntityProducer {
 
   private EntityProviderWriteProperties properties;
 
-  public JsonDeletedEntryEntityProducer(EntityProviderWriteProperties properties) {
+  public JsonDeletedEntryEntityProducer(final EntityProviderWriteProperties properties) {
     this.properties = properties;
   }
 
-  public void append(Writer writer, EntityInfoAggregator entityInfo, List<Map<String, Object>> deletedEntries)
+  public void append(final Writer writer, final EntityInfoAggregator entityInfo,
+      final List<Map<String, Object>> deletedEntries)
       throws EntityProviderException {
     JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
     try {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducer.java b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducer.java
index 25af754..758de1c 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedEntityProducer.java
@@ -112,7 +112,7 @@ public class JsonFeedEntityProducer {
     }
   }
 
-  private void appendNextLink(JsonStreamWriter jsonStreamWriter) throws IOException {
+  private void appendNextLink(final JsonStreamWriter jsonStreamWriter) throws IOException {
     // Write "next" link.
     // To be compatible with other implementations out there, the link is
     // written directly after "__next" and not as "{"uri":"next link"}",
@@ -123,7 +123,8 @@ public class JsonFeedEntityProducer {
     }
   }
 
-  private void appendDeltaLink(TombstoneCallback callback, JsonStreamWriter jsonStreamWriter) throws IOException {
+  private void appendDeltaLink(final TombstoneCallback callback, final JsonStreamWriter jsonStreamWriter)
+      throws IOException {
     if (callback != null) {
       TombstoneCallbackResult callbackResult = callback.getTombstoneCallbackResult();
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/commons/XmlHelperTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/commons/XmlHelperTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/commons/XmlHelperTest.java
index 956eb1b..dc8fb77 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/commons/XmlHelperTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/commons/XmlHelperTest.java
@@ -89,9 +89,11 @@ public class XmlHelperTest {
 
   @BeforeClass
   public static void beforeClass() {
+    // CHECKSTYLE:OFF
     System.setProperty("javax.xml.stream.XMLInputFactory", "com.ctc.wstx.stax.WstxInputFactory"); // NOSONAR
+    // CHECKSTYLE:ON
   }
-  
+
   @Test
   public void createReader() throws Exception {
     InputStream content = new ByteArrayInputStream(XML.getBytes("UTF-8"));
@@ -191,7 +193,6 @@ public class XmlHelperTest {
     }
   }
 
-
   @Test
   @Ignore("not way to disable in parser")
   public void xmlProcessingApiWithProtection() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java
index acd9f2e..9301258 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/XmlFeedConsumerTest.java
@@ -144,12 +144,12 @@ public class XmlFeedConsumerTest extends AbstractXmlConsumerTest {
     EntityProviderReadProperties consumerProperties = EntityProviderReadProperties.init().build();
 
     ODataDeltaFeed deltaFeed = xec.readFeed(entitySet, reqContent, consumerProperties);
-    
+
     assertNotNull(deltaFeed);
-    
+
     assertNotNull(deltaFeed.getDeletedEntries());
     assertNotNull(deltaFeed.getEntries());
-    
+
     assertEquals(1, deltaFeed.getEntries().size());
     assertEquals(1, deltaFeed.getDeletedEntries().size());
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/75e0e533/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
index 4dddc31..97063e6 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/producer/JsonFeedWithDeltaLinkProducerTest.java
@@ -119,7 +119,7 @@ public class JsonFeedWithDeltaLinkProducerTest extends BaseTest {
     final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
 
     deletedRoomData.clear();
-    
+
     TombstoneCallback tombstoneCallback =
         new TombstoneCallbackImpl(deletedRoomData, null);
 
@@ -159,7 +159,7 @@ public class JsonFeedWithDeltaLinkProducerTest extends BaseTest {
             + "host:80/service/Rooms('5')\"}"));
   }
 
-  private String writeRoomData(final EdmEntitySet entitySet, TombstoneCallback tombstoneCallback)
+  private String writeRoomData(final EdmEntitySet entitySet, final TombstoneCallback tombstoneCallback)
       throws URISyntaxException, EntityProviderException, IOException {
     Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
     callbacks.put(TombstoneCallback.CALLBACK_KEY_TOMBSTONE, tombstoneCallback);
@@ -181,7 +181,7 @@ public class JsonFeedWithDeltaLinkProducerTest extends BaseTest {
     return json;
   }
 
-  private void validate(String json) {
+  private void validate(final String json) {
     Object obj = gson.fromJson(json, Object.class);
     assertNotNull(obj);
   }