You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by fm...@apache.org on 2014/03/14 10:11:17 UTC

git commit: [OLINGO-175, OLINGO-205] provided failsafe plugin to start to import integration test from ODataJClient

Repository: incubator-olingo-odata4
Updated Branches:
  refs/heads/olingo200 70f065789 -> da3742acb


[OLINGO-175, OLINGO-205] provided failsafe plugin to start to import integration test from ODataJClient


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

Branch: refs/heads/olingo200
Commit: da3742acb343cb8007d2e3c97ea84b79fea1a3bb
Parents: 70f0657
Author: fmartelli <fa...@gmail.com>
Authored: Fri Mar 14 10:11:02 2014 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Fri Mar 14 10:11:02 2014 +0100

----------------------------------------------------------------------
 ODataJClient/engine/pom.xml                     |   2 +-
 fit/pom.xml                                     |  43 +-
 .../java/org/apache/olingo/fit/V3Services.java  |   2 +-
 .../java/org/apache/olingo/fit/V4Services.java  |   2 +-
 fit/src/main/resources/esigate.properties       |   3 +-
 .../request/retrieve/ODataMetadataRequest.java  |   4 +-
 lib/client-core/pom.xml                         |  53 +-
 .../retrieve/ODataMetadataRequestImpl.java      |  13 +-
 .../core/it/AbstractMetadataTestITCase.java     |  30 +
 .../client/core/it/AbstractTestITCase.java      | 569 +++++++++++++++++++
 .../client/core/it/v3/MetadataTestITCase.java   |  41 ++
 pom.xml                                         |  73 ++-
 12 files changed, 777 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/da3742ac/ODataJClient/engine/pom.xml
----------------------------------------------------------------------
diff --git a/ODataJClient/engine/pom.xml b/ODataJClient/engine/pom.xml
index 35eb3a5..d19de08 100644
--- a/ODataJClient/engine/pom.xml
+++ b/ODataJClient/engine/pom.xml
@@ -177,7 +177,7 @@
         </dependency>
       </dependencies>
       
-      <build>                    
+      <build>             
         <testResources>
           <testResource>
             <directory>src/test/resources</directory>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/da3742ac/fit/pom.xml
----------------------------------------------------------------------
diff --git a/fit/pom.xml b/fit/pom.xml
index f4578c2..cac0eca 100644
--- a/fit/pom.xml
+++ b/fit/pom.xml
@@ -36,32 +36,10 @@
   
   <properties>
     <main.basedir>${project.parent.basedir}</main.basedir>
-    
-    <log.directory>${project.build.directory}/log</log.directory>
-        
     <war.maven.plugin.version>2.4</war.maven.plugin.version>
-    
-    <cargo.maven.plugin.version>1.4.7</cargo.maven.plugin.version>
-    <cargo.servlet.port>9080</cargo.servlet.port>
-    <cargo.tomcat.ajp.port>9889</cargo.tomcat.ajp.port>
-    <cargo.rmi.port>9805</cargo.rmi.port>
-    <cargo.log>${log.directory}/cargo.log</cargo.log>
-    <cargo.output>${log.directory}/cargo-output.log</cargo.output>
-    <tomcat.version>7.0.50</tomcat.version>
   </properties>
 	
   <dependencies>
-    <dependency>
-      <groupId>org.apache.olingo</groupId>
-      <artifactId>olingo-server-core-incubating</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.olingo</groupId>
-      <artifactId>olingo-client-core-incubating</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-    
     <!-- Stax -->
     <dependency>
       <groupId>stax</groupId>
@@ -147,28 +125,9 @@
       <plugin>
         <groupId>org.codehaus.cargo</groupId>
         <artifactId>cargo-maven2-plugin</artifactId>
-        <version>${cargo.maven.plugin.version}</version>
+        <inherited>true</inherited>
         <configuration>
-          <container>
-            <containerId>tomcat7x</containerId>
-            <zipUrlInstaller>
-              <url>http://archive.apache.org/dist/tomcat/tomcat-7/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip</url>
-              <downloadDir>${settings.localRepository}/org/codehaus/cargo/cargo-container-archives</downloadDir>
-              <extractDir>${project.build.directory}/cargo/extract</extractDir>
-            </zipUrlInstaller>
-            <log>${cargo.log}</log>
-            <output>${cargo.output}</output>
-          </container>
           <configuration>
