From c35bc553c6c0fcb611cbc68a749960930b6e5ff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesco=20Chicchiricc=C3=B2?= <--global> Date: Fri, 16 May 2014 15:11:41 +0200 Subject: [PATCH] [OLINGO-260] deep insert test --- .../apache/olingo/fit/AbstractServices.java | 1 - .../fit/proxy/v4/EntityCreateTestITCase.java | 37 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java index 0bb7c7d6f..8056f288c 100644 --- a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java +++ b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java @@ -259,7 +259,6 @@ public abstract class AbstractServices { } protected Response bodyPartRequest(final MimeBodyPart body, final Map references) throws Exception { - @SuppressWarnings("unchecked") final Enumeration
en = (Enumeration
) body.getAllHeaders(); diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java index 6d6c89917..9ad13646a 100644 --- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java @@ -28,13 +28,19 @@ import java.util.Arrays; import java.util.Calendar; import java.util.Collections; import java.util.TimeZone; +import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel; import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address; +import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color; import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer; import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee; import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order; import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderCollection; import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetail; import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetailKey; +import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product; +import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetail; +import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types. + ProductDetailCollection; import org.junit.Test; /** @@ -230,4 +236,35 @@ public class EntityCreateTestITCase extends AbstractTestITCase { assertNull(container.getOrderDetails().get(key)); } + + @Test + public void deepInsert() { + Product product = container.getProducts().newProduct(); + product.setProductID(12); + product.setName("Latte"); + product.setQuantityPerUnit("100g Bag"); + product.setUnitPrice(3.24f); + product.setQuantityInStock(100); + product.setDiscontinued(false); + product.setUserAccess(AccessLevel.Execute); + product.setSkinColor(Color.Blue); + product.setCoverColors(Arrays.asList(new Color[] {Color.Red, Color.Green})); + + final ProductDetail detail = container.getProductDetails().newProductDetail(); + detail.setProductID(product.getProductID()); + detail.setProductDetailID(12); + detail.setProductName("LatteHQ"); + detail.setDescription("High-Quality Milk"); + + final ProductDetailCollection detailCollection = container.getProductDetails().newProductDetailCollection(); + detailCollection.add(detail); + + product.setDetails(detailCollection); + + container.flush(); + + product = container.getProducts().get(12); + assertEquals("Latte", product.getName()); + assertEquals(12, product.getDetails().iterator().next().getProductDetailID(), 0); + } }