olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject git commit: [OLINGO-260] derived types tests
Date Fri, 16 May 2014 10:08:37 GMT
Repository: olingo-odata4
Updated Branches:
  refs/heads/master e854f416f -> 96c45510a


[OLINGO-260] derived types tests


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/96c45510
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/96c45510
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/96c45510

Branch: refs/heads/master
Commit: 96c45510aafed3739217eb067d259bff2b7ab89e
Parents: e854f41
Author: Francesco Chicchiriccò <--global>
Authored: Fri May 16 12:08:22 2014 +0200
Committer: Francesco Chicchiriccò <--global>
Committed: Fri May 16 12:08:22 2014 +0200

----------------------------------------------------------------------
 .../commons/AbstractTypeInvocationHandler.java  |   5 +-
 .../ComplexFactoryInvocationHandler.java        |  86 ++++
 .../commons/ComplexTypeInvocationHandler.java   |  19 +-
 .../EntityContainerInvocationHandler.java       |   2 +-
 .../commons/EntitySetInvocationHandler.java     |   4 +-
 .../commons/EntityTypeInvocationHandler.java    |   6 -
 .../proxy/commons/FactoryInvocationHandler.java |  86 ----
 .../olingo/ext/proxy/utils/CoreUtils.java       |  82 ++--
 .../fit/proxy/v4/DerivedTypeTestITCase.java     |  81 ++++
 .../olingo/fit/v4/DerivedTypeTestITCase.java    |  12 +-
 .../request/batch/v4/ODataBatchRequestImpl.java |   1 -
 .../client/core/op/AbstractODataBinder.java     |   6 +-
 .../client/core/op/impl/v4/ODataBinderImpl.java |   4 +-
 .../core/v4/EdmEnabledODataClientImpl.java      |   2 +-
 .../apache/olingo/client/core/AbstractTest.java |   2 +-
 .../olingo/client/core/v4/EntityTest.java       |  48 ++
 .../apache/olingo/client/core/v4/Customer.json  |  37 ++
 .../apache/olingo/client/core/v4/Customer.xml   |  46 ++
 .../client/core/v4/staticservice-metadata.xml   | 462 +++++++++++++++++++
 .../core/domain/v4/ODataAnnotationImpl.java     |   7 +
 .../core/domain/v4/ODataPropertyImpl.java       |  10 +
 21 files changed, 836 insertions(+), 172 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractTypeInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractTypeInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractTypeInvocationHandler.java
index a61e853..169ddfe 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractTypeInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractTypeInvocationHandler.java
@@ -35,7 +35,6 @@ import org.apache.olingo.commons.api.domain.ODataInlineEntity;
 import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
 import org.apache.olingo.commons.api.domain.ODataLink;
 import org.apache.olingo.commons.api.domain.ODataLinked;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.ext.proxy.EntityContainerFactory;
 import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
 import org.apache.olingo.ext.proxy.api.annotations.EntityType;
@@ -96,8 +95,6 @@ public abstract class AbstractTypeInvocationHandler extends AbstractInvocationHa
     this.entityHandler = entityHandler;
   }
 
-  public abstract FullQualifiedName getName();
-
   public Class<?> getTypeRef() {
     return typeRef;
   }