-            <type>standalone</type>
-            <properties>
-              <cargo.servlet.port>${cargo.servlet.port}</cargo.servlet.port>
-              <cargo.tomcat.ajp.port>${cargo.tomcat.ajp.port}</cargo.tomcat.ajp.port>
-              <cargo.rmi.port>${cargo.rmi.port}</cargo.rmi.port>
-
-              <!--<cargo.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n</cargo.jvmargs>-->
-              <cargo.jvmargs>-noverify -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=256m</cargo.jvmargs>
-            </properties>
             <files>
               <file>
                 <file>${project.build.directory}/classes/esigate.properties</file>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/da3742ac/fit/src/main/java/org/apache/olingo/fit/V3Services.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V3Services.java b/fit/src/main/java/org/apache/olingo/fit/V3Services.java
index 7b4ca56..11eaa81 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V3Services.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V3Services.java
@@ -23,7 +23,7 @@ import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
 import javax.ws.rs.Path;
 import org.apache.cxf.interceptor.InInterceptors;
 
-@Path("/V3/Static.svc")
+@Path("/V30/Static.svc")
 @InInterceptors(classes = XHTTPMethodInterceptor.class)
 public class V3Services extends AbstractServices {
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/da3742ac/fit/src/main/java/org/apache/olingo/fit/V4Services.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4Services.java b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
index 8906c63..3fc5ddc 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4Services.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
@@ -23,7 +23,7 @@ import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
 import javax.ws.rs.Path;
 import org.apache.cxf.interceptor.InInterceptors;
 
-@Path("/V4/Static.svc")
+@Path("/V40/Static.svc")
 @InInterceptors(classes = XHTTPMethodInterceptor.class)
 public class V4Services extends AbstractServices {
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/da3742ac/fit/src/main/resources/esigate.properties
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/esigate.properties b/fit/src/main/resources/esigate.properties
index 9c4b4a1..491d401 100644
--- a/fit/src/main/resources/esigate.properties
+++ b/fit/src/main/resources/esigate.properties
@@ -17,8 +17,7 @@
 # under the License.
 #
 
-#webapp.remoteUrlBase=${test.base.url}/DefaultService.svc/
-webapp.remoteUrlBase=http://localhost:${cargo.servlet.port}/StaticService/V3/Static.svc/
+webapp.remoteUrlBase=http://localhost:${cargo.servlet.port}/StaticService/V30/Static.svc/
 visibleUrlBase=http://localhost:${cargo.servlet.port}/DefaultService.svc/
 useCache=true
 extensions=org.apache.olingo.fit.rproxy.LinkRewrite

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/da3742ac/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMetadataRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMetadataRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMetadataRequest.java
index 1a1f6b0..c87e449 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMetadataRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMetadataRequest.java
@@ -18,11 +18,11 @@
  */
 package org.apache.olingo.client.api.communication.request.retrieve;
 
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
 import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.edm.Edm;
 
 /**
  * This class implements a metadata query request.
  */
-public interface ODataMetadataRequest extends ODataRetrieveRequest<XMLMetadata, ODataPubFormat> {
+public interface ODataMetadataRequest extends ODataRetrieveRequest<Edm, ODataPubFormat> {
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/da3742ac/lib/client-core/pom.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/pom.xml b/lib/client-core/pom.xml
index f5d21e4..2705261 100644
--- a/lib/client-core/pom.xml
+++ b/lib/client-core/pom.xml
@@ -74,6 +74,57 @@
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-all</artifactId>
-    </dependency>    
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.olingo</groupId>
+      <artifactId>olingo-fit-incubating</artifactId>
+      <version>${project.version}</version>
+      <type>war</type>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <inherited>true</inherited>
+      </plugin>
+      
+      <plugin>
+        <groupId>org.codehaus.cargo</groupId>
+        <artifactId>cargo-maven2-plugin</artifactId>
+        <inherited>true</inherited>
+        <executions>
+          <execution>
+            <id>start-container</id>
+            <phase>pre-integration-test</phase>
+            <goals>
+              <goal>start</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>stop-container</id>
+            <phase>post-integration-test</phase>
+            <goals>
+              <goal>stop</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+    
+    <testResources>
+      <testResource>
+        <directory>src/test/resources</directory>
+        <filtering>false</filtering>
+      </testResource>
+      <testResource>
+        <directory>${basedir}/../../fit/src/main/resources</directory>
+        <filtering>true</filtering>
+      </testResource>
+    </testResources>
+  </build>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/da3742ac/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java
index b51b715..7d2df29 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java
@@ -26,13 +26,13 @@ import org.apache.olingo.client.api.ODataClient;
 import org.apache.olingo.client.api.communication.request.ODataRequest;
 import org.apache.olingo.client.api.communication.request.retrieve.ODataMetadataRequest;
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
 import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.edm.Edm;
 
 /**
  * This class implements a metadata query request.
  */
-class ODataMetadataRequestImpl extends AbstractODataRetrieveRequest<XMLMetadata, ODataPubFormat>
+class ODataMetadataRequestImpl extends AbstractODataRetrieveRequest<Edm, ODataPubFormat>
         implements ODataMetadataRequest {
 
   /**
@@ -60,7 +60,7 @@ class ODataMetadataRequestImpl extends AbstractODataRetrieveRequest<XMLMetadata,
   }
 
   @Override
-  public ODataRetrieveResponse<XMLMetadata> execute() {
+  public ODataRetrieveResponse<Edm> execute() {
     final HttpResponse res = doExecute();
     return new ODataMetadataResponseImpl(httpClient, res);
   }
@@ -70,7 +70,7 @@ class ODataMetadataRequestImpl extends AbstractODataRetrieveRequest<XMLMetadata,
    */
   protected class ODataMetadataResponseImpl extends ODataRetrieveResponseImpl {
 
-    private XMLMetadata metadata = null;
+    private Edm metadata = null;
 
     /**
      * Constructor.
@@ -94,11 +94,10 @@ class ODataMetadataRequestImpl extends AbstractODataRetrieveRequest<XMLMetadata,
      * {@inheritDoc }
      */
     @Override
-    @SuppressWarnings("unchecked")
-    public XMLMetadata getBody() {
+    public Edm getBody() {
       if (metadata == null) {
         try {
-          metadata = (XMLMetadata) odataClient.getReader().readMetadata(getRawResponse());
+          metadata = odataClient.getReader().readMetadata(getRawResponse());
         } finally {
           this.close();
         }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/da3742ac/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
new file mode 100644
index 0000000..181068a
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
@@ -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.
+ */
+package org.apache.olingo.client.core.it;
+
+import org.apache.olingo.client.api.ODataClient;
+
+public abstract class AbstractMetadataTestITCase extends AbstractTestITCase {
+
+  protected abstract ODataClient getClient();
+
+  protected String getTestServiceRoot() {
+    return "http://localhost:9080/StaticService/" + getClient().getServiceVersion().name() + "/Static.svc";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/da3742ac/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
new file mode 100644
index 0000000..bd7c5ec
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
@@ -0,0 +1,569 @@
+/*
+ * 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.client.core.it;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.ODataV3Client;
+import org.apache.olingo.client.api.communication.ODataClientErrorException;
+import org.apache.olingo.client.api.communication.request.UpdateType;
+import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
+import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
+import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
+import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
+import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.data.Entry;
+import org.apache.olingo.client.api.data.Feed;
+import org.apache.olingo.client.api.domain.ODataCollectionValue;
+import org.apache.olingo.client.api.domain.ODataComplexValue;
+import org.apache.olingo.client.api.domain.ODataEntity;
+import org.apache.olingo.client.api.domain.ODataEntitySet;
+import org.apache.olingo.client.api.domain.ODataInlineEntity;
+import org.apache.olingo.client.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.client.api.domain.ODataJClientEdmPrimitiveType;
+import org.apache.olingo.client.api.domain.ODataLink;
+import org.apache.olingo.client.api.domain.ODataProperty;
+import org.apache.olingo.client.api.domain.ODataValue;
+import org.apache.olingo.client.api.format.ODataPubFormat;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.client.core.data.AtomEntryImpl;
+import org.apache.olingo.client.core.data.JSONEntryImpl;
+import org.junit.BeforeClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractTestITCase {
+
+  /**
+   * Logger.
+   */
+  protected static final Logger LOG = LoggerFactory.getLogger(AbstractTestITCase.class);
+
+  protected static final String TEST_PRODUCT_TYPE = "Microsoft.Test.OData.Services.AstoriaDefaultService.Product";
+
+  protected static final String servicesODataServiceRootURL =
+          "http://services.odata.org/V3/(S(csquyjnoaywmz5xcdbfhlc1p))/OData/OData.svc/";
+
+  protected static ODataV3Client client;
+
+  protected static String testStaticServiceRootURL;
+
+  protected static String testLargeModelServiceRootURL;
+
+  protected static String testAuthServiceRootURL;
+
+  @BeforeClass
+  public static void setUpODataServiceRoot() throws IOException {
+    testStaticServiceRootURL = "http://localhost:9080/StaticService/V3/Static.svc";
+    testLargeModelServiceRootURL = "http://localhost:9080/StaticService/V3/Static.svc/large";
+    testAuthServiceRootURL = "http://localhost:9080/DefaultService.svc";
+  }
+
+  /**
+   * This is needed for correct number handling (Double, for example).
+   */
+  @BeforeClass
+  public static void setEnglishLocale() {
+    Locale.setDefault(Locale.ENGLISH);
+  }
+
+  @BeforeClass
+  public static void setClientInstance() {
+    client = ODataClientFactory.getV3();
+  }
+
+  protected void checkLinks(final Collection<ODataLink> original, final Collection<ODataLink> actual) {
+    assertTrue(original.size() <= actual.size());
+
+    for (ODataLink originalLink : original) {
+      ODataLink foundOriginal = null;
+      ODataLink foundActual = null;
+
+      for (ODataLink actualLink : actual) {
+
+        if (actualLink.getType() == originalLink.getType()
+                && (originalLink.getLink() == null
+                || actualLink.getLink().toASCIIString().endsWith(originalLink.getLink().toASCIIString()))
+                && actualLink.getName().equals(originalLink.getName())) {
+
+          foundOriginal = originalLink;
+          foundActual = actualLink;
+        }
+      }
+
+      assertNotNull(foundOriginal);
+      assertNotNull(foundActual);
+
+      if (foundOriginal instanceof ODataInlineEntity && foundActual instanceof ODataInlineEntity) {
+        final ODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity();
+        assertNotNull(originalInline);
+
+        final ODataEntity actualInline = ((ODataInlineEntity) foundActual).getEntity();
+        assertNotNull(actualInline);
+
+        checkProperties(originalInline.getProperties(), actualInline.getProperties());
+      }
+    }
+  }
+
+  protected void checkProperties(final Collection<ODataProperty> original, final Collection<ODataProperty> actual) {
+    assertTrue(original.size() <= actual.size());
+
+    // re-organize actual properties into a Map<String, ODataProperty>
+    final Map<String, ODataProperty> actualProps = new HashMap<String, ODataProperty>(actual.size());
+
+    for (ODataProperty prop : actual) {
+      assertFalse(actualProps.containsKey(prop.getName()));
+      actualProps.put(prop.getName(), prop);
+    }
+
+    assertTrue(actual.size() <= actualProps.size());
+
+    for (ODataProperty prop : original) {
+      assertNotNull(prop);
+      if (actualProps.containsKey(prop.getName())) {
+        final ODataProperty actualProp = actualProps.get(prop.getName());
+        assertNotNull(actualProp);
+
+        if (prop.getValue() != null && actualProp.getValue() != null) {
+          checkPropertyValue(prop.getName(), prop.getValue(), actualProp.getValue());
+        }
+      } else {
+        // nothing ... maybe :FC_KeepInContent="false"
+        // ..... no assert can be done ....
+      }
+    }
+  }
+
+  protected void checkPropertyValue(final String propertyName,
+          final ODataValue original, final ODataValue actual) {
+
+    assertNotNull("Null original value for " + propertyName, original);
+    assertNotNull("Null actual value for " + propertyName, actual);
+
+    assertEquals("Type mismatch for '" + propertyName + "': "
+            + original.getClass().getSimpleName() + "-" + actual.getClass().getSimpleName(),
+            original.getClass().getSimpleName(), actual.getClass().getSimpleName());
+
+    if (original.isComplex()) {
+      final List<ODataProperty> originalFileds = new ArrayList<ODataProperty>();
+      for (ODataProperty prop : original.asComplex()) {
+        originalFileds.add(prop);
+      }
+
+      final List<ODataProperty> actualFileds = new ArrayList<ODataProperty>();
+      for (ODataProperty prop : (ODataComplexValue) actual) {
+        actualFileds.add(prop);
+      }
+
+      checkProperties(originalFileds, actualFileds);
+    } else if (original.isCollection()) {
+      assertTrue(original.asCollection().size() <= actual.asCollection().size());
+
+      boolean found = original.asCollection().isEmpty();
+
+      for (ODataValue originalValue : original.asCollection()) {
+        for (ODataValue actualValue : actual.asCollection()) {
+          try {
+            checkPropertyValue(propertyName, originalValue, actualValue);
+            found = true;
+          } catch (AssertionError ignore) {
+            // ignore
+          }
+        }
+      }
+
+      assertTrue("Found " + actual + " but expected " + original, found);
+    } else {
+      assertTrue("Primitive value for '" + propertyName + "' type mismatch: " + original.asPrimitive().
+              getTypeName() + "-" + actual.asPrimitive().getTypeName(),
+              original.asPrimitive().getTypeName().equals(actual.asPrimitive().getTypeName()));
+
+      assertEquals("Primitive value for '" + propertyName + "' mismatch: " + original.asPrimitive().toString()
+              + "-" + actual.asPrimitive().toString(),
+              original.asPrimitive().toString(), actual.asPrimitive().toString());
+    }
+  }
+
+  protected ODataEntity getSampleCustomerInfo(final int id, final String sampleinfo) {
+    final ODataEntity entity =
+            client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo");
+    entity.setMediaEntity(true);
+
+    entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Information",
+            client.getPrimitiveValueBuilder().setText(sampleinfo).setType(
+            ODataJClientEdmPrimitiveType.String).build()));
+
+    return entity;
+  }
+
+  protected ODataEntity getSampleCustomerProfile(
+          final int id, final String sampleName, final boolean withInlineInfo) {
+
+    final ODataEntity entity =
+            client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
+
+    // add name attribute
+    entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Name",
+            client.getPrimitiveValueBuilder().setText(sampleName).setType(
+            ODataJClientEdmPrimitiveType.String).build()));
+
+    // add key attribute
+    entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
+            client.getPrimitiveValueBuilder().setText(String.valueOf(id)).setType(
+            ODataJClientEdmPrimitiveType.Int32).build()));
+
+    // add BackupContactInfo attribute (collection)
+    final ODataCollectionValue backupContactInfoValue = new ODataCollectionValue(
+            "Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
+    entity.getProperties().add(client.getObjectFactory().newCollectionProperty("BackupContactInfo",
+            backupContactInfoValue));
+
+    // add BackupContactInfo.ContactDetails attribute (complex)
+    final ODataComplexValue contactDetails = new ODataComplexValue(
+            "Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails");
+    backupContactInfoValue.add(contactDetails);
+
+    // add BackupContactInfo.ContactDetails.AlternativeNames attribute (collection)
+    final ODataCollectionValue altNamesValue = new ODataCollectionValue("Collection(Edm.String)");
+    altNamesValue.add(client.getPrimitiveValueBuilder().
+            setText("myname").setType(ODataJClientEdmPrimitiveType.String).build());
+    contactDetails.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
+
+    // add BackupContactInfo.ContactDetails.EmailBag attribute (collection)
+    final ODataCollectionValue emailBagValue = new ODataCollectionValue("Collection(Edm.String)");
+    emailBagValue.add(client.getPrimitiveValueBuilder().
+            setText("myname@mydomain.com").setType(ODataJClientEdmPrimitiveType.String).build());
+    contactDetails.add(client.getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
+
+    // add BackupContactInfo.ContactDetails.ContactAlias attribute (complex)
+    final ODataComplexValue contactAliasValue = new ODataComplexValue(
+            "Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases");
+    contactDetails.add(client.getObjectFactory().newComplexProperty("ContactAlias", contactAliasValue));
+
+    // add BackupContactInfo.ContactDetails.ContactAlias.AlternativeNames attribute (collection)
+    final ODataCollectionValue aliasAltNamesValue = new ODataCollectionValue("Collection(Edm.String)");
+    aliasAltNamesValue.add(client.getPrimitiveValueBuilder().
+            setText("myAlternativeName").setType(ODataJClientEdmPrimitiveType.String).build());
+    contactAliasValue.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
+
+    if (withInlineInfo) {
+      final ODataInlineEntity inlineInfo = client.getObjectFactory().newInlineEntity(
+              "Info",
+              URI.create("Customer(" + id + ")/Info"),
+              getSampleCustomerInfo(id, sampleName + "_Info"));
+      inlineInfo.getEntity().setMediaEntity(true);
+      entity.addLink(inlineInfo);
+    }
+
+    return entity;
+  }
+
+  protected void debugEntry(final Entry entry, final String message) {
+    if (LOG.isDebugEnabled()) {
+      final StringWriter writer = new StringWriter();
+      client.getSerializer().entry(entry, writer);
+      writer.flush();
+      LOG.debug(message + "\n{}", writer.toString());
+    }
+  }
+
+  protected void debugFeed(final Feed feed, final String message) {
+    if (LOG.isDebugEnabled()) {
+      final StringWriter writer = new StringWriter();
+      client.getSerializer().feed(feed, writer);
+      writer.flush();
+      LOG.debug(message + "\n{}", writer.toString());
+    }
+  }
+
+  protected void debugODataProperty(final ODataProperty property, final String message) {
+    LOG.debug(message + "\n{}", property.toString());
+  }
+
+  protected void debugODataValue(final ODataValue value, final String message) {
+    LOG.debug(message + "\n{}", value.toString());
+  }
+
+  protected void debugODataEntity(final ODataEntity entity, final String message) {
+    if (LOG.isDebugEnabled()) {
+      StringWriter writer = new StringWriter();
+      client.getSerializer().entry(client.getBinder().getEntry(entity, AtomEntryImpl.class), writer);
+      writer.flush();
+      LOG.debug(message + " (Atom)\n{}", writer.toString());
+
+      writer = new StringWriter();
+      client.getSerializer().entry(client.getBinder().getEntry(entity, JSONEntryImpl.class), writer);
+      writer.flush();
+      LOG.debug(message + " (JSON)\n{}", writer.toString());
+    }
+  }
+
+  protected void debugInputStream(final InputStream input, final String message) {
+    if (LOG.isDebugEnabled()) {
+      try {
+        LOG.debug(message + "\n{}", IOUtils.toString(input));
+      } catch (IOException e) {
+        LOG.error("Error writing stream", e);
+      } finally {
+        IOUtils.closeQuietly(input);
+      }
+    }
+  }
+
+  protected String getETag(final URI uri) {
+    final ODataRetrieveResponse<ODataEntity> res = client.getRetrieveRequestFactory().
+            getEntityRequest(uri).execute();
+    try {
+      return res.getEtag();
+    } finally {
+      res.close();
+    }
+  }
+
+  protected ODataEntity read(final ODataPubFormat format, final URI editLink) {
+    final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(editLink);
+    req.setFormat(format);
+
+    final ODataRetrieveResponse<ODataEntity> res = req.execute();
+    final ODataEntity entity = res.getBody();
+
+    assertNotNull(entity);
+
+    if (ODataPubFormat.JSON_FULL_METADATA == format || ODataPubFormat.ATOM == format) {
+      assertEquals(req.getURI(), entity.getEditLink());
+    }
+
+    return entity;
+  }
+
+  protected ODataEntity createEntity(
+          final String serviceRootURL,
+          final ODataPubFormat format,
+          final ODataEntity original,
+          final String entitySetName) {
+
+    final URIBuilder<?> uriBuilder = client.getURIBuilder(serviceRootURL);
+    uriBuilder.appendEntitySetSegment(entitySetName);
+
+    debugODataEntity(original, "About to create");
+
+    final ODataEntityCreateRequest createReq =
+            client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original);
+    createReq.setFormat(format);
+
+    final ODataEntityCreateResponse createRes = createReq.execute();
+    assertEquals(201, createRes.getStatusCode());
+    assertEquals("Created", createRes.getStatusMessage());
+
+    final ODataEntity created = createRes.getBody();
+    assertNotNull(created);
+
+    debugODataEntity(created, "Just created");
+
+    return created;
+  }
+
+  protected ODataEntity compareEntities(final String serviceRootURL,
+          final ODataPubFormat format,
+          final ODataEntity original,
+          final int actualObjectId,
+          final Collection<String> expands) {
+
+    final URIBuilder<?> uriBuilder = client.getURIBuilder(serviceRootURL).
+            appendEntitySetSegment("Customer").appendKeySegment(actualObjectId);
+
+    // search expanded
+    if (expands != null) {
+      for (String expand : expands) {
+        uriBuilder.expand(expand);
+      }
+    }
+
+    final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+    req.setFormat(format);
+
+    final ODataRetrieveResponse<ODataEntity> res = req.execute();
+    assertEquals(200, res.getStatusCode());
+
+    final ODataEntity actual = res.getBody();
+    assertNotNull(actual);
+
+    // check defined links
+    checkLinks(original.getAssociationLinks(), actual.getAssociationLinks());
+    checkLinks(original.getEditMediaLinks(), actual.getEditMediaLinks());
+    checkLinks(original.getNavigationLinks(), actual.getNavigationLinks());
+
+    // check defined properties equality
+    checkProperties(original.getProperties(), actual.getProperties());
+
+    return actual;
+  }
+
+  protected void cleanAfterCreate(
+          final ODataPubFormat format,
+          final ODataEntity created,
+          final boolean includeInline,
+          final String baseUri) {
+
+    final Set<URI> toBeDeleted = new HashSet<URI>();
+    toBeDeleted.add(created.getEditLink());
+
+    if (includeInline) {
+      for (ODataLink link : created.getNavigationLinks()) {
+        if (link instanceof ODataInlineEntity) {
+          final ODataEntity inline = ((ODataInlineEntity) link).getEntity();
+          if (inline.getEditLink() != null) {
+            toBeDeleted.add(URIUtils.getURI(baseUri, inline.getEditLink().toASCIIString()));
+          }
+        }
+
+        if (link instanceof ODataInlineEntitySet) {
+          final ODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
+          for (ODataEntity entity : inline.getEntities()) {
+            if (entity.getEditLink() != null) {
+              toBeDeleted.add(URIUtils.getURI(baseUri, entity.getEditLink().toASCIIString()));
+            }
+          }
+        }
+      }
+    }
+
+    assertFalse(toBeDeleted.isEmpty());
+
+    for (URI link : toBeDeleted) {
+      final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().getDeleteRequest(link);
+      final ODataDeleteResponse deleteRes = deleteReq.execute();
+
+      assertEquals(204, deleteRes.getStatusCode());
+      assertEquals("No Content", deleteRes.getStatusMessage());
+
+      deleteRes.close();
+
+      final ODataEntityRequest retrieveReq = client.getRetrieveRequestFactory().getEntityRequest(link);
+      // bug that needs to be fixed on the SampleService - cannot get entity not found with header
+      // Accept: application/json;odata=minimalmetadata
+      retrieveReq.setFormat(format == ODataPubFormat.JSON_FULL_METADATA ? ODataPubFormat.JSON : format);
+
+      Exception exception = null;
+      try {
+        retrieveReq.execute();
+        fail();
+      } catch (ODataClientErrorException e) {
+        exception = e;
+        assertEquals(404, e.getStatusLine().getStatusCode());
+      }
+      assertNotNull(exception);
+    }
+  }
+
+  protected void updateEntityDescription(
+          final ODataPubFormat format, final ODataEntity changes, final UpdateType type) {
+
+    updateEntityDescription(format, changes, type, null);
+  }
+
+  protected void updateEntityDescription(
+          final ODataPubFormat format, final ODataEntity changes, final UpdateType type, final String etag) {
+
+    updateEntityStringProperty("Description", format, changes, type, etag);
+  }
+
+  protected void updateEntityStringProperty(final String propertyName,
+          final ODataPubFormat format, final ODataEntity changes, final UpdateType type, final String etag) {
+
+    final URI editLink = changes.getEditLink();
+
+    final String newm = "New " + propertyName + "(" + System.currentTimeMillis() + ")";
+
+    ODataProperty propertyValue = changes.getProperty(propertyName);
+
+    final String oldm;
+    if (propertyValue == null) {
+      oldm = null;
+    } else {
+      oldm = propertyValue.getValue().toString();
+      changes.getProperties().remove(propertyValue);
+    }
+
+    assertNotEquals(newm, oldm);
+
+    changes.getProperties().add(client.getObjectFactory().newPrimitiveProperty(propertyName,
+            client.getPrimitiveValueBuilder().setText(newm).build()));
+
+    update(type, changes, format, etag);
+
+    final ODataEntity actual = read(format, editLink);
+
+    propertyValue = null;
+
+    for (ODataProperty prop : actual.getProperties()) {
+      if (prop.getName().equals(propertyName)) {
+        propertyValue = prop;
+      }
+    }
+
+    assertNotNull(propertyValue);
+    assertEquals(newm, propertyValue.getValue().toString());
+  }
+
+  protected void update(
+          final UpdateType type, final ODataEntity changes, final ODataPubFormat format, final String etag) {
+    final ODataEntityUpdateRequest req = client.getCUDRequestFactory().getEntityUpdateRequest(type, changes);
+
+    if (client.getConfiguration().isUseXHTTPMethod()) {
+      assertEquals(HttpMethod.POST, req.getMethod());
+    } else {
+      assertEquals(type.getMethod(), req.getMethod());
+    }
+    req.setFormat(format);
+
+    if (StringUtils.isNotBlank(etag)) {
+      req.setIfMatch(etag); // Product include ETag header into the response .....
+    }
+
+    final ODataEntityUpdateResponse res = req.execute();
+    assertEquals(204, res.getStatusCode());
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/da3742ac/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MetadataTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MetadataTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MetadataTestITCase.java
new file mode 100644
index 0000000..7bcbda6
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MetadataTestITCase.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.it.v3;
+
+import org.apache.olingo.client.api.ODataV3Client;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.client.core.it.AbstractMetadataTestITCase;
+import org.apache.olingo.commons.api.edm.Edm;
+import static org.junit.Assert.assertNotNull;
+import org.junit.Test;
+
+public class MetadataTestITCase extends AbstractMetadataTestITCase {
+
+  @Override
+  protected ODataV3Client getClient() {
+    return ODataClientFactory.getV3();
+  }
+
+  @Test
+  public void retrieve() {
+    final Edm metadata = getClient().getRetrieveRequestFactory().
+            getMetadataRequest(getTestServiceRoot()).execute().getBody();
+    assertNotNull(metadata);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/da3742ac/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e036104..85743c3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -79,7 +79,16 @@
 
     <antlr.version>4.1</antlr.version>
 	
-    <sl4j.version>1.7.6</sl4j.version>    
+    <sl4j.version>1.7.6</sl4j.version> 
+    
+    <log.directory>${project.build.directory}/log</log.directory>
+    
+    <cargo.servlet.port>9080</cargo.servlet.port>
+    <cargo.tomcat.ajp.port>9889</cargo.tomcat.ajp.port>
+    <cargo.rmi.port>9805</cargo.rmi.port>
+    <cargo.log>${log.directory}/cargo.log</cargo.log>
+    <cargo.output>${log.directory}/cargo-output.log</cargo.output>
+    <tomcat.version>7.0.50</tomcat.version>   
   </properties>
 
   <dependencyManagement>
@@ -220,8 +229,70 @@
           <artifactId>maven-eclipse-plugin</artifactId>
           <version>2.9</version>
         </plugin>
+        
+        <plugin>
+          <groupId>org.codehaus.cargo</groupId>
+          <artifactId>cargo-maven2-plugin</artifactId>
+          <version>1.4.7</version>
+          <configuration>
+            <container>
+              <containerId>tomcat7x</containerId>
+              <zipUrlInstaller>
+                <url>http://archive.apache.org/dist/tomcat/tomcat-7/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip</url>
+                <downloadDir>${settings.localRepository}/org/codehaus/cargo/cargo-container-archives</downloadDir>
+                <extractDir>${project.build.directory}/cargo/extract</extractDir>
+              </zipUrlInstaller>
+              <log>${cargo.log}</log>
+              <output>${cargo.output}</output>
+            </container>
+            
+            <configuration>
+              <type>standalone</type>
+              <properties>
+                <cargo.servlet.port>${cargo.servlet.port}</cargo.servlet.port>
+                <cargo.tomcat.ajp.port>${cargo.tomcat.ajp.port}</cargo.tomcat.ajp.port>
+                <cargo.rmi.port>${cargo.rmi.port}</cargo.rmi.port>
+
+                <!--<cargo.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n</cargo.jvmargs>-->
+                <cargo.jvmargs>-noverify -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=256m</cargo.jvmargs>
+              </properties>
+            </configuration>
+            <deployables>
+              <deployable>
+                <groupId>org.apache.olingo</groupId>
+                <artifactId>olingo-fit-incubating</artifactId>
+                <type>war</type>
+                <properties>
+                  <context>/</context>
+                </properties>
+              </deployable>
+            </deployables>
+          </configuration>
+        </plugin>
+        
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-failsafe-plugin</artifactId>
+          <version>2.16</version>
+          <configuration>
+            <redirectTestOutputToFile>true</redirectTestOutputToFile>
+            <encoding>utf-8</encoding>
+            <runOrder>alphabetical</runOrder>
+          </configuration>
+          <executions>
+            <execution>
+              <id>integration-test</id>
+              <goals>
+                <goal>integration-test</goal>
+                <goal>verify</goal>
+              </goals>
+            </execution>
+          </executions>
+        </plugin>
+
       </plugins>
     </pluginManagement>
+    
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>