You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2015/08/21 14:04:07 UTC

[7/8] olingo-odata4 git commit: [OLINGO-431] Delete unnecessary v4 in package name

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/752bfad3/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIBuilderTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIBuilderTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIBuilderTest.java
new file mode 100644
index 0000000..6f8a363
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIBuilderTest.java
@@ -0,0 +1,244 @@
+/*
+ * 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.uri;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.uri.QueryOption;
+import org.apache.olingo.client.api.uri.URIBuilder;
+import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.client.core.uri.ParameterAlias;
+import org.junit.Test;
+
+public class URIBuilderTest extends AbstractTest {
+
+  private static final String SERVICE_ROOT = "http://host/service";
+
+  @Override
+  protected ODataClient getClient() {
+    return v4Client;
+  }
+
+  @Test
+  public void metadata() throws URISyntaxException {
+    final URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendMetadataSegment().build();
+
+    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/$metadata").build(), uri);
+  }
+
+  @Test
+  public void entity() throws URISyntaxException {
+    final URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("AnEntitySet").
+        appendKeySegment(11).build();
+
+    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/AnEntitySet(11)").build(), uri);
+
+    final Map<String, Object> multiKey = new LinkedHashMap<String, Object>();
+    multiKey.put("OrderId", -10);
+    multiKey.put("ProductId", -10);
+    URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+        appendEntitySetSegment("OrderLine").appendKeySegment(multiKey).
+        appendPropertySegment("Quantity").appendValueSegment();
+
+    assertEquals(new org.apache.http.client.utils.URIBuilder(
+        SERVICE_ROOT + "/OrderLine(OrderId=-10,ProductId=-10)/Quantity/$value").build(), uriBuilder.build());
+
+    uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+        appendEntitySetSegment("Customer").appendKeySegment(-10).
+        select("CustomerId", "Name", "Orders").expand("Orders");
+    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Customer(-10)").
+        addParameter("$select", "CustomerId,Name,Orders").addParameter("$expand", "Orders").build(),
+        uriBuilder.build());
+
+    uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+        appendEntitySetSegment("Customer").appendKeySegment(-10).appendNavigationSegment("Orders").appendRefSegment();
+    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Customer(-10)/Orders/$ref").build(),
+        uriBuilder.build());
+  }
+
+  @Test
+  public void expandWithOptions() throws URISyntaxException {
+    final URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").appendKeySegment(5).
+        expandWithOptions("ProductDetails", new LinkedHashMap<QueryOption, Object>() {
+          private static final long serialVersionUID = 3109256773218160485L;
+
+          {
+            put(QueryOption.EXPAND, "ProductInfo");
+            put(QueryOption.SELECT, "Price");
+          }
+        }).expand("Orders", "Customers").build();
+
+    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products(5)").
+        addParameter("$expand", "ProductDetails($expand=ProductInfo;$select=Price),Orders,Customers").build(), uri);
+  }
+
+  public void expandWithLevels() throws URISyntaxException {
+    final URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").appendKeySegment(1).
+        expandWithOptions("Customer", Collections.<QueryOption, Object> singletonMap(QueryOption.LEVELS, 4)).
+        build();
+
+    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products(1)").
+        addParameter("$expand", "Customer($levels=4)").build(), uri);
+  }
+
+  @Test
+  public void count() throws URISyntaxException {
+    URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count().build();
+
+    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products/$count").build(), uri);
+
+    uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count(true).build();
+
+    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products").
+        addParameter("$count", "true").build(), uri);
+  }
+
+  @Test
+  public void filter() throws URISyntaxException {
+    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("AnEntitySet").
+        filter(getClient().getFilterFactory().lt("VIN", 16));
+
+    assertEquals("http://host/service/AnEntitySet?%24filter=%28VIN%20lt%2016%29", uriBuilder.build().toASCIIString());
+
+//    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/AnEntitySet").
+//        addParameter("$filter", "(VIN lt 16)").build(),
+//        uriBuilder.build());
+  }
+
+  @Test
+  public void filterWithParameter() throws URISyntaxException {
+    // http://host/service.svc/Employees?$filter=Region eq @p1&@p1='WA'
+    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Employees").
+        filter(getClient().getFilterFactory().eq("Region", new ParameterAlias("p1"))).
+        addParameterAlias("p1", "'WA'");
+
+    assertEquals("http://host/service/Employees?%24filter=%28Region%20eq%20%40p1%29&%40p1='WA'", uriBuilder.build()
+        .toASCIIString());
+
+//    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Employees").
+//        addParameter("$filter", "(Region eq @p1)").addParameter("@p1", "'WA'").build(),
+//        uriBuilder.build());
+  }
+
+  @Test
+  public void expandMoreThenOnce() throws URISyntaxException {
+    URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").appendKeySegment(5).
+        expand("Orders", "Customers").expand("Info").build();
+
+    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products(5)").
+        addParameter("$expand", "Orders,Customers,Info").build(), uri);
+  }
+
+  @Test
+  public void selectMoreThenOnce() throws URISyntaxException {
+    URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Customers").appendKeySegment(5).
+        select("Name", "Surname").expand("Info").select("Gender").build();
+
+    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Customers(5)").
+        addParameter("$select", "Name,Surname,Gender").addParameter("$expand", "Info").build(), uri);
+  }
+
+  @Test
+  public void singleton() throws URISyntaxException {
+    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+        appendSingletonSegment("BestProductEverCreated");
+
+    assertEquals(new org.apache.http.client.utils.URIBuilder(
+        SERVICE_ROOT + "/BestProductEverCreated").build(), uriBuilder.build());
+  }
+
+  @Test
+  public void entityId() throws URISyntaxException {
+    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+        appendEntityIdSegment("Products(0)");
+
+    assertEquals(new org.apache.http.client.utils.URIBuilder(
+        SERVICE_ROOT + "/$entity").addParameter("$id", "Products(0)").build(), uriBuilder.build());
+  }
+
+  @Test
+  public void boundAction() throws URISyntaxException {
+    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+        appendEntitySetSegment("Categories").appendKeySegment(1).
+        appendNavigationSegment("Products").appendNavigationSegment("Model").
+        appendActionCallSegment("AllOrders");
+
+    assertEquals(new org.apache.http.client.utils.URIBuilder(
+        SERVICE_ROOT + "/Categories(1)/Products/Model.AllOrders").build(), uriBuilder.build());
+  }
+
+  @Test
+  public void ref() throws URISyntaxException {
+    URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+        appendEntitySetSegment("Categories").appendKeySegment(1).
+        appendNavigationSegment("Products").appendRefSegment();
+
+    assertEquals(new org.apache.http.client.utils.URIBuilder(
+        SERVICE_ROOT + "/Categories(1)/Products/$ref").build(), uriBuilder.build());
+
+    uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+        appendEntitySetSegment("Categories").appendKeySegment(1).
+        appendNavigationSegment("Products").appendRefSegment().id("../../Products(0)");
+
+    assertEquals(new org.apache.http.client.utils.URIBuilder(
+        SERVICE_ROOT + "/Categories(1)/Products/$ref").addParameter("$id", "../../Products(0)").build(),
+        uriBuilder.build());
+  }
+
+  @Test
+  public void derived() throws URISyntaxException {
+    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+        appendEntitySetSegment("Customers").appendDerivedEntityTypeSegment("Model.VipCustomer").appendKeySegment(1);
+
+    assertEquals(new org.apache.http.client.utils.URIBuilder(
+        SERVICE_ROOT + "/Customers/Model.VipCustomer(1)").build(), uriBuilder.build());
+  }
+
+  @Test
+  public void crossjoin() throws URISyntaxException {
+    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+        appendCrossjoinSegment("Products", "Sales");
+
+    assertEquals(new org.apache.http.client.utils.URIBuilder(
+        SERVICE_ROOT + "/$crossjoin(Products,Sales)").build(), uriBuilder.build());
+  }
+
+  @Test
+  public void all() throws URISyntaxException {
+    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).appendAllSegment();
+
+    assertEquals(new org.apache.http.client.utils.URIBuilder(
+        SERVICE_ROOT + "/$all").build(), uriBuilder.build());
+  }
+
+  @Test
+  public void search() throws URISyntaxException {
+    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
+        appendEntitySetSegment("Products").search("blue OR green");
+
+    assertEquals(new URI("http://host/service/Products?%24search=blue%20OR%20green"), uriBuilder.build());
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/752bfad3/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java
deleted file mode 100644
index eff892e..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java
+++ /dev/null
@@ -1,101 +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.client.core.uri.v4;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.Calendar;
-import java.util.TimeZone;
-
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.uri.FilterArgFactory;
-import org.apache.olingo.client.api.uri.FilterFactory;
-import org.apache.olingo.client.api.uri.URIFilter;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.CsdlEnumType;
-import org.apache.olingo.commons.core.edm.EdmEnumTypeImpl;
-import org.junit.Test;
-
-public class FilterFactoryTest extends AbstractTest {
-
-  @Override
-  protected ODataClient getClient() {
-    return v4Client;
-  }
-
-  private FilterFactory getFilterFactory() {
-    return getClient().getFilterFactory();
-  }
-
-  private FilterArgFactory getFilterArgFactory() {
-    return getFilterFactory().getArgFactory();
-  }
-
-  @Test
-  public void has() {
-    final EdmEnumType pattern =
-        new EdmEnumTypeImpl(null, new FullQualifiedName("Sales", "Pattern"), new CsdlEnumType());
-    final URIFilter filter = getFilterFactory().has(getFilterArgFactory().property("style"), pattern, "Yellow");
-
-    assertEquals("(style has Sales.Pattern'Yellow')", filter.build());
-  }
-
-  @Test
-  public void contains() {
-    final URIFilter filter = getFilterFactory().match(getFilterArgFactory().contains(
-        getFilterArgFactory().property("CompanyName"), getFilterArgFactory().literal("Alfreds")));
-
-    assertEquals("contains(CompanyName,'Alfreds')", filter.build());
-  }
-
-  @Test
-  public void maxdatetime() {
-    final URIFilter filter = getFilterFactory().eq(
-        getFilterArgFactory().property("EndTime"),
-        getFilterArgFactory().maxdatetime());
-
-    assertEquals("(EndTime eq maxdatetime())", filter.build());
-  }
-
-  @Test
-  public void any() {
-    final URIFilter filter = getFilterFactory().match(
-        getFilterArgFactory().any(getFilterArgFactory().property("Items"),
-            getFilterFactory().gt("d:d/Quantity", 100)));
-
-    assertEquals("Items/any(d:d/Quantity gt 100)", filter.build());
-  }
-
-  @Test
-  public void issueOLINGO357() throws UnsupportedEncodingException {
-    final Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT-8"));
-    calendar.clear();
-    calendar.set(2011, 2, 8, 14, 21, 12);
-
-    final URIFilter filter = getFilterFactory().ge("OrderDate", calendar);
-    assertEquals("(OrderDate ge " + URLEncoder.encode("2011-03-08T14:21:12-08:00", Constants.UTF8) + ")",
-        filter.build());
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/752bfad3/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java
deleted file mode 100644
index f308921..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java
+++ /dev/null
@@ -1,244 +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.client.core.uri.v4;
-
-import static org.junit.Assert.assertEquals;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.uri.QueryOption;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.core.uri.ParameterAlias;
-import org.junit.Test;
-
-public class URIBuilderTest extends AbstractTest {
-
-  private static final String SERVICE_ROOT = "http://host/service";
-
-  @Override
-  protected ODataClient getClient() {
-    return v4Client;
-  }
-
-  @Test
-  public void metadata() throws URISyntaxException {
-    final URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendMetadataSegment().build();
-
-    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/$metadata").build(), uri);
-  }
-
-  @Test
-  public void entity() throws URISyntaxException {
-    final URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("AnEntitySet").
-        appendKeySegment(11).build();
-
-    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/AnEntitySet(11)").build(), uri);
-
-    final Map<String, Object> multiKey = new LinkedHashMap<String, Object>();
-    multiKey.put("OrderId", -10);
-    multiKey.put("ProductId", -10);
-    URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
-        appendEntitySetSegment("OrderLine").appendKeySegment(multiKey).
-        appendPropertySegment("Quantity").appendValueSegment();
-
-    assertEquals(new org.apache.http.client.utils.URIBuilder(
-        SERVICE_ROOT + "/OrderLine(OrderId=-10,ProductId=-10)/Quantity/$value").build(), uriBuilder.build());
-
-    uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
-        appendEntitySetSegment("Customer").appendKeySegment(-10).
-        select("CustomerId", "Name", "Orders").expand("Orders");
-    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Customer(-10)").
-        addParameter("$select", "CustomerId,Name,Orders").addParameter("$expand", "Orders").build(),
-        uriBuilder.build());
-
-    uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
-        appendEntitySetSegment("Customer").appendKeySegment(-10).appendNavigationSegment("Orders").appendRefSegment();
-    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Customer(-10)/Orders/$ref").build(),
-        uriBuilder.build());
-  }
-
-  @Test
-  public void expandWithOptions() throws URISyntaxException {
-    final URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").appendKeySegment(5).
-        expandWithOptions("ProductDetails", new LinkedHashMap<QueryOption, Object>() {
-          private static final long serialVersionUID = 3109256773218160485L;
-
-          {
-            put(QueryOption.EXPAND, "ProductInfo");
-            put(QueryOption.SELECT, "Price");
-          }
-        }).expand("Orders", "Customers").build();
-
-    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products(5)").
-        addParameter("$expand", "ProductDetails($expand=ProductInfo;$select=Price),Orders,Customers").build(), uri);
-  }
-
-  public void expandWithLevels() throws URISyntaxException {
-    final URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").appendKeySegment(1).
-        expandWithOptions("Customer", Collections.<QueryOption, Object> singletonMap(QueryOption.LEVELS, 4)).
-        build();
-
-    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products(1)").
-        addParameter("$expand", "Customer($levels=4)").build(), uri);
-  }
-
-  @Test
-  public void count() throws URISyntaxException {
-    URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count().build();
-
-    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products/$count").build(), uri);
-
-    uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count(true).build();
-
-    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products").
-        addParameter("$count", "true").build(), uri);
-  }
-
-  @Test
-  public void filter() throws URISyntaxException {
-    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("AnEntitySet").
-        filter(getClient().getFilterFactory().lt("VIN", 16));
-
-    assertEquals("http://host/service/AnEntitySet?%24filter=%28VIN%20lt%2016%29", uriBuilder.build().toASCIIString());
-
-//    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/AnEntitySet").
-//        addParameter("$filter", "(VIN lt 16)").build(),
-//        uriBuilder.build());
-  }
-
-  @Test
-  public void filterWithParameter() throws URISyntaxException {
-    // http://host/service.svc/Employees?$filter=Region eq @p1&@p1='WA'
-    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Employees").
-        filter(getClient().getFilterFactory().eq("Region", new ParameterAlias("p1"))).
-        addParameterAlias("p1", "'WA'");
-
-    assertEquals("http://host/service/Employees?%24filter=%28Region%20eq%20%40p1%29&%40p1='WA'", uriBuilder.build()
-        .toASCIIString());
-
-//    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Employees").
-//        addParameter("$filter", "(Region eq @p1)").addParameter("@p1", "'WA'").build(),
-//        uriBuilder.build());
-  }
-
-  @Test
-  public void expandMoreThenOnce() throws URISyntaxException {
-    URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").appendKeySegment(5).
-        expand("Orders", "Customers").expand("Info").build();
-
-    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products(5)").
-        addParameter("$expand", "Orders,Customers,Info").build(), uri);
-  }
-
-  @Test
-  public void selectMoreThenOnce() throws URISyntaxException {
-    URI uri = getClient().newURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Customers").appendKeySegment(5).
-        select("Name", "Surname").expand("Info").select("Gender").build();
-
-    assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Customers(5)").
-        addParameter("$select", "Name,Surname,Gender").addParameter("$expand", "Info").build(), uri);
-  }
-
-  @Test
-  public void singleton() throws URISyntaxException {
-    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
-        appendSingletonSegment("BestProductEverCreated");
-
-    assertEquals(new org.apache.http.client.utils.URIBuilder(
-        SERVICE_ROOT + "/BestProductEverCreated").build(), uriBuilder.build());
-  }
-
-  @Test
-  public void entityId() throws URISyntaxException {
-    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
-        appendEntityIdSegment("Products(0)");
-
-    assertEquals(new org.apache.http.client.utils.URIBuilder(
-        SERVICE_ROOT + "/$entity").addParameter("$id", "Products(0)").build(), uriBuilder.build());
-  }
-
-  @Test
-  public void boundAction() throws URISyntaxException {
-    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
-        appendEntitySetSegment("Categories").appendKeySegment(1).
-        appendNavigationSegment("Products").appendNavigationSegment("Model").
-        appendActionCallSegment("AllOrders");
-
-    assertEquals(new org.apache.http.client.utils.URIBuilder(
-        SERVICE_ROOT + "/Categories(1)/Products/Model.AllOrders").build(), uriBuilder.build());
-  }
-
-  @Test
-  public void ref() throws URISyntaxException {
-    URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
-        appendEntitySetSegment("Categories").appendKeySegment(1).
-        appendNavigationSegment("Products").appendRefSegment();
-
-    assertEquals(new org.apache.http.client.utils.URIBuilder(
-        SERVICE_ROOT + "/Categories(1)/Products/$ref").build(), uriBuilder.build());
-
-    uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
-        appendEntitySetSegment("Categories").appendKeySegment(1).
-        appendNavigationSegment("Products").appendRefSegment().id("../../Products(0)");
-
-    assertEquals(new org.apache.http.client.utils.URIBuilder(
-        SERVICE_ROOT + "/Categories(1)/Products/$ref").addParameter("$id", "../../Products(0)").build(),
-        uriBuilder.build());
-  }
-
-  @Test
-  public void derived() throws URISyntaxException {
-    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
-        appendEntitySetSegment("Customers").appendDerivedEntityTypeSegment("Model.VipCustomer").appendKeySegment(1);
-
-    assertEquals(new org.apache.http.client.utils.URIBuilder(
-        SERVICE_ROOT + "/Customers/Model.VipCustomer(1)").build(), uriBuilder.build());
-  }
-
-  @Test
-  public void crossjoin() throws URISyntaxException {
-    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
-        appendCrossjoinSegment("Products", "Sales");
-
-    assertEquals(new org.apache.http.client.utils.URIBuilder(
-        SERVICE_ROOT + "/$crossjoin(Products,Sales)").build(), uriBuilder.build());
-  }
-
-  @Test
-  public void all() throws URISyntaxException {
-    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).appendAllSegment();
-
-    assertEquals(new org.apache.http.client.utils.URIBuilder(
-        SERVICE_ROOT + "/$all").build(), uriBuilder.build());
-  }
-
-  @Test
-  public void search() throws URISyntaxException {
-    final URIBuilder uriBuilder = getClient().newURIBuilder(SERVICE_ROOT).
-        appendEntitySetSegment("Products").search("blue OR green");
-
-    assertEquals(new URI("http://host/service/Products?%24search=blue%20OR%20green"), uriBuilder.build());
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/752bfad3/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java
deleted file mode 100644
index 4618d3b..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java
+++ /dev/null
@@ -1,82 +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.client.core.v4;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayInputStream;
-import java.io.StringWriter;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.core.AtomLinksQualifier;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.custommonkey.xmlunit.Diff;
-
-public class AtomTest extends JSONTest {
-
-  @Override
-  protected ODataClient getClient() {
-    return v4Client;
-  }
-
-  @Override
-  protected ContentType getODataPubFormat() {
-    return ContentType.APPLICATION_ATOM_XML;
-  }
-
-  @Override
-  protected ContentType getODataFormat() {
-    return ContentType.APPLICATION_XML;
-  }
-
-  private String cleanup(final String input) throws Exception {
-    final TransformerFactory factory = TransformerFactory.newInstance();
-    final Source xslt = new StreamSource(getClass().getResourceAsStream("atom_cleanup.xsl"));
-    final Transformer transformer = factory.newTransformer(xslt);
-
-    final StringWriter result = new StringWriter();
-    transformer.transform(new StreamSource(new ByteArrayInputStream(input.getBytes())), new StreamResult(result));
-    return result.toString();
-  }
-
-  @Override
-  protected void assertSimilar(final String filename, final String actual) throws Exception {
-    final Diff diff = new Diff(cleanup(IOUtils.toString(getClass().getResourceAsStream(filename))), actual);
-    diff.overrideElementQualifier(new AtomLinksQualifier());
-    assertTrue(diff.similar());
-  }
-
-  @Override
-  public void additionalEntities() throws Exception {
-    // no test
-  }
-
-  @Override
-  public void issueOLINGO390() throws Exception {
-    // no test
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/752bfad3/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
deleted file mode 100644
index 50af30f..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
+++ /dev/null
@@ -1,97 +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.client.core.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientEntitySet;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.commons.api.data.EntityCollection;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.client.api.serialization.ODataDeserializerException;
-import org.junit.Test;
-
-public class EntitySetTest extends AbstractTest {
-
-  @Override
-  protected ODataClient getClient() {
-    return v4Client;
-  }
-
-  private void read(final ContentType contentType) throws IOException, ODataDeserializerException {
-    final InputStream input = getClass().getResourceAsStream("Customers." + getSuffix(contentType));
-    final ClientEntitySet entitySet = getClient().getBinder().getODataEntitySet(
-        getClient().getDeserializer(contentType).toEntitySet(input));
-    assertNotNull(entitySet);
-
-    assertEquals(2, entitySet.getEntities().size());
-    assertNull(entitySet.getNext());
-
-    final ClientEntitySet written =
-        getClient().getBinder().getODataEntitySet(new ResWrap<EntityCollection>((URI) null, null,
-            getClient().getBinder().getEntitySet(entitySet)));
-    assertEquals(entitySet, written);
-  }
-
-  @Test
-  public void fromAtom() throws Exception {
-    read(ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  public void fromJSON() throws Exception {
-    read(ContentType.JSON);
-  }
-
-  private void ref(final ContentType contentType) throws ODataDeserializerException {
-    final InputStream input = getClass().getResourceAsStream("collectionOfEntityReferences." + getSuffix(contentType));
-    final ClientEntitySet entitySet = getClient().getBinder().getODataEntitySet(
-        getClient().getDeserializer(contentType).toEntitySet(input));
-    assertNotNull(entitySet);
-
-    for (ClientEntity entity : entitySet.getEntities()) {
-      assertNotNull(entity.getId());
-    }
-    entitySet.setCount(entitySet.getEntities().size());
-
-    final ClientEntitySet written =
-        getClient().getBinder().getODataEntitySet(new ResWrap<EntityCollection>((URI) null, null,
-            getClient().getBinder().getEntitySet(entitySet)));
-    assertEquals(entitySet, written);
-  }
-
-  @Test
-  public void atomRef() throws Exception {
-    ref(ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  public void jsonRef() throws Exception {
-    ref(ContentType.JSON);
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/752bfad3/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
deleted file mode 100644
index 6b69135..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
+++ /dev/null
@@ -1,391 +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.client.core.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.util.Iterator;
-
-import org.apache.olingo.client.api.EdmEnabledODataClient;
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.domain.ClientAnnotation;
-import org.apache.olingo.client.api.domain.ClientComplexValue;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientInlineEntitySet;
-import org.apache.olingo.client.api.domain.ClientLink;
-import org.apache.olingo.client.api.domain.ClientLinkType;
-import org.apache.olingo.client.api.domain.ClientProperty;
-import org.apache.olingo.client.api.domain.ClientValuable;
-import org.apache.olingo.client.api.domain.ClientValue;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.core.EdmEnabledODataClientImpl;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDuration;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class EntityTest extends AbstractTest {
-
-  @Override
-  protected ODataClient getClient() {
-    return v4Client;
-  }
-
-  private EdmEnabledODataClient getEdmEnabledClient() {
-    return new EdmEnabledODataClientImpl(null, null, 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 ContentType contentType) throws Exception {
-    final InputStream input = getClass().getResourceAsStream("VipCustomer." + getSuffix(contentType));
-    final ClientEntity entity = getClient().getBinder().getODataEntity(
-        getClient().getDeserializer(contentType).toEntity(input));
-    assertNotNull(entity);
-
-    assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
-
-    final ClientProperty birthday = entity.getProperty("Birthday");
-    assertTrue(birthday.hasPrimitiveValue());
-    assertEquals(EdmDateTimeOffset.getInstance(), birthday.getPrimitiveValue().getType());
-
-    final ClientProperty timeBetweenLastTwoOrders = entity.getProperty("TimeBetweenLastTwoOrders");
-    assertTrue(timeBetweenLastTwoOrders.hasPrimitiveValue());
-    assertEquals(EdmDuration.getInstance(), timeBetweenLastTwoOrders.getPrimitiveValue().getType());
-
-    int checked = 0;
-    for (ClientLink link : entity.getNavigationLinks()) {
-      if ("Parent".equals(link.getName())) {
-        checked++;
-        assertEquals(ClientLinkType.ENTITY_NAVIGATION, link.getType());
-      }
-      if ("Orders".equals(link.getName())) {
-        checked++;
-        if (contentType.isCompatible(ContentType.APPLICATION_ATOM_SVC)
-            || contentType.isCompatible(ContentType.APPLICATION_ATOM_XML)) {
-          assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, link.getType());
-        }
-      }
-      if ("Company".equals(link.getName())) {
-        checked++;
-        assertEquals(ClientLinkType.ENTITY_NAVIGATION, link.getType());
-      }
-    }
-    assertEquals(3, checked);
-
-    assertEquals(2, entity.getOperations().size());
-    assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
-        entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.ResetAddress").getMetadataAnchor());
-    assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
-        entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress").getMetadataAnchor());
-
-    // operations won't get serialized
-    entity.getOperations().clear();
-    final ClientEntity written = getClient().getBinder().getODataEntity(
-        new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
-    assertEquals(entity, written);
-    input.close();
-  }
-
-  @Test
-  public void atomSingleton() throws Exception {
-    singleton(ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  public void jsonSingleton() throws Exception {
-    singleton(ContentType.JSON_FULL_METADATA);
-  }
-
-  private void withEnums(final ContentType contentType) throws Exception {
-    final InputStream input = getClass().getResourceAsStream("Products_5." + getSuffix(contentType));
-    final ClientEntity entity = getClient().getBinder().getODataEntity(
-        getClient().getDeserializer(contentType).toEntity(input));
-    assertNotNull(entity);
-
-    final ClientProperty skinColor = entity.getProperty("SkinColor");
-    assertTrue(skinColor.hasEnumValue());
-    assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Color", skinColor.getEnumValue().getTypeName());
-    assertEquals("Red", skinColor.getEnumValue().getValue());
-
-    final ClientProperty coverColors = entity.getProperty("CoverColors");
-    assertTrue(coverColors.hasCollectionValue());
-    for (final Iterator<ClientValue> itor = coverColors.getCollectionValue().iterator(); itor.hasNext();) {
-      final ClientValue item = itor.next();
-      assertTrue(item.isEnum());
-    }
-
-    // operations won't get serialized
-    entity.getOperations().clear();
-    final ClientEntity written = getClient().getBinder().getODataEntity(
-        new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
-    assertEquals(entity, written);
-    input.close();
-  }
-
-  @Test
-  public void atomWithEnums() throws Exception {
-    withEnums(ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  public void jsonWithEnums() throws Exception {
-    withEnums(ContentType.JSON_FULL_METADATA);
-  }
-
-  private void withInlineEntitySet(final ContentType contentType) throws Exception {
-    final InputStream input = getClass().getResourceAsStream(
-        "Accounts_101_expand_MyPaymentInstruments." + getSuffix(contentType));
-    final ClientEntity entity = getClient().getBinder().getODataEntity(
-        getClient().getDeserializer(contentType).toEntity(input));
-    assertNotNull(entity);
-
-    final ClientLink instruments = entity.getNavigationLink("MyPaymentInstruments");
-    assertNotNull(instruments);
-    assertEquals(ClientLinkType.ENTITY_SET_NAVIGATION, instruments.getType());
-
-    final ClientInlineEntitySet inline = instruments.asInlineEntitySet();
-    assertNotNull(inline);
-    assertEquals(3, inline.getEntitySet().getEntities().size());
-
-    // count shouldn't be serialized
-    inline.getEntitySet().setCount(3);
-    // operations won't get serialized
-    entity.getOperations().clear();
-    final ClientEntity written = getClient().getBinder().getODataEntity(
-        new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
-    assertEquals(entity, written);
-    input.close();
-  }
-
-  @Test
-  public void atomWithInlineEntitySet() throws Exception {
-    withInlineEntitySet(ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  public void jsonWithInlineEntitySet() throws Exception {
-    withInlineEntitySet(ContentType.JSON_FULL_METADATA);
-  }
-
-  private void mediaEntity(final ContentType contentType) throws Exception {
-    final InputStream input = getClass().getResourceAsStream(
-        "Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7." + getSuffix(contentType));
-    final ClientEntity entity = getClient().getBinder().getODataEntity(
-        getClient().getDeserializer(contentType).toEntity(input));
-    assertNotNull(entity);
-
-    assertTrue(entity.isMediaEntity());
-    assertNotNull(entity.getMediaContentSource());
-    assertEquals("\"8zOOKKvgOtptr4gt8IrnapX3jds=\"", entity.getMediaETag());
-
-    final ClientEntity written = getClient().getBinder().getODataEntity(
-        new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
-    assertEquals(entity, written);
-    input.close();
-  }
-
-  @Test
-  public void atomMediaEntity() throws Exception {
-    mediaEntity(ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  public void jsonMediaEntity() throws Exception {
-    mediaEntity(ContentType.JSON_FULL_METADATA);
-  }
-
-  private void withStream(final ContentType contentType) throws Exception {
-    final InputStream input = getClass().getResourceAsStream("PersonDetails_1." + getSuffix(contentType));
-    final ClientEntity entity = getClient().getBinder().getODataEntity(
-        getClient().getDeserializer(contentType).toEntity(input));
-    assertNotNull(entity);
-
-    assertFalse(entity.isMediaEntity());
-
-    final ClientLink editMedia = entity.getMediaEditLink("Photo");
-    assertNotNull(editMedia);
-
-    final ClientEntity written = getClient().getBinder().getODataEntity(
-        new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
-    assertEquals(entity, written);
-    input.close();
-  }
-
-  @Test
-  public void atomWithStream() throws Exception {
-    withStream(ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  public void jsonWithStream() throws Exception {
-    withStream(ContentType.JSON_FULL_METADATA);
-  }
-
-  private void ref(final ContentType contentType) throws Exception {
-    final InputStream input = getClass().getResourceAsStream("entityReference." + getSuffix(contentType));
-    final ClientEntity entity = getClient().getBinder().getODataEntity(
-        getClient().getDeserializer(contentType).toEntity(input));
-    assertNotNull(entity);
-
-    assertNotNull(entity.getId());
-
-    final ClientEntity written = getClient().getBinder().getODataEntity(
-        new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
-    assertEquals(entity, written);
-    input.close();
-  }
-
-  @Test
-  public void atomRef() throws Exception {
-    ref(ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  public void jsonRef() throws Exception {
-    ref(ContentType.JSON);
-  }
-
-  private void complexNavigationProperties(final ContentType contentType) throws Exception {
-    final InputStream input = getClass().getResourceAsStream("entity.withcomplexnavigation." + getSuffix(contentType));
-    final ClientEntity entity = getClient().getBinder().getODataEntity(
-        getClient().getDeserializer(contentType).toEntity(input));
-    assertNotNull(entity);
-
-    final ClientComplexValue addressValue = entity.getProperty("Address").getComplexValue();
-    assertNotNull(addressValue);
-    assertNotNull(addressValue.getNavigationLink("Country"));
-
-    // ETag is not serialized
-    entity.setETag(null);
-    final ClientEntity written = getClient().getBinder().getODataEntity(
-        new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
-    assertEquals(entity, written);
-    input.close();
-  }
-
-  @Test
-  public void atomComplexNavigationProperties() throws Exception {
-    complexNavigationProperties(ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  public void jsonComplexNavigationProperties() throws Exception {
-    complexNavigationProperties(ContentType.JSON);
-  }
-
-  private void annotated(final ContentType contentType) throws EdmPrimitiveTypeException, Exception {
-    final InputStream input = getClass().getResourceAsStream("annotated." + getSuffix(contentType));
-    final ClientEntity entity = getClient().getBinder().getODataEntity(
-        getClient().getDeserializer(contentType).toEntity(input));
-    assertNotNull(entity);
-
-    assertFalse(entity.getAnnotations().isEmpty());
-
-    ClientAnnotation annotation = entity.getAnnotations().get(0);
-    assertEquals("com.contoso.display.highlight", annotation.getTerm());
-    assertEquals(true, annotation.getPrimitiveValue().toCastValue(Boolean.class));
-
-    annotation = entity.getAnnotations().get(1);
-    assertEquals("com.contoso.PersonalInfo.PhoneNumbers", annotation.getTerm());
-    assertTrue(annotation.hasCollectionValue());
-
-    annotation = entity.getProperty("LastName").getAnnotations().get(0);
-    assertEquals("com.contoso.display.style", annotation.getTerm());
-    assertTrue(annotation.hasComplexValue());
-
-    final ClientLink orders = entity.getNavigationLink("Orders");
-    assertFalse(orders.getAnnotations().isEmpty());
-
-    annotation = orders.getAnnotations().get(0);
-    assertEquals("com.contoso.display.style", annotation.getTerm());
-    assertEquals("com.contoso.display.styleType", annotation.getValue().getTypeName());
-    assertTrue(annotation.hasComplexValue());
-    assertEquals(2,
-        annotation.getValue().asComplex().get("order").getPrimitiveValue().toCastValue(Integer.class), 0);
-
-    final ClientEntity written = getClient().getBinder().getODataEntity(
-        new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity)));
-    assertEquals(entity, written);
-    input.close();
-  }
-
-  @Test
-  @Ignore
-  public void atomAnnotated() throws Exception {
-    annotated(ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  @Ignore
-  public void jsonAnnotated() throws Exception {
-    annotated(ContentType.JSON);
-  }
-
-  private void derived(final ODataClient client, final ContentType contentType) throws Exception {
-    final InputStream input = getClass().getResourceAsStream("Customer." + getSuffix(contentType));
-    final ClientEntity entity = client.getBinder().getODataEntity(client.getDeserializer(contentType).toEntity(input));
-    assertNotNull(entity);
-
-    assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getTypeName().toString());
-    assertEquals("Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress",
-        ((ClientValuable) entity.getProperty("HomeAddress")).getValue().getTypeName());
-    input.close();
-  }
-
-  @Test
-  public void derivedFromAtom() throws Exception {
-    derived(getClient(), ContentType.APPLICATION_ATOM_XML);
-  }
-
-  @Test
-  public void derivedFromJSON() throws Exception {
-    derived(getEdmEnabledClient(), ContentType.JSON);
-  }
-
-  @Test
-  public void derivedFromFullJSON() throws Exception {
-    derived(getClient(), ContentType.JSON_FULL_METADATA);
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/752bfad3/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
deleted file mode 100644
index 917676b..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
+++ /dev/null
@@ -1,62 +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.client.core.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.serialization.ODataDeserializerException;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.commons.api.ex.ODataError;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.junit.Test;
-
-public class ErrorTest extends AbstractTest {
-
-  @Override
-  protected ODataClient getClient() {
-    return v4Client;
-  }
-
-  private ODataError error(final String name, final ContentType contentType) throws ODataDeserializerException {
-    final ODataError error = getClient().getDeserializer(contentType).toError(
-            getClass().getResourceAsStream(name + "." + getSuffix(contentType)));
-    assertNotNull(error);
-    return error;
-  }
-
-  private void simple(final ContentType contentType) throws ODataDeserializerException {
-    final ODataError error = error("error", contentType);
-    assertEquals("501", error.getCode());
-    assertEquals("Unsupported functionality", error.getMessage());
-    assertEquals("query", error.getTarget());
-  }
-
-  @Test
-  public void jsonSimple() throws Exception {
-    simple(ContentType.JSON);
-  }
-
-  @Test
-  public void atomSimple() throws Exception {
-    simple(ContentType.APPLICATION_ATOM_XML);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/752bfad3/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
deleted file mode 100644
index 3577455..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
+++ /dev/null
@@ -1,258 +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.client.core.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayInputStream;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.domain.ClientCollectionValue;
-import org.apache.olingo.client.api.domain.ClientComplexValue;
-import org.apache.olingo.client.api.domain.ClientEntity;
-import org.apache.olingo.client.api.domain.ClientValue;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Delta;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.junit.Test;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class JSONTest extends AbstractTest {
-
-  private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
-
-  @Override
-  protected ODataClient getClient() {
-    return v4Client;
-  }
-
-  protected ContentType getODataPubFormat() {
-    return ContentType.JSON;
-  }
-
-  protected ContentType getODataFormat() {
-    return ContentType.JSON;
-  }
-
-  private void cleanup(final ObjectNode node) {
-    if (node.has(Constants.JSON_CONTEXT)) {
-      node.remove(Constants.JSON_CONTEXT);
-    }
-    if (node.has(Constants.JSON_ETAG)) {
-      node.remove(Constants.JSON_ETAG);
-    }
-    if (node.has(Constants.JSON_TYPE)) {
-      node.remove(Constants.JSON_TYPE);
-    }
-    if (node.has(Constants.JSON_EDIT_LINK)) {
-      node.remove(Constants.JSON_EDIT_LINK);
-    }
-    if (node.has(Constants.JSON_READ_LINK)) {
-      node.remove(Constants.JSON_READ_LINK);
-    }
-    if (node.has(Constants.JSON_MEDIA_EDIT_LINK)) {
-      node.remove(Constants.JSON_MEDIA_EDIT_LINK);
-    }
-    if (node.has(Constants.JSON_MEDIA_READ_LINK)) {
-      node.remove(Constants.JSON_MEDIA_READ_LINK);
-    }
-    if (node.has(Constants.JSON_MEDIA_CONTENT_TYPE)) {
-      node.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
-    }
-    if (node.has(Constants.JSON_COUNT)) {
-      node.remove(Constants.JSON_COUNT);
-    }
-    final List<String> toRemove = new ArrayList<String>();
-    for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
-      final Map.Entry<String, JsonNode> field = itor.next();
-
-      final String key = field.getKey();
-      if (key.charAt(0) == '#'
-          || key.endsWith(Constants.JSON_TYPE)
-          || key.endsWith(Constants.JSON_MEDIA_EDIT_LINK)
-          || key.endsWith(Constants.JSON_MEDIA_CONTENT_TYPE)
-          || key.endsWith(Constants.JSON_ASSOCIATION_LINK)
-          || key.endsWith(Constants.JSON_MEDIA_ETAG)) {
-
-        toRemove.add(key);
-      } else if (field.getValue().isObject()) {
-        cleanup((ObjectNode) field.getValue());
-      } else if (field.getValue().isArray()) {
-        for (final Iterator<JsonNode> arrayItems = field.getValue().elements(); arrayItems.hasNext();) {
-          final JsonNode arrayItem = arrayItems.next();
-          if (arrayItem.isObject()) {
-            cleanup((ObjectNode) arrayItem);
-          }
-        }
-      }
-    }
-    node.remove(toRemove);
-  }
-
-  protected void assertSimilar(final String filename, final String actual) throws Exception {
-    final JsonNode expected = OBJECT_MAPPER.readTree(IOUtils.toString(getClass().getResourceAsStream(filename)).
-        replace(Constants.JSON_NAVIGATION_LINK, Constants.JSON_BIND_LINK_SUFFIX));
-    cleanup((ObjectNode) expected);
-    final ObjectNode actualNode = (ObjectNode) OBJECT_MAPPER.readTree(new ByteArrayInputStream(actual.getBytes()));
-    cleanup(actualNode);
-    assertEquals(expected, actualNode);
-  }
-
-  protected void entitySet(final String filename, final ContentType contentType) throws Exception {
-    final StringWriter writer = new StringWriter();
-    getClient().getSerializer(contentType).write(writer, getClient().getDeserializer(contentType).toEntitySet(
-        getClass().getResourceAsStream(filename + "." + getSuffix(contentType))).getPayload());
-
-    assertSimilar(filename + "." + getSuffix(contentType), writer.toString());
-  }
-
-  @Test
-  public void entitySets() throws Exception {
-    entitySet("Customers", getODataPubFormat());
-    entitySet("collectionOfEntityReferences", getODataPubFormat());
-  }
-
-  protected void entity(final String filename, final ContentType contentType) throws Exception {
-    final StringWriter writer = new StringWriter();
-    getClient().getSerializer(contentType).write(writer, getClient().getDeserializer(contentType).toEntity(
-        getClass().getResourceAsStream(filename + "." + getSuffix(contentType))).getPayload());
-    System.out.println(writer.toString());
-    assertSimilar(filename + "." + getSuffix(contentType), writer.toString());
-  }
-
-  @Test
-  public void additionalEntities() throws Exception {
-    entity("entity.minimal", getODataPubFormat());
-    entity("entity.primitive", getODataPubFormat());
-    entity("entity.complex", getODataPubFormat());
-    entity("entity.collection.primitive", getODataPubFormat());
-    entity("entity.collection.complex", getODataPubFormat());
-  }
-
-  @Test
-  public void entities() throws Exception {
-    entity("Products_5", getODataPubFormat());
-    entity("VipCustomer", getODataPubFormat());
-    entity("Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7", getODataPubFormat());
-    entity("entityReference", getODataPubFormat());
-    entity("entity.withcomplexnavigation", getODataPubFormat());
-    entity("annotated", getODataPubFormat());
-  }
-
-  protected void property(final String filename, final ContentType contentType) throws Exception {
-    final StringWriter writer = new StringWriter();
-    getClient().getSerializer(contentType).write(writer, getClient().getDeserializer(contentType).
-        toProperty(getClass().getResourceAsStream(filename + "." + getSuffix(contentType))).getPayload());
-
-    assertSimilar(filename + "." + getSuffix(contentType), writer.toString());
-  }
-
-  @Test
-  public void properties() throws Exception {
-    property("Products_5_SkinColor", getODataFormat());
-    property("Products_5_CoverColors", getODataFormat());
-    property("Employees_3_HomeAddress", getODataFormat());
-    property("Employees_3_HomeAddress", getODataFormat());
-  }
-
-  @Test
-  public void crossjoin() throws Exception {
-    assertNotNull(getClient().getDeserializer(ContentType.JSON_FULL_METADATA).toEntitySet(
-        getClass().getResourceAsStream("crossjoin.json")));
-  }
-
-  protected void delta(final String filename, final ContentType contentType) throws Exception {
-    final Delta delta = getClient().getDeserializer(contentType).toDelta(
-        getClass().getResourceAsStream(filename + "." + getSuffix(contentType))).getPayload();
-    assertNotNull(delta);
-    assertNotNull(delta.getDeltaLink());
-    assertEquals(5, delta.getCount(), 0);
-
-    assertEquals(1, delta.getDeletedEntities().size());
-    assertTrue(delta.getDeletedEntities().get(0).getId().toASCIIString().endsWith("Customers('ANTON')"));
-
-    assertEquals(1, delta.getAddedLinks().size());
-    assertTrue(delta.getAddedLinks().get(0).getSource().toASCIIString().endsWith("Customers('BOTTM')"));
-    assertEquals("Orders", delta.getAddedLinks().get(0).getRelationship());
-
-    assertEquals(1, delta.getDeletedLinks().size());
-    assertTrue(delta.getDeletedLinks().get(0).getSource().toASCIIString().endsWith("Customers('ALFKI')"));
-    assertEquals("Orders", delta.getDeletedLinks().get(0).getRelationship());
-
-    assertEquals(2, delta.getEntities().size());
-    Property property = delta.getEntities().get(0).getProperty("ContactName");
-    assertNotNull(property);
-    assertTrue(property.isPrimitive());
-    property = delta.getEntities().get(1).getProperty("ShippingAddress");
-    assertNotNull(property);
-    assertTrue(property.isComplex());
-  }
-
-  @Test
-  public void deltas() throws Exception {
-    delta("delta", getODataPubFormat());
-  }
-
-  @Test
-  public void issueOLINGO390() throws Exception {
-    final ClientEntity message = getClient().getObjectFactory().
-        newEntity(new FullQualifiedName("Microsoft.Exchange.Services.OData.Model.Message"));
-
-    final ClientComplexValue toRecipient = getClient().getObjectFactory().
-        newComplexValue("Microsoft.Exchange.Services.OData.Model.Recipient");
-    toRecipient.add(getClient().getObjectFactory().newPrimitiveProperty("Name",
-        getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("challen_olingo_client")));
-    toRecipient.add(getClient().getObjectFactory().newPrimitiveProperty("Address",
-        getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("challenh@microsoft.com")));
-    final ClientCollectionValue<ClientValue> toRecipients = getClient().getObjectFactory().
-        newCollectionValue("Microsoft.Exchange.Services.OData.Model.Recipient");
-    toRecipients.add(toRecipient);
-    message.getProperties().add(getClient().getObjectFactory().newCollectionProperty("ToRecipients", toRecipients));
-
-    final ClientComplexValue body =
-        getClient().getObjectFactory().newComplexValue("Microsoft.Exchange.Services.OData.Model.ItemBody");
-    body.add(getClient().getObjectFactory().newPrimitiveProperty("Content",
-        getClient().getObjectFactory().newPrimitiveValueBuilder().
-            buildString("this is a simple email body content")));
-    body.add(getClient().getObjectFactory().newEnumProperty("ContentType",
-        getClient().getObjectFactory().newEnumValue("Microsoft.Exchange.Services.OData.Model.BodyType", "text")));
-    message.getProperties().add(getClient().getObjectFactory().newComplexProperty("Body", body));
-
-    final String actual = IOUtils.toString(getClient().getWriter().writeEntity(message, ContentType.JSON));
-    final JsonNode expected =
-        OBJECT_MAPPER.readTree(IOUtils.toString(getClass().getResourceAsStream("olingo390.json")).
-            replace(Constants.JSON_NAVIGATION_LINK, Constants.JSON_BIND_LINK_SUFFIX));
-    final ObjectNode actualNode = (ObjectNode) OBJECT_MAPPER.readTree(new ByteArrayInputStream(actual.getBytes()));
-    assertEquals(expected, actualNode);
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/752bfad3/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
deleted file mode 100644
index 1f603ad..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
+++ /dev/null
@@ -1,413 +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.client.core.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.InputStream;
-import java.util.List;
-
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmAnnotations;
-import org.apache.olingo.commons.api.edm.EdmAnnotationsTarget;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmSchema;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.annotation.EdmUrlRef;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
-import org.apache.olingo.commons.api.edm.provider.CsdlAnnotations;
-import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
-import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
-import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
-import org.apache.olingo.commons.api.edm.provider.CsdlFunction;
-import org.apache.olingo.commons.api.edm.provider.CsdlFunctionImport;
-import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
-import org.apache.olingo.commons.api.edm.provider.CsdlSingleton;
-import org.apache.olingo.commons.api.edm.provider.CsdlTerm;
-import org.apache.olingo.commons.api.edm.provider.annotation.Apply;
-import org.apache.olingo.commons.api.edm.provider.annotation.Collection;
-import org.apache.olingo.commons.api.edm.provider.annotation.ConstantAnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.Path;
-import org.apache.olingo.commons.api.edm.provider.annotation.TwoParamsOpDynamicAnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.UrlRef;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDecimal;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmInt32;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.junit.Test;
-
-public class MetadataTest extends AbstractTest {
-
-  @Override
-  protected ODataClient getClient() {
-    return v4Client;
-  }
-
-  @Test
-  public void parse() {
-    final Edm edm = getClient().getReader().readMetadata(getClass().getResourceAsStream("metadata.xml"));
-    assertNotNull(edm);
-
-    // 1. Enum
-    final EdmEnumType responseEnumType = edm.getEnumType(
-        new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "ResponseType"));
-    assertNotNull(responseEnumType);
-    assertEquals(6, responseEnumType.getMemberNames().size());
-    assertEquals("3", responseEnumType.getMember("Accepted").getValue());
-    assertEquals(EdmTypeKind.ENUM, responseEnumType.getKind());
-
-    // 2. Complex
-    final EdmComplexType responseStatus = edm.getComplexType(
-        new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "ResponseStatus"));
-    assertNotNull(responseStatus);
-    assertTrue(responseStatus.getNavigationPropertyNames().isEmpty());
-    assertEquals("Recipient", responseStatus.getBaseType().getName());
-    assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.DateTimeOffset),
-        responseStatus.getProperty("Time").getType());
-
-    // 3. Entity
-    final EdmEntityType user = edm.getEntityType(
-        new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "User"));
-    assertNotNull(user);
-    assertFalse(user.getPropertyNames().isEmpty());
-    assertFalse(user.getNavigationPropertyNames().isEmpty());
-
-    final EdmEntityType entity = edm.getEntityType(
-        new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Entity"));
-    assertEquals(entity, user.getBaseType());
-    assertFalse(entity.getPropertyNames().isEmpty());
-    assertTrue(entity.getNavigationPropertyNames().isEmpty());
-
-    final EdmEntityType folder = edm.getEntityType(
-        new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Folder"));
-    assertEquals(folder, user.getNavigationProperty("Inbox").getType());
-
-    // 4. Action
-    final EdmAction move = edm.getBoundAction(
-        new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Move"),
-        new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Folder"),
-        false);
-    assertNotNull(move);
-    assertTrue(move.isBound());
-    assertEquals(2, move.getParameterNames().size());
-    assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String),
-        move.getParameter("DestinationId").getType());
-
-    // 5. EntityContainer
-    final EdmEntityContainer container = edm.getEntityContainer(
-        new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "EntityContainer"));
-    assertNotNull(container);
-    final EdmEntitySet users = container.getEntitySet("Users");
-    assertNotNull(users);
-    assertEquals(edm.getEntityType(new FullQualifiedName(container.getNamespace(), "User")),
-        users.getEntityType());
-    assertEquals(container.getEntitySet("Folders"), users.getRelatedBindingTarget("Folders"));
-  }
-
-  @Test
-  public void demo() {
-    final XMLMetadata metadata = getClient().getDeserializer(ContentType.APPLICATION_XML).
-        toMetadata(getClass().getResourceAsStream("demo-metadata.xml"));
-    assertNotNull(metadata);
-
-    assertFalse(metadata.getSchema(0).getAnnotationGroups().isEmpty());
-    final CsdlAnnotations annots = metadata.getSchema(0).getAnnotationGroup("ODataDemo.DemoService/Suppliers");
-    assertNotNull(annots);
-    assertFalse(annots.getAnnotations().isEmpty());
-    assertEquals(ConstantAnnotationExpression.Type.String,
-        annots.getAnnotation("Org.OData.Publication.V1.PrivacyPolicyUrl").getExpression().asConstant().getType());
-    assertEquals("http://www.odata.org/",
-        annots.getAnnotation("Org.OData.Publication.V1.PrivacyPolicyUrl").getExpression().asConstant().getValue());
-
-    // Now let's test some edm:Annotations
-    final Edm edm = getClient().getReader().
-        readMetadata(getClass().getResourceAsStream("demo-metadata.xml"));
-    assertNotNull(edm);
-
-    final EdmSchema schema = edm.getSchema("ODataDemo");
-    assertNotNull(schema);
-    assertTrue(schema.getAnnotations().isEmpty());
-    assertFalse(schema.getAnnotationGroups().isEmpty());
-
-    final EdmAnnotations annotationGroup = schema.getAnnotationGroups().get(2);
-    assertNotNull(annotationGroup);
-    final EdmAnnotationsTarget annotationsTarget = annotationGroup.getTarget();
-    assertNotNull(annotationsTarget);
-    assertTrue(EdmAnnotationsTarget.TargetType.Property == annotationsTarget.getAnnotationsTargetType());
-    assertEquals(new FullQualifiedName("ODataDemo.Product"), annotationsTarget.getAnnotationsTargetFQN());
-    assertEquals("Name", annotationsTarget.getAnnotationsTargetPath());
-
-    final EdmAnnotation annotation = annotationGroup.getAnnotations().get(0);
-    assertNotNull(annotation);
-    assertTrue(annotation.getExpression().isConstant());
-    assertEquals("Edm.String", annotation.getExpression().asConstant().getValue().getType());
-
-    assertEquals(10, schema.getAnnotationGroups().get(3).getAnnotations().size());
-  }
-
-  @Test
-  public void multipleSchemas() {
-    final XMLMetadata metadata = getClient().getDeserializer(ContentType.APPLICATION_XML).
-        toMetadata(getClass().getResourceAsStream("northwind-metadata.xml"));
-    assertNotNull(metadata);
-
-    final CsdlSchema first = metadata.getSchema("NorthwindModel");
-    assertNotNull(first);
-
-    final CsdlSchema second = metadata.getSchema("ODataWebExperimental.Northwind.Model");
-    assertNotNull(second);
-
-    final CsdlEntityContainer entityContainer = second.getEntityContainer();
-    assertNotNull(entityContainer);
-    assertEquals("NorthwindEntities", entityContainer.getName());
-  }
-
-  /**
-   * Tests Example 85 from CSDL specification.
-   */
-  @Test
-  public void fromdoc1() {
-    final XMLMetadata metadata = getClient().getDeserializer(ContentType.APPLICATION_XML).
-        toMetadata(getClass().getResourceAsStream("fromdoc1-metadata.xml"));
-    assertNotNull(metadata);
-
-    assertFalse(metadata.getReferences().isEmpty());
-    assertEquals("Org.OData.Measures.V1", metadata.getReferences().get(1).getIncludes().get(0).getNamespace());
-
-    final CsdlEntityType product = metadata.getSchema(0).getEntityType("Product");
-    assertTrue(product.hasStream());
-    assertEquals("UoM.ISOCurrency", product.getProperty("Price").getAnnotations().get(0).getTerm());
-    assertEquals("Products", product.getNavigationProperty("Supplier").getPartner());
-
-    final CsdlEntityType category = metadata.getSchema(0).getEntityType("Category");
-    assertNotNull(category);
-
-    final CsdlComplexType address = metadata.getSchema(0).getComplexType("Address");
-    assertFalse(address.getNavigationProperty("Country").getReferentialConstraints().isEmpty());
-    assertEquals("Name",
-        address.getNavigationProperty("Country").getReferentialConstraints().get(0).getReferencedProperty());
-
-    final CsdlFunction productsByRating = metadata.getSchema(0).getFunctions("ProductsByRating").get(0);
-    assertNotNull(productsByRating.getParameter("Rating"));
-    assertEquals("Edm.Int32", productsByRating.getParameter("Rating").getType());
-    assertEquals("ODataDemo.Product", productsByRating.getReturnType().getType());
-    assertTrue(productsByRating.getReturnType().isCollection());
-
-    final CsdlSingleton contoso = metadata.getSchema(0).getEntityContainer().getSingleton("Contoso");
-    assertNotNull(contoso);
-    assertFalse(contoso.getNavigationPropertyBindings().isEmpty());
-    assertEquals("Products", contoso.getNavigationPropertyBindings().get(0).getPath());
-
-    final CsdlFunctionImport functionImport = metadata.getSchema(0).getEntityContainer().
-        getFunctionImport("ProductsByRating");
-    assertNotNull(functionImport);
-    assertEquals(metadata.getSchema(0).getNamespace() + "." + productsByRating.getName(),
-        functionImport.getFunction());
-
-    // Now let's go high-level
-    final Edm edm = getClient().getReader().readMetadata(getClass().getResourceAsStream("fromdoc1-metadata.xml"));
-    assertNotNull(edm);
-
-    List<EdmSchema> schemaList = edm.getSchemas();
-    assertNotNull(schemaList);
-    assertEquals(1, schemaList.size());
-    EdmSchema schema = schemaList.get(0);
-
-    EdmEntityContainer demoService = schema.getEntityContainer();
-    assertNotNull(demoService);
-    for (EdmFunction function : schema.getFunctions()) {
-      final EdmFunctionImport fi = demoService.getFunctionImport(function.getName());
-      assertNotNull(fi);
-      assertEquals(demoService.getEntitySet("Products"), fi.getReturnedEntitySet());
-
-      final EdmFunction edmFunction =
-          edm.getUnboundFunction(
-              new FullQualifiedName(metadata.getSchema(0).getNamespace(), "ProductsByRating"), function
-                  .getParameterNames());
-      assertNotNull(edmFunction);
-      assertEquals(edmFunction.getName(), fi.getUnboundFunction(function.getParameterNames()).getName());
-      assertEquals(edmFunction.getNamespace(), fi.getUnboundFunction(function.getParameterNames()).getNamespace());
-      assertEquals(edmFunction.getParameterNames(), fi.getUnboundFunction(function.getParameterNames())
-          .getParameterNames());
-      assertEquals(edmFunction.getReturnType().getType().getName(),
-          fi.getUnboundFunction(function.getParameterNames()).getReturnType().getType().getName());
-      assertEquals(edmFunction.getReturnType().getType().getNamespace(),
-          fi.getUnboundFunction(function.getParameterNames()).getReturnType().getType().getNamespace());
-    }
-
-    final EdmTypeDefinition weight = edm.getTypeDefinition(new FullQualifiedName("ODataDemo", "Weight"));
-    assertNotNull(weight);
-    assertEquals(EdmInt32.getInstance(), weight.getUnderlyingType());
-    assertFalse(weight.getAnnotations().isEmpty());
-    assertEquals("Kilograms", weight.getAnnotations().get(0).getExpression().asConstant().getValueAsString());
-  }
-
-  /**
-   * Tests Example 86 from CSDL specification.
-   */
-  @Test
-  public void fromdoc2() {
-    final XMLMetadata metadata = getClient().getDeserializer(ContentType.APPLICATION_XML)
-        .toMetadata(getClass().getResourceAsStream("fromdoc2-metadata.xml"));
-    assertNotNull(metadata);
-
-    // Check displayName
-    final CsdlAnnotation displayName = metadata.getSchema(0).getAnnotationGroup("ODataDemo.Supplier").
-        getAnnotation("Vocabulary1.DisplayName");
-    assertNotNull(displayName);
-    assertTrue(displayName.getExpression().isDynamic());
-
-    assertTrue(displayName.getExpression().asDynamic().isApply());
-    final Apply apply = displayName.getExpression().asDynamic().asApply();
-    assertEquals(Constants.CANONICAL_FUNCTION_CONCAT, apply.getFunction());
-    assertEquals(3, apply.getParameters().size());
-
-    Path path = (Path) apply.getParameters().get(0);
-    assertEquals("Name", path.getValue());
-
-    ConstantAnnotationExpression expression =
-        (ConstantAnnotationExpression) apply.getParameters().get(1);
-    assertEquals(" in ", expression.getValue());
-    assertEquals(ConstantAnnotationExpression.Type.String, expression.getType());
-
-    Path thirdArg = (Path) apply.getParameters().get(2);
-    assertEquals("Address/CountryName", thirdArg.getValue());
-
-    // Check Tags
-    final CsdlAnnotation tags = metadata.getSchema(0).getAnnotationGroup("ODataDemo.Product").
-        getAnnotation("Vocabulary1.Tags");
-    assertNotNull(tags);
-    assertTrue(tags.getExpression().isDynamic());
-
-    assertTrue(tags.getExpression().asDynamic().isCollection());
-    final Collection collection = tags.getExpression().asDynamic().asCollection();
-    assertEquals(1, collection.getItems().size());
-    assertEquals(ConstantAnnotationExpression.Type.String, collection.getItems().get(0).asConstant().getType());
-    assertEquals("MasterData", collection.getItems().get(0).asConstant().getValue());
-  }
-
-  /**
-   * Various annotation examples taken from CSDL specification.
-   */
-  @Test
-  public void fromdoc3() {
-    final Edm edm = getClient().getReader().readMetadata(getClass().getResourceAsStream("fromdoc3-metadata.xml"));
-    assertNotNull(edm);
-
-    final EdmAnnotations group = edm.getSchema("Annotations").getAnnotationGroups().get(0);
-    assertNotNull(group);
-
-    final EdmAnnotation time1 = group.getAnnotations().get(0);
-    assertEquals("Edm.TimeOfDay", time1.getExpression().asConstant().getValue().getType());
-
-    final EdmAnnotation time2 = group.getAnnotations().get(1);
-    assertEquals("Edm.TimeOfDay", time2.getExpression().asConstant().getValue().getType());
-  }
-
-  /**
-   * Various annotation examples taken from CSDL specification.
-   */
-  @Test
-  public void fromdoc4() {
-    final XMLMetadata metadata = getClient().getDeserializer(ContentType.APPLICATION_XML).
-        toMetadata(getClass().getResourceAsStream("fromdoc4-metadata.xml"));
-    assertNotNull(metadata);
-
-    final CsdlAnnotations group = metadata.getSchema(0).getAnnotationGroups().get(0);
-    assertNotNull(group);
-
-    CsdlAnnotation annotation = group.getAnnotations().get(0);
-    assertTrue(annotation.getExpression().isDynamic());
-    assertTrue(annotation.getExpression().asDynamic().isCast());
-    assertEquals("Edm.Decimal", annotation.getExpression().asDynamic().asCast().getType());
-
-    annotation = group.getAnnotation("And");
-    assertTrue(annotation.getExpression().isDynamic());
-    assertTrue(annotation.getExpression().asDynamic().isTwoParamsOp());
-    assertEquals(TwoParamsOpDynamicAnnotationExpression.Type.And,
-        annotation.getExpression().asDynamic().asTwoParamsOp().getType());
-    assertTrue(annotation.getExpression().asDynamic().asTwoParamsOp().getLeftExpression().isPath());
-
-    annotation = group.getAnnotation("Vocab.Supplier");
-    assertNotNull(annotation);
-    assertTrue(annotation.getExpression().isDynamic());
-    assertTrue(annotation.getExpression().asDynamic().isUrlRef());
-    final UrlRef urlRef = annotation.getExpression().asDynamic().asUrlRef();
-    assertTrue(urlRef.getValue().isDynamic());
-    assertTrue(urlRef.getValue().asDynamic().isApply());
-
-    // Now let's go high-level
-    final Edm edm = getClient().getReader().readMetadata(getClass().getResourceAsStream("fromdoc4-metadata.xml"));
-    assertNotNull(edm);
-
-    final EdmAnnotations edmGroup = edm.getSchemas().get(0).getAnnotationGroups().get(0);
-    assertNotNull(edmGroup);
-
-    EdmAnnotation edmAnnotation = edmGroup.getAnnotations().get(0);
-    assertTrue(edmAnnotation.getExpression().isDynamic());
-    assertTrue(edmAnnotation.getExpression().asDynamic().isCast());
-    assertEquals(EdmDecimal.getInstance(), edmAnnotation.getExpression().asDynamic().asCast().getType());
-
-    edmAnnotation = edmGroup.getAnnotations().get(1);
-    assertTrue(edmAnnotation.getExpression().isDynamic());
-    assertTrue(edmAnnotation.getExpression().asDynamic().isAnd());
-    assertTrue(edmAnnotation.getExpression().asDynamic().asAnd().getLeftExpression().isPath());
-
-    edmAnnotation = edmGroup.getAnnotations().get(edmGroup.getAnnotations().size() - 2);
-    assertNotNull(edmAnnotation);
-    assertTrue(edmAnnotation.getExpression().isDynamic());
-    assertTrue(edmAnnotation.getExpression().asDynamic().isUrlRef());
-    final EdmUrlRef edmUrlRef = edmAnnotation.getExpression().asDynamic().asUrlRef();
-    assertTrue(edmUrlRef.getValue().isDynamic());
-    assertTrue(edmUrlRef.getValue().asDynamic().isApply());
-  }
-
-  @Test
-  public void metadataWithCapabilities() throws Exception {
-    InputStream input = getClass().getResourceAsStream("Metadata-With-Capabilities.xml");
-    final XMLMetadata metadata = getClient().getDeserializer(ContentType.APPLICATION_XML).
-            toMetadata(input);
-
-    CsdlSchema schema = metadata.getSchema("Capabilities");
-    assertNotNull(schema);
-    assertEquals(23, schema.getTerms().size());
-
-    final CsdlTerm deleteRestrictions = schema.getTerm("DeleteRestrictions");
-    assertNotNull(deleteRestrictions);
-    assertEquals("Capabilities.DeleteRestrictionsType", deleteRestrictions.getType());
-  }
-}