@@ -119,7 +116,7 @@ public abstract class AbstractTypeInvocationHandler extends AbstractInvocationHa
       return Proxy.newProxyInstance(
               Thread.currentThread().getContextClassLoader(),
               new Class<?>[] {returnType},
-              FactoryInvocationHandler.getInstance(entityHandler, this));
+              ComplexFactoryInvocationHandler.getInstance(entityHandler, this));
     } else if (method.getName().startsWith("get")) {
       // Assumption: for each getter will always exist a setter and viceversa.
       // get method annotation and check if it exists as expected

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexFactoryInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexFactoryInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexFactoryInvocationHandler.java
new file mode 100644
index 0000000..2f833c6
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexFactoryInvocationHandler.java
@@ -0,0 +1,86 @@
+/*
+ * 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.ext.proxy.commons;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import org.apache.olingo.client.api.CommonEdmEnabledODataClient;
+import org.apache.olingo.ext.proxy.api.OperationExecutor;
+import org.apache.olingo.ext.proxy.api.annotations.Property;
+import org.apache.olingo.ext.proxy.utils.ClassUtils;
+
+class ComplexFactoryInvocationHandler extends AbstractInvocationHandler implements OperationExecutor {
+
+  private static final long serialVersionUID = 2629912294765040027L;
+
+  private final EntityTypeInvocationHandler entityHandler;
+
+  private final AbstractTypeInvocationHandler invokerHandler;
+
+  static ComplexFactoryInvocationHandler getInstance(
+          final CommonEdmEnabledODataClient<?> client,
+          final EntityContainerInvocationHandler containerHandler,
+          final EntityTypeInvocationHandler entityHandler,
+          final AbstractTypeInvocationHandler targetHandler) {
+
+    return new ComplexFactoryInvocationHandler(client, containerHandler, entityHandler, targetHandler);
+  }
+
+  static ComplexFactoryInvocationHandler getInstance(
+          final EntityTypeInvocationHandler entityHandler,
+          final AbstractTypeInvocationHandler targetHandler) {
+    return new ComplexFactoryInvocationHandler(
+            entityHandler == null ? null : entityHandler.containerHandler.client,
+            targetHandler == null
+            ? entityHandler == null ? null : entityHandler.containerHandler : targetHandler.containerHandler,
+            entityHandler,
+            targetHandler);
+  }
+
+  private ComplexFactoryInvocationHandler(
+          final CommonEdmEnabledODataClient<?> client,
+          final EntityContainerInvocationHandler containerHandler,
+          final EntityTypeInvocationHandler entityHandler,
+          final AbstractTypeInvocationHandler targetHandler) {
+
+    super(client, containerHandler);
+    this.invokerHandler = targetHandler;
+    this.entityHandler = entityHandler;
+  }
+
+  @Override
+  public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
+    if (isSelfMethod(method, args)) {
+      return invokeSelfMethod(method, args);
+    } else if (method.getName().startsWith("new")) {
+      final Method getter = proxy.getClass().getInterfaces()[0].getMethod(method.getName());
+      final Property property = ClassUtils.getAnnotation(Property.class, getter);
+      if (property == null) {
+        throw new UnsupportedOperationException("Unsupported method " + method.getName());
+      }
+
+      return Proxy.newProxyInstance(
+              Thread.currentThread().getContextClassLoader(),
+              new Class<?>[] {method.getReturnType()},
+              ComplexTypeInvocationHandler.getInstance(client, property.name(), method.getReturnType(), entityHandler));
+    } else {
+      throw new NoSuchMethodException(method.getName());
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexTypeInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexTypeInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexTypeInvocationHandler.java
index ed6cd6d..2175e8c 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexTypeInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexTypeInvocationHandler.java
@@ -91,15 +91,6 @@ public class ComplexTypeInvocationHandler extends AbstractTypeInvocationHandler
     super(client, typeRef, complex, handler);
   }
 
-  public void setComplex(final ODataComplexValue<?> complex) {
-    this.internal = complex;
-  }
-
-  @Override
-  public FullQualifiedName getName() {
-    return new FullQualifiedName(((ODataComplexValue<?>) this.internal).getTypeName());
-  }
-
   @SuppressWarnings("unchecked")
   public ODataComplexValue<CommonODataProperty> getComplex() {
     return (ODataComplexValue<CommonODataProperty>) this.internal;
@@ -126,7 +117,7 @@ public class ComplexTypeInvocationHandler extends AbstractTypeInvocationHandler
       }
     }
 
-    for (Iterator<? extends CommonODataProperty> itor = getComplex().iterator(); itor.hasNext();) {
+    for (final Iterator<? extends CommonODataProperty> itor = getComplex().iterator(); itor.hasNext();) {
       final CommonODataProperty property = itor.next();
       if (!propertyNames.contains(property.getName())) {
         res.add(property.getName());
@@ -159,12 +150,10 @@ public class ComplexTypeInvocationHandler extends AbstractTypeInvocationHandler
       toBeAdded = value;
     }
 
-    final EdmTypeInfo type = new EdmTypeInfo.Builder().
-            setEdm(client.getCachedEdm()).setTypeExpression(
-                    edmProperty.isCollection() ? "Collection(" + property.type() + ")" : property.type()).build();
+    final EdmTypeInfo type = new EdmTypeInfo.Builder().setEdm(client.getCachedEdm()).setTypeExpression(
+            edmProperty.isCollection() ? "Collection(" + property.type() + ")" : property.type()).build();
 
-    client.getBinder().add(
-            getComplex(), CoreUtils.getODataProperty(client, property.name(), type, toBeAdded));
+    client.getBinder().add(getComplex(), CoreUtils.getODataProperty(client, property.name(), type, toBeAdded));
 
     if (entityHandler != null && !entityContext.isAttached(entityHandler)) {
       entityContext.attach(entityHandler, AttachedEntityStatus.CHANGED);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java
index afd86b4..299a842 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityContainerInvocationHandler.java
@@ -102,7 +102,7 @@ public final class EntityContainerInvocationHandler extends AbstractInvocationHa
       return Proxy.newProxyInstance(
               Thread.currentThread().getContextClassLoader(),
               new Class<?>[] {returnType},
-              FactoryInvocationHandler.getInstance(getClient(), this, null, null));
+              ComplexFactoryInvocationHandler.getInstance(getClient(), this, null, null));
     } else {
       final Class<?> returnType = method.getReturnType();
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java
index dcd7812..18c2ce2 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java
@@ -258,7 +258,7 @@ class EntitySetInvocationHandler<
         final CommonODataEntity entity = res.getBody();
 
         if (entity == null || !key.equals(CoreUtils.getKey(client, typeRef, entity))) {
-          throw new IllegalArgumentException("Invalid singleton " + typeRef.getSimpleName() + "(" + key + ")");
+          throw new IllegalArgumentException("Invalid " + typeRef.getSimpleName() + "(" + key + ")");
         }
 
         handler = EntityTypeInvocationHandler.getInstance(entity, this, typeRef);
@@ -268,7 +268,7 @@ class EntitySetInvocationHandler<
       }
     } else if (isDeleted(handler)) {
       // object deleted
-      LOG.debug("Object '{}({})' has been delete", typeRef.getSimpleName(), uuid);
+      LOG.debug("Object '{}({})' has been deleted", typeRef.getSimpleName(), uuid);
       handler = null;
     }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityTypeInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityTypeInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityTypeInvocationHandler.java
index 9e7db30..57b73d0 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityTypeInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityTypeInvocationHandler.java
@@ -39,7 +39,6 @@ import org.apache.olingo.commons.api.domain.CommonODataEntity;
 import org.apache.olingo.commons.api.domain.CommonODataProperty;
 import org.apache.olingo.commons.api.domain.ODataLinked;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.format.ODataMediaFormat;
 import org.apache.olingo.ext.proxy.api.annotations.EntityType;
 import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
@@ -126,11 +125,6 @@ public class EntityTypeInvocationHandler extends AbstractTypeInvocationHandler {
     return uuid;
   }
 
-  @Override
-  public FullQualifiedName getName() {
-    return getEntity().getTypeName();
-  }
-
   public String getEntityContainerName() {
     return uuid.getContainerName();
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/FactoryInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/FactoryInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/FactoryInvocationHandler.java
deleted file mode 100644
index a477ac0..0000000
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/FactoryInvocationHandler.java
+++ /dev/null
@@ -1,86 +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.ext.proxy.commons;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import org.apache.olingo.client.api.CommonEdmEnabledODataClient;
-import org.apache.olingo.ext.proxy.api.OperationExecutor;
-import org.apache.olingo.ext.proxy.api.annotations.Property;
-import org.apache.olingo.ext.proxy.utils.ClassUtils;
-
-class FactoryInvocationHandler extends AbstractInvocationHandler implements OperationExecutor {
-
-  private static final long serialVersionUID = 2629912294765040027L;
-
-  private final EntityTypeInvocationHandler entityHandler;
-
-  private final AbstractTypeInvocationHandler invokerHandler;
-
-  @SuppressWarnings({"rawtypes", "unchecked"})
-  static FactoryInvocationHandler getInstance(
-          final CommonEdmEnabledODataClient<?> client,
-          final EntityContainerInvocationHandler containerHandler,
-          final EntityTypeInvocationHandler entityHandler,
-          final AbstractTypeInvocationHandler targetHandler) {
-    return new FactoryInvocationHandler(client, containerHandler, entityHandler, targetHandler);
-  }
-
-  @SuppressWarnings({"rawtypes", "unchecked"})
-  static FactoryInvocationHandler getInstance(
-          final EntityTypeInvocationHandler entityHandler,
-          final AbstractTypeInvocationHandler targetHandler) {
-    return new FactoryInvocationHandler(
-            entityHandler == null ? null : entityHandler.containerHandler.client,
-            targetHandler == null
-            ? entityHandler == null ? null : entityHandler.containerHandler : targetHandler.containerHandler,
-            entityHandler,
-            targetHandler);
-  }
-
-  private FactoryInvocationHandler(
-          final CommonEdmEnabledODataClient<?> client,
-          final EntityContainerInvocationHandler containerHandler,
-          final EntityTypeInvocationHandler entityHandler,
-          final AbstractTypeInvocationHandler targetHandler) {
-    super(client, containerHandler);
-    this.invokerHandler = targetHandler;
-    this.entityHandler = entityHandler;
-  }
-
-  @Override
-  public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
-    if (isSelfMethod(method, args)) {
-      return invokeSelfMethod(method, args);
-    } else if (method.getName().startsWith("new")) {
-      final Method getter = proxy.getClass().getInterfaces()[0].getMethod(method.getName());
-      final Property property = ClassUtils.getAnnotation(Property.class, getter);
-      if (property == null) {
-        throw new UnsupportedOperationException("Unsupported method " + method.getName());
-      }
-
-      return Proxy.newProxyInstance(
-              Thread.currentThread().getContextClassLoader(),
-              new Class<?>[] {method.getReturnType()},
-              ComplexTypeInvocationHandler.getInstance(client, property.name(), method.getReturnType(), entityHandler));
-    } else {
-      throw new NoSuchMethodException(method.getName());
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java
index 9125f07..cda964e 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java
@@ -19,7 +19,6 @@
 package org.apache.olingo.ext.proxy.utils;
 
 import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -35,6 +34,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.client.api.CommonEdmEnabledODataClient;
 import org.apache.olingo.client.api.v3.UnsupportedInV3Exception;
 import org.apache.olingo.commons.api.Constants;
@@ -44,6 +44,7 @@ import org.apache.olingo.commons.api.domain.ODataLink;
 import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
 import org.apache.olingo.commons.api.domain.ODataValue;
 import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+import org.apache.olingo.commons.api.domain.v4.ODataObjectFactory;
 import org.apache.olingo.commons.api.domain.v4.ODataProperty;
 import org.apache.olingo.commons.api.edm.EdmElement;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
@@ -101,42 +102,35 @@ public final class CoreUtils {
           }
 
         } else {
-          throw new UnsupportedOperationException("Usupported object type " + intType.getFullQualifiedName());
+          throw new UnsupportedOperationException("Unsupported object type " + intType.getFullQualifiedName());
         }
       }
     } else if (type.isComplexType()) {
-      value = client.getObjectFactory().newComplexValue(type.getFullQualifiedName().toString());
-
-      final Object oo;
+      Object objHandler;
       if (obj instanceof Proxy) {
-        oo = Proxy.getInvocationHandler(obj);
+        objHandler = Proxy.getInvocationHandler(obj);
       } else {
-        oo = obj;
+        objHandler = obj;
       }
+      if (objHandler instanceof ComplexTypeInvocationHandler) {
+        value = ((ComplexTypeInvocationHandler) objHandler).getComplex();
 
-      if (oo instanceof ComplexTypeInvocationHandler) {
-        final Class<?> typeRef = ((ComplexTypeInvocationHandler) oo).getTypeRef();
-        final Object complex = Proxy.newProxyInstance(
-                Thread.currentThread().getContextClassLoader(),
-                new Class<?>[] {typeRef},
-                (ComplexTypeInvocationHandler) oo);
-
+        final Class<?> typeRef = ((ComplexTypeInvocationHandler) objHandler).getTypeRef();
         for (Method method : typeRef.getMethods()) {
-          final Property complexPropertyAnn = method.getAnnotation(Property.class);
-          try {
-            if (complexPropertyAnn != null) {
+          final Property propAnn = method.getAnnotation(Property.class);
+          if (propAnn != null) {
+            try {
               value.asComplex().add(getODataComplexProperty(
-                      client, type.getFullQualifiedName(), complexPropertyAnn.name(), method.invoke(complex)));
+                      client, type.getFullQualifiedName(), propAnn.name(), method.invoke(objHandler)));
+            } catch (Exception ignore) {
+              // ignore value
+              LOG.warn("Error attaching complex {} for field '{}.{}'",
+                      type.getFullQualifiedName(), typeRef.getName(), propAnn.name(), ignore);
             }
-          } catch (Exception ignore) {
-            // ignore value
-            LOG.warn("Error attaching complex {} for field '{}.{}'",
-                    type.getFullQualifiedName(), typeRef.getName(), complexPropertyAnn.name(), ignore);
           }
         }
       } else {
-        throw new IllegalArgumentException(
-                "Object '" + oo.getClass().getSimpleName() + "' is not a complex value");
+        throw new IllegalArgumentException(objHandler.getClass().getName() + "' is not a complex value");
       }
     } else if (type.isEnumType()) {
       if (client.getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0) {
@@ -227,8 +221,7 @@ public final class CoreUtils {
           if (client.getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0) {
             throw new UnsupportedInV3Exception();
           } else {
-            oprop = ((org.apache.olingo.commons.api.domain.v4.ODataObjectFactory) client.getObjectFactory()).
-                    newEnumProperty(name,
+            oprop = ((ODataObjectFactory) client.getObjectFactory()).newEnumProperty(name,
                     ((org.apache.olingo.commons.api.domain.v4.ODataValue) getODataValue(client, valueType, obj)).
                     asEnum());
           }
@@ -256,18 +249,17 @@ public final class CoreUtils {
       final String ns = typeRef.getAnnotation(Namespace.class).value();
       final String name = typeRef.getAnnotation(ComplexType.class).name();
       return edmTypeInfo.setTypeExpression(new FullQualifiedName(ns, name).toString()).build();
-    } else if(obj.getClass().getAnnotation(EnumType.class)!=null){
+    } else if (obj.getClass().getAnnotation(EnumType.class) != null) {
       final Class<?> typeRef = obj.getClass();
       final String ns = typeRef.getAnnotation(Namespace.class).value();
       final String name = typeRef.getAnnotation(EnumType.class).name();
       return edmTypeInfo.setTypeExpression(new FullQualifiedName(ns, name).toString()).build();
-    }else{
+    } else {
       return guessPrimitiveType(client, obj.getClass());
     }
   }
 
-  private static EdmTypeInfo guessPrimitiveType(
-          final CommonEdmEnabledODataClient<?> client, final Class<?> clazz) {
+  private static EdmTypeInfo guessPrimitiveType(final CommonEdmEnabledODataClient<?> client, final Class<?> clazz) {
     EdmPrimitiveTypeKind bckCandidate = null;
 
     for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
@@ -346,9 +338,9 @@ public final class CoreUtils {
   private static Class<?> getPropertyClass(final Class<?> entityClass, final String propertyName) {
     Class<?> propertyClass = null;
     try {
-      final Field field = entityClass.getField(propertyName);
-      if (field != null) {
-        propertyClass = field.getType();
+      final Method getter = entityClass.getMethod("get" + StringUtils.capitalize(propertyName));
+      if (getter != null) {
+        propertyClass = getter.getReturnType();
       }
     } catch (Exception e) {
       LOG.error("Could not determine the Java type of {}", propertyName, e);
@@ -434,7 +426,7 @@ public final class CoreUtils {
                       Thread.currentThread().getContextClassLoader(),
                       new Class<?>[] {getter.getReturnType()},
                       ComplexTypeInvocationHandler.getInstance(
-                      client, property.getName(), getter.getReturnType(), null));
+                              client, property.getName(), getter.getReturnType(), null));
 
               populate(client, complex, Property.class, property.getValue().asComplex().iterator());
               setPropertyValue(bean, getter, complex);
@@ -459,7 +451,7 @@ public final class CoreUtils {
                           Thread.currentThread().getContextClassLoader(),
                           new Class<?>[] {collItemClass},
                           ComplexTypeInvocationHandler.getInstance(
-                          client, property.getName(), collItemClass, null));
+                                  client, property.getName(), collItemClass, null));
 
                   populate(client, collItem, Property.class, value.asComplex().iterator());
                   collection.add(collItem);
@@ -498,17 +490,13 @@ public final class CoreUtils {
     if (property == null || property.hasNullValue()) {
       res = null;
     } else if (property.hasComplexValue()) {
-
-      if (typeRef == null) {
-        internalRef = getComplexTypeRef(property);
-      }
-
+      // complex types supports inheritance in V4, best to re-read actual type
+      internalRef = getComplexTypeRef(property);
       res = Proxy.newProxyInstance(
               Thread.currentThread().getContextClassLoader(),
               new Class<?>[] {internalRef},
               ComplexTypeInvocationHandler.getInstance(
-              client, property.getValue().asComplex(), internalRef, entityHandler));
-
+                      client, property.getValue().asComplex(), internalRef, entityHandler));
     } else if (property.hasCollectionValue()) {
       final ArrayList<Object> collection = new ArrayList<Object>();
 
@@ -518,11 +506,12 @@ public final class CoreUtils {
         if (value.isPrimitive()) {
           collection.add(CoreUtils.primitiveValueToObject(value.asPrimitive(), internalRef));
         } else if (value.isComplex()) {
+          internalRef = getComplexTypeRef(property);
           final Object collItem = Proxy.newProxyInstance(
                   Thread.currentThread().getContextClassLoader(),
                   new Class<?>[] {internalRef},
                   ComplexTypeInvocationHandler.getInstance(
-                  client, value.asComplex(), internalRef, entityHandler));
+                          client, value.asComplex(), internalRef, entityHandler));
 
           collection.add(collItem);
         }
@@ -553,6 +542,7 @@ public final class CoreUtils {
           final CommonODataProperty property,
           final String proxyClassListFile,
           final Class<? extends Annotation> annType) {
+
     if (!annType.isAssignableFrom(EnumType.class) && !annType.isAssignableFrom(ComplexType.class)) {
       throw new IllegalArgumentException("Invalid annotation type " + annType);
     }
@@ -568,10 +558,10 @@ public final class CoreUtils {
         final Namespace ns = clazz.getAnnotation(Namespace.class);
 
         if (ns != null && ann != null) {
-          if (property.getValue().getTypeName().equals(
+          if (property.getValue().getTypeName().replaceAll("^Collection\\(", "").replaceAll("\\)$", "").equals(
                   new FullQualifiedName(ns.value(), annType.isAssignableFrom(EnumType.class)
-                  ? EnumType.class.cast(ann).name()
-                  : ComplexType.class.cast(ann).name()).toString())) {
+                          ? EnumType.class.cast(ann).name()
+                          : ComplexType.class.cast(ann).name()).toString())) {
             return clazz;
           }
         }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/fit/src/test/java/org/apache/olingo/fit/proxy/v4/DerivedTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/DerivedTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/DerivedTypeTestITCase.java
new file mode 100644
index 0000000..8c48d98
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/DerivedTypeTestITCase.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.v4;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.Collections;
+import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address;
+import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyAddress;
+import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
+import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.
+        CustomerCollection;
+import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person;
+import org.junit.Test;
+
+public class DerivedTypeTestITCase extends AbstractTestITCase {
+
+  @Test
+  public void read() {
+    CustomerCollection customers = container.getPeople().getAll(CustomerCollection.class);
+    assertNotNull(customers);
+
+    for (Customer customer : customers) {
+      assertTrue(customer instanceof Customer);
+    }
+  }
+
+  @Test
+  public void createDelete() {
+    final Customer customer = container.getPeople().newCustomer();
+    customer.setPersonID(976);
+    customer.setFirstName("Test");
+    customer.setLastName("Test");
+
+    final Address homeAddress = container.complexFactory().newCompanyAddress();
+    homeAddress.setStreet("V.le Gabriele D'Annunzio");
+    homeAddress.setCity("Pescara");
+    homeAddress.setPostalCode("65127");
+    customer.setHomeAddress(homeAddress);
+
+    customer.setNumbers(Collections.<String>emptyList());
+    customer.setEmails(Collections.<String>emptyList());
+    customer.setCity("Pescara");
+
+    final Calendar birthday = Calendar.getInstance();
+    birthday.clear();
+    birthday.set(1977, 8, 8);
+    customer.setBirthday(birthday);
+
+    customer.setTimeBetweenLastTwoOrders(BigDecimal.valueOf(0.0000002));
+
+    container.flush();
+
+    final Person actual = container.getPeople().get(976, Customer.class);
+    assertTrue(actual instanceof Customer);
+    assertTrue(actual.getHomeAddress() instanceof CompanyAddress);
+
+    container.getPeople().delete(976);
+
+    container.flush();
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/fit/src/test/java/org/apache/olingo/fit/v4/DerivedTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/DerivedTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/DerivedTypeTestITCase.java
index c594183..9063c9b 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v4/DerivedTypeTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v4/DerivedTypeTestITCase.java
@@ -105,10 +105,10 @@ public class DerivedTypeTestITCase extends AbstractTestITCase {
             client.getObjectFactory().newPrimitiveValueBuilder().buildString("Pescara")));
     customer.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Birthday",
             client.getObjectFactory().newPrimitiveValueBuilder().
-                    setType(EdmPrimitiveTypeKind.DateTimeOffset).setText("1977-09-08T00:00:00Z").build()));
+            setType(EdmPrimitiveTypeKind.DateTimeOffset).setText("1977-09-08T00:00:00Z").build()));
     customer.getProperties().add(client.getObjectFactory().newPrimitiveProperty("TimeBetweenLastTwoOrders",
             client.getObjectFactory().newPrimitiveValueBuilder().
-                    setType(EdmPrimitiveTypeKind.Duration).setText("PT0.0000002S").build()));
+            setType(EdmPrimitiveTypeKind.Duration).setText("PT0.0000002S").build()));
 
     final ODataEntityCreateRequest<ODataEntity> createReq = client.getCUDRequestFactory().
             getEntityCreateRequest(
@@ -120,14 +120,15 @@ public class DerivedTypeTestITCase extends AbstractTestITCase {
     assertEquals(201, createRes.getStatusCode());
 
     final ODataEntityRequest<ODataEntity> fetchReq = client.getRetrieveRequestFactory().
-            getEntityRequest(createRes.getBody().getEditLink());
+            getEntityRequest(client.getURIBuilder(testStaticServiceRootURL).
+                    appendEntitySetSegment("People").appendKeySegment(976).build());
     fetchReq.setFormat(format);
 
     final ODataEntity actual = fetchReq.execute().getBody();
     assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", actual.getTypeName().toString());
     assertEquals("Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress",
-            ((ODataValuable)actual.getProperty("HomeAddress")).getValue().getTypeName());
-    
+            ((ODataValuable) actual.getProperty("HomeAddress")).getValue().getTypeName());
+
     final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().getDeleteRequest(actual.getEditLink());
     assertEquals(204, deleteReq.execute().getStatusCode());
   }
@@ -141,5 +142,4 @@ public class DerivedTypeTestITCase extends AbstractTestITCase {
   public void createDeleteAsJSON() {
     createDelete(ODataPubFormat.JSON_FULL_METADATA);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataBatchRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataBatchRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataBatchRequestImpl.java
index bcbeeda..497a4e8 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataBatchRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/batch/v4/ODataBatchRequestImpl.java
@@ -36,7 +36,6 @@ import org.apache.olingo.client.core.communication.request.batch.AbstractBatchSt
 import org.apache.olingo.client.core.communication.request.batch.AbstractODataBatchRequest;
 import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
 import org.apache.olingo.client.core.communication.response.batch.ODataBatchResponseManager;
-import org.apache.olingo.commons.api.format.ContentType;
 
 /**
  * This class implements a batch request.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index 4566eb6..fad13e6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -459,7 +459,11 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
         typeInfo = new EdmTypeInfo.Builder().setTypeExpression(propertyType).build();
       }
     } else {
-      typeInfo = new EdmTypeInfo.Builder().setTypeExpression(typeName.toString()).build();
+      if (propertyType == null || propertyType.equals(EdmPrimitiveTypeKind.String.getFullQualifiedName().toString())) {
+        typeInfo = new EdmTypeInfo.Builder().setTypeExpression(typeName.toString()).build();
+      } else {
+        typeInfo = new EdmTypeInfo.Builder().setTypeExpression(propertyType).build();
+      }
     }
     return typeInfo;
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
index c245498..4738dde 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
@@ -237,7 +237,7 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
           fqn = typeInfo.getPrimitiveTypeKind().getFullQualifiedName();
         }
       }
-      
+
       final ODataAnnotation odataAnnotation = new ODataAnnotationImpl(annotation.getTerm(),
               (org.apache.olingo.commons.api.domain.v4.ODataValue) getODataValue(fqn, annotation, null, null));
       odataAnnotatable.getAnnotations().add(odataAnnotation);
@@ -283,7 +283,7 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
   @Override
   public ODataProperty getODataProperty(final ResWrap<Property> resource) {
     final EdmTypeInfo typeInfo = buildTypeInfo(resource.getContextURL(), resource.getMetadataETag(),
-            resource.getPayload().getName(), resource.getPayload().getType());
+              resource.getPayload().getName(), resource.getPayload().getType());
 
     final ODataProperty property = new ODataPropertyImpl(resource.getPayload().getName(),
             getODataValue(typeInfo == null ? null : typeInfo.getFullQualifiedName(),

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/EdmEnabledODataClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/EdmEnabledODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/EdmEnabledODataClientImpl.java
index fc0282b..b852ba6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/EdmEnabledODataClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/EdmEnabledODataClientImpl.java
@@ -45,7 +45,7 @@ public class EdmEnabledODataClientImpl extends ODataClientImpl implements EdmEna
   }
 
   @Override
-  public final Edm getEdm(final String metadataETag) {
+  public Edm getEdm(final String metadataETag) {
     synchronized (this) {
       if (this.metadataETag != null && !this.metadataETag.equals(metadataETag)) {
         final EdmMetadataRequest metadataReq = getRetrieveRequestFactory().getMetadataRequest(serviceRoot);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
index 04a5c96..27666c0 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
@@ -30,7 +30,7 @@ public abstract class AbstractTest {
 
   protected static org.apache.olingo.client.api.v4.ODataClient v4Client;
 
-  protected abstract CommonODataClient getClient();
+  protected abstract CommonODataClient<?> getClient();
 
   @BeforeClass
   public static void setUp() {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
index 8c61a50..e1b212a 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
@@ -26,6 +26,7 @@ import static org.junit.Assert.assertTrue;
 import java.io.InputStream;
 import java.net.URI;
 import java.util.Iterator;
+import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
 import org.apache.olingo.client.api.v4.ODataClient;
 import org.apache.olingo.client.core.AbstractTest;
 import org.apache.olingo.commons.api.data.Entity;
@@ -37,7 +38,9 @@ import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
 import org.apache.olingo.commons.api.domain.v4.ODataEntity;
 import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
 import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataValuable;
 import org.apache.olingo.commons.api.domain.v4.ODataValue;
+import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.format.ODataPubFormat;
 import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
@@ -52,6 +55,27 @@ public class EntityTest extends AbstractTest {
     return v4Client;
   }
 
+  private EdmEnabledODataClient getEdmEnabledClient() {
+    return new EdmEnabledODataClientImpl(null) {
+
+      private Edm edm;
+
+      @Override
+      public Edm getEdm(final String metadataETag) {
+        return getCachedEdm();
+      }
+
+      @Override
+      public Edm getCachedEdm() {
+        if (edm == null) {
+          edm = getReader().readMetadata(getClass().getResourceAsStream("staticservice-metadata.xml"));
+        }
+        return edm;
+      }
+
+    };
+  }
+
   private void singleton(final ODataPubFormat format) {
     final InputStream input = getClass().getResourceAsStream("VipCustomer." + getSuffix(format));
     final ODataEntity entity = getClient().getBinder().getODataEntity(
@@ -334,4 +358,28 @@ public class EntityTest extends AbstractTest {
     complexNavigationProperties(ODataPubFormat.JSON);
   }
 
+  private void derived(final ODataClient client, final ODataPubFormat format) {
+    final InputStream input = getClass().getResourceAsStream("Customer." + getSuffix(format));
+    final ODataEntity entity = client.getBinder().getODataEntity(client.getDeserializer().toEntity(input, format));
+    assertNotNull(entity);
+
+    assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
+    assertEquals("Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress",
+            ((ODataValuable) entity.getProperty("HomeAddress")).getValue().getTypeName());
+  }
+
+  @Test
+  public void derivedFromAtom() {
+    derived(getClient(), ODataPubFormat.ATOM);
+  }
+
+  @Test
+  public void derivedFromJSON() {
+    derived(getEdmEnabledClient(), ODataPubFormat.JSON);
+  }
+
+  @Test
+  public void derivedFromFullJSON() {
+    derived(getClient(), ODataPubFormat.JSON_FULL_METADATA);
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customer.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customer.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customer.json
new file mode 100644
index 0000000..938297c
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customer.json
@@ -0,0 +1,37 @@
+{
+  "@odata.context": "http://localhost:9080/stub/StaticService/V40/Static.svc/$metadata#People/$entity",
+  "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Customer",
+  "PersonID@odata.type": "Int32",
+  "PersonID": 976,
+  "FirstName@odata.type": "String",
+  "FirstName": "Test",
+  "LastName@odata.type": "String",
+  "LastName": "Test",
+  "HomeAddress": {
+    "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress",
+    "Street@odata.type": "String",
+    "Street": "V.le Gabriele D'Annunzio",
+    "City@odata.type": "String",
+    "City": "Pescara",
+    "PostalCode@odata.type": "String",
+    "PostalCode": "65127",
+    "CompanyName@odata.type": "String",
+    "CompanyName": "Tirasa"
+  },
+  "Numbers@odata.type": "#Collection(String)",
+  "Numbers": [],
+  "Emails@odata.type": "#Collection(String)",
+  "Emails": [],
+  "City@odata.type": "String",
+  "City": "Pescara",
+  "Birthday@odata.type": "DateTimeOffset",
+  "Birthday": "1977-09-08T02:00:00+02:00",
+  "TimeBetweenLastTwoOrders@odata.type": "Duration",
+  "TimeBetweenLastTwoOrders": "PT0.0000002S",
+  "MiddleName@odata.type": "String",
+  "MiddleName": null,
+  "Home@odata.type": "String",
+  "Home": null,
+  "@odata.editLink": "http://localhost:9080/stub/StaticService/V40/Static.svc/People(976)",
+  "Parent@odata.navigationLink": "People(976)/Parent"
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customer.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customer.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customer.xml
new file mode 100644
index 0000000..f012a4d
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customer.xml
@@ -0,0 +1,46 @@
+<?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.
+
+-->
+<entry xmlns="http://www.w3.org/2005/Atom" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:gml="http://www.opengis.net/gml" xmlns:georss="http://www.georss.org/georss" m:context="http://localhost:9080/stub/StaticService/V40/Static.svc/$metadata#People/$entity" xml:base="http://localhost:9080/stub/StaticService/V40/Static.svc/">
+  <category scheme="http://docs.oasis-open.org/odata/ns/scheme" term="#Microsoft.Test.OData.Services.ODataWCFService.Customer"/>
+  <link rel="edit" title="People" href="http://localhost:9080/stub/StaticService/V40/Static.svc/People(976)"/>
+  <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" title="Parent" href="People(976)/Parent" type="application/atom+xml;type=entry"/>
+  <content type="application/xml">
+    <m:properties>
+      <d:PersonID m:type="Int32">976</d:PersonID>
+      <d:FirstName>Test</d:FirstName>
+      <d:LastName>Test</d:LastName>
+      <d:HomeAddress m:type="#Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress">
+        <d:Street>V.le Gabriele D'Annunzio</d:Street>
+        <d:City>Pescara</d:City>
+        <d:PostalCode>65127</d:PostalCode>
+        <d:CompanyName>Tirasa</d:CompanyName>
+      </d:HomeAddress>
+      <d:Numbers m:type="#Collection(String)"/>
+      <d:Emails m:type="#Collection(String)"/>
+      <d:City>Pescara</d:City>
+      <d:Birthday m:type="DateTimeOffset">1977-09-08T02:00:00+02:00</d:Birthday>
+      <d:TimeBetweenLastTwoOrders m:type="Duration">PT0.0000002S</d:TimeBetweenLastTwoOrders>
+      <d:MiddleName m:null="true"/>
+      <d:Home m:null="true"/>
+    </m:properties>
+  </content>
+</entry>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/staticservice-metadata.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/staticservice-metadata.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/staticservice-metadata.xml
new file mode 100644
index 0000000..4bb360c
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/staticservice-metadata.xml
@@ -0,0 +1,462 @@
+<?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.
+
+-->
+<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
+  <edmx:DataServices>
+    <Schema Namespace="Microsoft.Test.OData.Services.ODataWCFService" xmlns="http://docs.oasis-open.org/odata/ns/edm">
+      <Term Name="IsBoss" Type="Edm.Boolean"/>
+      <ComplexType Name="Address">
+        <Property Name="Street" Type="Edm.String" Nullable="false"/>
+        <Property Name="City" Type="Edm.String" Nullable="false"/>
+        <Property Name="PostalCode" Type="Edm.String" Nullable="false"/>
+      </ComplexType>
+      <ComplexType Name="HomeAddress" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Address">
+        <Property Name="FamilyName" Type="Edm.String"/>
+      </ComplexType>
+      <ComplexType Name="CompanyAddress" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Address">
+        <Property Name="CompanyName" Type="Edm.String" Nullable="false"/>
+      </ComplexType>
+      <EnumType Name="AccessLevel" IsFlags="true">
+        <Member Name="None" Value="0"/>
+        <Member Name="Read" Value="1"/>
+        <Member Name="Write" Value="2"/>
+        <Member Name="Execute" Value="4"/>
+        <Member Name="ReadWrite" Value="3"/>
+      </EnumType>
+      <EnumType Name="Color">
+        <Member Name="Red" Value="1"/>
+        <Member Name="Green" Value="2"/>
+        <Member Name="Blue" Value="4"/>
+      </EnumType>
+      <EnumType Name="CompanyCategory">
+        <Member Name="IT" Value="0"/>
+        <Member Name="Communication" Value="1"/>
+        <Member Name="Electronics" Value="2"/>
+        <Member Name="Others" Value="4"/>
+      </EnumType>
+      <EntityType Name="Person">
+        <Key>
+          <PropertyRef Name="PersonID"/>
+        </Key>
+        <Property Name="PersonID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="FirstName" Type="Edm.String" Nullable="false"/>
+        <Property Name="LastName" Type="Edm.String" Nullable="false"/>
+        <Property Name="MiddleName" Type="Edm.String"/>
+        <Property Name="HomeAddress" Type="Microsoft.Test.OData.Services.ODataWCFService.Address"/>
+        <Property Name="Home" Type="Edm.GeographyPoint" SRID="4326"/>
+        <Property Name="Numbers" Type="Collection(Edm.String)" Nullable="false"/>
+        <Property Name="Emails" Type="Collection(Edm.String)"/>
+        <NavigationProperty Name="Parent" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
+      </EntityType>
+      <EntityType Name="Customer" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Person">
+        <Property Name="City" Type="Edm.String" Nullable="false"/>
+        <Property Name="Birthday" Type="Edm.DateTimeOffset" Nullable="false"/>
+        <Property Name="TimeBetweenLastTwoOrders" Type="Edm.Duration" Nullable="false"/>
+        <NavigationProperty Name="Orders" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Order)"/>
+        <NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="VipCustomer"/>
+      </EntityType>
+      <EntityType Name="Employee" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Person">
+        <Property Name="DateHired" Type="Edm.DateTimeOffset" Nullable="false"/>
+        <Property Name="Office" Type="Edm.GeographyPoint" SRID="4326"/>
+        <NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Employees"/>
+      </EntityType>
+      <EntityType Name="Product">
+        <Key>
+          <PropertyRef Name="ProductID"/>
+        </Key>
+        <Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="Name" Type="Edm.String" Nullable="false"/>
+        <Property Name="QuantityPerUnit" Type="Edm.String" Nullable="false"/>
+        <Property Name="UnitPrice" Type="Edm.Single" Nullable="false"/>
+        <Property Name="QuantityInStock" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="Discontinued" Type="Edm.Boolean" Nullable="false"/>
+        <Property Name="UserAccess" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel"/>
+        <Property Name="SkinColor" Type="Microsoft.Test.OData.Services.ODataWCFService.Color"/>
+        <Property Name="CoverColors" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)" Nullable="false"/>
+        <NavigationProperty Name="Details" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)">
+          <ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID"/>
+        </NavigationProperty>
+      </EntityType>
+      <EntityType Name="ProductDetail">
+        <Key>
+          <PropertyRef Name="ProductID"/>
+          <PropertyRef Name="ProductDetailID"/>
+        </Key>
+        <Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="ProductName" Type="Edm.String" Nullable="false"/>
+        <Property Name="Description" Type="Edm.String" Nullable="false"/>
+        <NavigationProperty Name="RelatedProduct" Type="Microsoft.Test.OData.Services.ODataWCFService.Product"/>
+        <NavigationProperty Name="Reviews" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductReview)">
+          <ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID"/>
+          <ReferentialConstraint Property="ProductDetailID" ReferencedProperty="ProductDetailID"/>
+        </NavigationProperty>
+      </EntityType>
+      <EntityType Name="ProductReview">
+        <Key>
+          <PropertyRef Name="ProductID"/>
+          <PropertyRef Name="ProductDetailID"/>
+          <PropertyRef Name="ReviewTitle"/>
+          <PropertyRef Name="RevisionID"/>
+        </Key>
+        <Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="ReviewTitle" Type="Edm.String" Nullable="false"/>
+        <Property Name="RevisionID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="Comment" Type="Edm.String" Nullable="false"/>
+        <Property Name="Author" Type="Edm.String" Nullable="false"/>
+      </EntityType>
+      <EntityType Name="Order">
+        <Key>
+          <PropertyRef Name="OrderID"/>
+        </Key>
+        <Property Name="OrderID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="OrderDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+        <Property Name="ShelfLife" Type="Edm.Duration"/>
+        <Property Name="OrderShelfLifes" Type="Collection(Edm.Duration)"/>
+        <NavigationProperty Name="LoggedInEmployee" Type="Microsoft.Test.OData.Services.ODataWCFService.Employee" Nullable="false"/>
+        <NavigationProperty Name="CustomerForOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false"/>
+        <NavigationProperty Name="OrderDetails" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.OrderDetail)"/>
+      </EntityType>
+      <EntityType Name="OrderDetail">
+        <Key>
+          <PropertyRef Name="OrderID"/>
+          <PropertyRef Name="ProductID"/>
+        </Key>
+        <Property Name="OrderID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="OrderPlaced" Type="Edm.DateTimeOffset" Nullable="false"/>
+        <Property Name="Quantity" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="UnitPrice" Type="Edm.Single" Nullable="false"/>
+        <NavigationProperty Name="ProductOrdered" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)"/>
+        <NavigationProperty Name="AssociatedOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Order" Nullable="false"/>
+      </EntityType>
+      <EntityType Name="Department">
+        <Key>
+          <PropertyRef Name="DepartmentID"/>
+        </Key>
+        <Property Name="DepartmentID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="Name" Type="Edm.String" Nullable="false"/>
+        <Property Name="DepartmentNO" Type="Edm.String"/>
+        <NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Departments"/>
+      </EntityType>
+      <EntityType Name="Company" OpenType="true">
+        <Key>
+          <PropertyRef Name="CompanyID"/>
+        </Key>
+        <Property Name="CompanyID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="CompanyCategory" Type="Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory"/>
+        <Property Name="Revenue" Type="Edm.Int64" Nullable="false"/>
+        <Property Name="Name" Type="Edm.String"/>
+        <Property Name="Address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address"/>
+        <NavigationProperty Name="Employees" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Employee)" Partner="Company"/>
+        <NavigationProperty Name="VipCustomer" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false" Partner="Company"/>
+        <NavigationProperty Name="Departments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Department)" Partner="Company"/>
+        <NavigationProperty Name="CoreDepartment" Type="Microsoft.Test.OData.Services.ODataWCFService.Department" Nullable="false"/>
+      </EntityType>
+      <EntityType Name="PublicCompany" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Company" OpenType="true">
+        <Property Name="StockExchange" Type="Edm.String"/>
+        <NavigationProperty Name="Assets" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Asset)" ContainsTarget="true"/>
+        <NavigationProperty Name="Club" Type="Microsoft.Test.OData.Services.ODataWCFService.Club" Nullable="false" ContainsTarget="true"/>
+        <NavigationProperty Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion" Nullable="false"/>
+      </EntityType>
+      <EntityType Name="Asset">
+        <Key>
+          <PropertyRef Name="AssetID"/>
+        </Key>
+        <Property Name="AssetID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="Name" Type="Edm.String"/>
+        <Property Name="Number" Type="Edm.Int32" Nullable="false"/>
+      </EntityType>
+      <EntityType Name="Club">
+        <Key>
+          <PropertyRef Name="ClubID"/>
+        </Key>
+        <Property Name="ClubID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="Name" Type="Edm.String"/>
+      </EntityType>
+      <EntityType Name="LabourUnion">
+        <Key>
+          <PropertyRef Name="LabourUnionID"/>
+        </Key>
+        <Property Name="LabourUnionID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="Name" Type="Edm.String"/>
+      </EntityType>
+      <Action Name="AddAccessRight" IsBound="true">
+        <Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false"/>
+        <Parameter Name="accessRight" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel"/>
+      </Action>
+      <Action Name="IncreaseRevenue" IsBound="true">
+        <Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false"/>
+        <Parameter Name="IncreaseValue" Type="Edm.Int64"/>
+        <ReturnType Type="Edm.Int64" Nullable="false"/>
+      </Action>
+      <Action Name="ResetAddress" IsBound="true" EntitySetPath="person">
+        <Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
+        <Parameter Name="addresses" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Address)" Nullable="false"/>
+        <Parameter Name="index" Type="Edm.Int32" Nullable="false"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
+      </Action>
+      <Action Name="Discount" IsBound="true" EntitySetPath="products">
+        <Parameter Name="products" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false"/>
+        <Parameter Name="percentage" Type="Edm.Int32" Nullable="false"/>
+        <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false"/>
+      </Action>
+      <Action Name="Discount">
+        <Parameter Name="percentage" Type="Edm.Int32" Nullable="false"/>
+      </Action>
+      <Action Name="ResetBossEmail">
+        <Parameter Name="emails" Type="Collection(Edm.String)" Nullable="false"/>
+        <ReturnType Type="Collection(Edm.String)" Nullable="false"/>
+      </Action>
+      <Action Name="ResetBossAddress">
+        <Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false"/>
+      </Action>
+      <Action Name="ResetDataSource"/>
+      <Function Name="GetEmployeesCount" IsBound="true">
+        <Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false"/>
+        <ReturnType Type="Edm.Int32" Nullable="false"/>
+      </Function>
+      <Function Name="GetProductDetails" IsBound="true" EntitySetPath="product/Details" IsComposable="true">
+        <Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false"/>
+        <Parameter Name="count" Type="Edm.Int32"/>
+        <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)" Nullable="false"/>
+      </Function>
+      <Function Name="GetRelatedProduct" IsBound="true" EntitySetPath="productDetail/RelatedProduct" IsComposable="true">
+        <Parameter Name="productDetail" Type="Microsoft.Test.OData.Services.ODataWCFService.ProductDetail" Nullable="false"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false"/>
+      </Function>
+      <Function Name="GetDefaultColor" IsComposable="true">
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Color"/>
+      </Function>
+      <Function Name="GetPerson" IsComposable="true">
+        <Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
+      </Function>
+      <Function Name="GetPerson2" IsComposable="true">
+        <Parameter Name="city" Type="Edm.String" Nullable="false"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
+      </Function>
+      <Function Name="GetAllProducts" IsComposable="true">
+        <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false"/>
+      </Function>
+      <Function Name="GetBossEmails">
+        <Parameter Name="start" Type="Edm.Int32" Nullable="false"/>
+        <Parameter Name="count" Type="Edm.Int32" Nullable="false"/>
+        <ReturnType Type="Collection(Edm.String)" Nullable="false"/>
+      </Function>
+      <Function Name="GetProductsByAccessLevel">
+        <Parameter Name="accessLevel" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" Nullable="false"/>
+        <ReturnType Type="Collection(Edm.String)" Nullable="false"/>
+      </Function>
+      <Function Name="GetActualAmount" IsBound="true">
+        <Parameter Name="giftcard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" Nullable="false"/>
+        <Parameter Name="bonusRate" Type="Edm.Double"/>
+        <ReturnType Type="Edm.Double" Nullable="false"/>
+      </Function>
+      <Function Name="GetDefaultPI" IsBound="true" EntitySetPath="account/MyPaymentInstruments">
+        <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument"/>
+      </Function>
+      <Action Name="RefreshDefaultPI" IsBound="true" EntitySetPath="account/MyPaymentInstruments">
+        <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false"/>
+        <Parameter Name="newDate" Type="Edm.DateTimeOffset"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument"/>
+      </Action>
+      <Function Name="GetHomeAddress" IsBound="true" IsComposable="true">
+        <Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.HomeAddress" Nullable="false"/>
+      </Function>
+      <Function Name="GetAccountInfo" IsBound="true" IsComposable="true">
+        <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false"/>
+        <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo" Nullable="false"/>
+      </Function>
+      <ComplexType Name="AccountInfo" OpenType="true">
+        <Property Name="FirstName" Type="Edm.String" Nullable="false"/>
+        <Property Name="LastName" Type="Edm.String" Nullable="false"/>
+      </ComplexType>
+      <EntityType Name="Account">
+        <Key>
+          <PropertyRef Name="AccountID"/>
+        </Key>
+        <Property Name="AccountID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="Country" Type="Edm.String" Nullable="false"/>
+        <Property Name="AccountInfo" Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo"/>
+        <NavigationProperty Name="MyGiftCard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" ContainsTarget="true"/>
+        <NavigationProperty Name="MyPaymentInstruments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument)" ContainsTarget="true"/>
+        <NavigationProperty Name="ActiveSubscriptions" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)" ContainsTarget="true"/>
+        <NavigationProperty Name="AvailableSubscriptionTemplatess" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)"/>
+      </EntityType>
+      <EntityType Name="GiftCard">
+        <Key>
+          <PropertyRef Name="GiftCardID"/>
+        </Key>
+        <Property Name="GiftCardID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="GiftCardNO" Type="Edm.String" Nullable="false"/>
+        <Property Name="Amount" Type="Edm.Double" Nullable="false"/>
+        <Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+        <Property Name="OwnerName" Type="Edm.String"/>
+      </EntityType>
+      <EntityType Name="PaymentInstrument">
+        <Key>
+          <PropertyRef Name="PaymentInstrumentID"/>
+        </Key>
+        <Property Name="PaymentInstrumentID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="FriendlyName" Type="Edm.String" Nullable="false"/>
+        <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+        <NavigationProperty Name="TheStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false"/>
+        <NavigationProperty Name="BillingStatements" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Statement)" ContainsTarget="true"/>
+        <NavigationProperty Name="BackupStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false"/>
+      </EntityType>
+      <EntityType Name="CreditCardPI" BaseType="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument">
+        <Property Name="CardNumber" Type="Edm.String" Nullable="false"/>
+        <Property Name="CVV" Type="Edm.String" Nullable="false"/>
+        <Property Name="HolderName" Type="Edm.String" Nullable="false"/>
+        <Property Name="Balance" Type="Edm.Double" Nullable="false"/>
+        <Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+        <NavigationProperty Name="CreditRecords" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.CreditRecord)" ContainsTarget="true"/>
+      </EntityType>
+      <EntityType Name="StoredPI">
+        <Key>
+          <PropertyRef Name="StoredPIID"/>
+        </Key>
+        <Property Name="StoredPIID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="PIName" Type="Edm.String" Nullable="false"/>
+        <Property Name="PIType" Type="Edm.String" Nullable="false"/>
+        <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+      </EntityType>
+      <EntityType Name="Statement">
+        <Key>
+          <PropertyRef Name="StatementID"/>
+        </Key>
+        <Property Name="StatementID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="TransactionType" Type="Edm.String" Nullable="false"/>
+        <Property Name="TransactionDescription" Type="Edm.String" Nullable="false"/>
+        <Property Name="Amount" Type="Edm.Double" Nullable="false"/>
+      </EntityType>
+      <EntityType Name="CreditRecord">
+        <Key>
+          <PropertyRef Name="CreditRecordID"/>
+        </Key>
+        <Property Name="CreditRecordID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="IsGood" Type="Edm.Boolean" Nullable="false"/>
+        <Property Name="Reason" Type="Edm.String" Nullable="false"/>
+        <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+      </EntityType>
+      <EntityType Name="Subscription">
+        <Key>
+          <PropertyRef Name="SubscriptionID"/>
+        </Key>
+        <Property Name="SubscriptionID" Type="Edm.Int32" Nullable="false"/>
+        <Property Name="TemplateGuid" Type="Edm.String" Nullable="false"/>
+        <Property Name="Title" Type="Edm.String" Nullable="false"/>
+        <Property Name="Category" Type="Edm.String" Nullable="false"/>
+        <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+      </EntityType>
+      <EntityContainer Name="InMemoryEntities">
+        <EntitySet Name="People" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Person">
+          <NavigationPropertyBinding Path="Parent" Target="People"/>
+        </EntitySet>
+        <Singleton Name="Boss" Type="Microsoft.Test.OData.Services.ODataWCFService.Person">
+          <NavigationPropertyBinding Path="Parent" Target="People"/>
+        </Singleton>
+        <EntitySet Name="Customers" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Customer">
+          <NavigationPropertyBinding Path="Orders" Target="Orders"/>
+          <NavigationPropertyBinding Path="Parent" Target="People"/>
+        </EntitySet>
+        <Singleton Name="VipCustomer" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer">
+          <NavigationPropertyBinding Path="Orders" Target="Orders"/>
+          <NavigationPropertyBinding Path="Parent" Target="People"/>
+          <NavigationPropertyBinding Path="Company" Target="Company"/>
+        </Singleton>
+        <EntitySet Name="Employees" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Employee">
+          <NavigationPropertyBinding Path="Parent" Target="People"/>
+          <NavigationPropertyBinding Path="Company" Target="Company"/>
+        </EntitySet>
+        <EntitySet Name="Products" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Product">
+          <NavigationPropertyBinding Path="Details" Target="ProductDetails"/>
+        </EntitySet>
+        <EntitySet Name="ProductDetails" EntityType="Microsoft.Test.OData.Services.ODataWCFService.ProductDetail">
+          <NavigationPropertyBinding Path="RelatedProduct" Target="Products"/>
+          <NavigationPropertyBinding Path="Reviews" Target="ProductReviews"/>
+        </EntitySet>
+        <EntitySet Name="ProductReviews" EntityType="Microsoft.Test.OData.Services.ODataWCFService.ProductReview"/>
+        <EntitySet Name="Orders" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Order">
+          <NavigationPropertyBinding Path="LoggedInEmployee" Target="Employees"/>
+          <NavigationPropertyBinding Path="CustomerForOrder" Target="Customers"/>
+          <NavigationPropertyBinding Path="OrderDetails" Target="OrderDetails"/>
+          <Annotation Term="Core.ChangeTracking">
+            <Record>
+              <PropertyValue Property="Supported" Bool="true"/>
+              <PropertyValue Property="FilterableProperties">
+                <Collection>
+                  <PropertyPath>OrderID</PropertyPath>
+                </Collection>
+              </PropertyValue>
+              <PropertyValue Property="ExpandableProperties">
+                <Collection>
+                  <PropertyPath>OrderDetails</PropertyPath>
+                </Collection>
+              </PropertyValue>
+            </Record>
+          </Annotation>
+        </EntitySet>
+        <EntitySet Name="OrderDetails" EntityType="Microsoft.Test.OData.Services.ODataWCFService.OrderDetail">
+          <NavigationPropertyBinding Path="AssociatedOrder" Target="Orders"/>
+          <NavigationPropertyBinding Path="ProductOrdered" Target="Products"/>
+        </EntitySet>
+        <EntitySet Name="Departments" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Department">
+          <NavigationPropertyBinding Path="Company" Target="Company"/>
+        </EntitySet>
+        <Singleton Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company">
+          <NavigationPropertyBinding Path="Employees" Target="Employees"/>
+          <NavigationPropertyBinding Path="VipCustomer" Target="VipCustomer"/>
+          <NavigationPropertyBinding Path="Departments" Target="Departments"/>
+          <NavigationPropertyBinding Path="CoreDepartment" Target="Departments"/>
+        </Singleton>
+        <Singleton Name="PublicCompany" Type="Microsoft.Test.OData.Services.ODataWCFService.Company">
+          <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PublicCompany/LabourUnion" Target="LabourUnion"/>
+        </Singleton>
+        <Singleton Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion"/>
+        <ActionImport Name="Discount" Action="Microsoft.Test.OData.Services.ODataWCFService.Discount"/>
+        <ActionImport Name="ResetBossEmail" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossEmail"/>
+        <ActionImport Name="ResetBossAddress" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossAddress"/>
+        <ActionImport Name="ResetDataSource" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetDataSource"/>
+        <FunctionImport Name="GetDefaultColor" Function="Microsoft.Test.OData.Services.ODataWCFService.GetDefaultColor" IncludeInServiceDocument="true"/>
+        <FunctionImport Name="GetPerson" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson" EntitySet="People" IncludeInServiceDocument="true"/>
+        <FunctionImport Name="GetPerson2" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson2" EntitySet="People" IncludeInServiceDocument="true"/>
+        <FunctionImport Name="GetAllProducts" Function="Microsoft.Test.OData.Services.ODataWCFService.GetAllProducts" EntitySet="Products" IncludeInServiceDocument="true"/>
+        <FunctionImport Name="GetBossEmails" Function="Microsoft.Test.OData.Services.ODataWCFService.GetBossEmails" IncludeInServiceDocument="true"/>
+        <FunctionImport Name="GetProductsByAccessLevel" Function="Microsoft.Test.OData.Services.ODataWCFService.GetProductsByAccessLevel" IncludeInServiceDocument="true"/>
+        <EntitySet Name="Accounts" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Account">
+          <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/TheStoredPI" Target="StoredPIs"/>
+          <NavigationPropertyBinding Path="AvailableSubscriptionTemplatess" Target="SubscriptionTemplates"/>
+          <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/BackupStoredPI" Target="DefaultStoredPI"/>
+        </EntitySet>
+        <EntitySet Name="StoredPIs" EntityType="Microsoft.Test.OData.Services.ODataWCFService.StoredPI"/>
+        <EntitySet Name="SubscriptionTemplates" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Subscription"/>
+        <Singleton Name="DefaultStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI"/>
+      </EntityContainer>
+    </Schema>
+  </edmx:DataServices>
+</edmx:Edmx>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataAnnotationImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataAnnotationImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataAnnotationImpl.java
index 0814cc0..c0d29d2 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataAnnotationImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataAnnotationImpl.java
@@ -99,4 +99,11 @@ public class ODataAnnotationImpl implements ODataAnnotation {
     return valuable.getEnumValue();
   }
 
+  @Override
+  public String toString() {
+    return "ODataPropertyImpl{"
+            + "term=" + term
+            + ",valuable=" + valuable
+            + '}';
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96c45510/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
index 35962e4..c6fdecb 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
@@ -77,4 +77,14 @@ public class ODataPropertyImpl extends AbstractODataProperty implements ODataPro
   public List<ODataAnnotation> getAnnotations() {
     return annotations;
   }
+
+  @Override
+  public String toString() {
+    return "ODataPropertyImpl{"
+            + "name=" + getName()
+            + ",valuable=" + valuable
+            + ", annotations=" + annotations
+            + '}';
+  }
+
 }


Mime
View raw message