You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/05/19 12:34:12 UTC
[14/45] git commit: [OLINGO-260] V4 function / action import invoke
[OLINGO-260] V4 function / action import invoke
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/ead588e8
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/ead588e8
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/ead588e8
Branch: refs/heads/olingo-266-ref
Commit: ead588e8a511c4409c344a5d63c6fa4e45c18f5d
Parents: 4ad25f2
Author: Francesco Chicchiriccò <--global>
Authored: Wed May 14 10:21:03 2014 +0200
Committer: Stephan Klevenz <st...@sap.com>
Committed: Mon May 19 12:33:26 2014 +0200
----------------------------------------------------------------------
.../commons/AbstractInvocationHandler.java | 4 +-
.../commons/AbstractTypeInvocationHandler.java | 2 +-
.../olingo/ext/proxy/commons/ContainerImpl.java | 2 +-
.../commons/EntityTypeInvocationHandler.java | 2 +-
.../olingo/ext/proxy/utils/CoreUtils.java | 58 +++++++++---
.../olingo/ext/pojogen/AbstractPOJOGenMojo.java | 11 +--
.../java/org/apache/olingo/fit/V4Services.java | 23 ++---
.../olingo/fit/utils/AbstractUtilities.java | 1 -
.../v4/OperationImportInvokeTestITCase.java | 99 ++++++++++++++++++++
.../fit/v4/OperationImportInvokeTestITCase.java | 1 +
fit/src/test/resources/META-INF/enumTypes | 3 +
...che.olingo.ext.proxy.api.AbstractComplexType | 14 ---
.../invoke/AbstractODataInvokeRequest.java | 3 -
.../invoke/v4/ODataInvokeRequestImpl.java | 2 +-
.../client/core/op/impl/v4/ODataBinderImpl.java | 2 +-
.../client/core/v3/PrimitiveValueTest.java | 14 +--
pom.xml | 2 +-
17 files changed, 174 insertions(+), 69 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ead588e8/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java
index 9da6aab..516664d 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractInvocationHandler.java
@@ -193,7 +193,7 @@ abstract class AbstractInvocationHandler<C extends CommonEdmEnabledODataClient<?
final EdmTypeInfo edmType = new EdmTypeInfo.Builder().
setEdm(client.getCachedEdm()).setTypeExpression(annotation.returnType()).build();
-
+
if (edmType.isEntityType()) {
if (edmType.isCollection()) {
final ParameterizedType collType = (ParameterizedType) method.getReturnType().getGenericInterfaces()[0];
@@ -213,7 +213,7 @@ abstract class AbstractInvocationHandler<C extends CommonEdmEnabledODataClient<?
method.getReturnType(),
false);
}
- }else{
+ } else {
return CoreUtils.getValueFromProperty(client, (CommonODataProperty) result, method.getGenericReturnType(), null);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ead588e8/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractTypeInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractTypeInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractTypeInvocationHandler.java
index f10cb03..d9a9d85 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractTypeInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractTypeInvocationHandler.java
@@ -168,7 +168,7 @@ public abstract class AbstractTypeInvocationHandler<C extends CommonEdmEnabledOD
}
protected void attach() {
- if (!entityContext.isAttached(targetHandler)) {
+ if (targetHandler != null && !entityContext.isAttached(targetHandler)) {
entityContext.attach(targetHandler, AttachedEntityStatus.ATTACHED);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ead588e8/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ContainerImpl.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ContainerImpl.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ContainerImpl.java
index 3d30497..49c1c9f 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ContainerImpl.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ContainerImpl.java
@@ -410,7 +410,7 @@ class ContainerImpl implements Container {
final URI targetURI = currentStatus == AttachedEntityStatus.NEW
? URI.create("$" + startingPos) : URIUtils.getURI(
factory.getServiceRoot(),
- CoreUtils.getEditMediaLink(streamedChanges.getKey(), entity).toASCIIString());
+ CoreUtils.getMediaEditLink(streamedChanges.getKey(), entity).toASCIIString());
batchUpdateMediaResource(handler, targetURI, streamedChanges.getValue(), changeset);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ead588e8/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityTypeInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityTypeInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityTypeInvocationHandler.java
index 9f81634..afafeb3 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityTypeInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityTypeInvocationHandler.java
@@ -289,7 +289,7 @@ public class EntityTypeInvocationHandler<C extends CommonEdmEnabledODataClient<?
if (res == null) {
final URI link = URIUtils.getURI(
containerHandler.getFactory().getServiceRoot(),
- CoreUtils.getEditMediaLink(property.name(), getEntity()).toASCIIString());
+ CoreUtils.getMediaEditLink(property.name(), getEntity()).toASCIIString());
final ODataMediaRequest req = client.getRetrieveRequestFactory().getMediaRequest(link);
res = req.execute().getBody();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ead588e8/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java
index 981d285..d1ea8a3 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java
@@ -33,6 +33,8 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.CommonEdmEnabledODataClient;
import org.apache.olingo.client.api.v3.UnsupportedInV3Exception;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
@@ -40,6 +42,8 @@ import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmElement;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmType;
@@ -47,7 +51,9 @@ import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
+import org.apache.olingo.ext.proxy.api.annotations.EnumType;
import org.apache.olingo.ext.proxy.api.annotations.Key;
+import org.apache.olingo.ext.proxy.api.annotations.Namespace;
import org.apache.olingo.ext.proxy.api.annotations.Property;
import org.apache.olingo.ext.proxy.commons.AbstractTypeInvocationHandler;
import org.apache.olingo.ext.proxy.commons.ComplexTypeInvocationHandler;
@@ -202,8 +208,8 @@ public final class CoreUtils {
} else {
oprop = ((org.apache.olingo.commons.api.domain.v4.ODataObjectFactory) client.getObjectFactory()).
newEnumProperty(name,
- ((org.apache.olingo.commons.api.domain.v4.ODataValue) getODataValue(client, type, obj)).
- asEnum());
+ ((org.apache.olingo.commons.api.domain.v4.ODataValue) getODataValue(client, type, obj)).
+ asEnum());
}
} else {
throw new UnsupportedOperationException("Usupported object type " + type.getFullQualifiedName());
@@ -332,7 +338,7 @@ public final class CoreUtils {
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {getter.getReturnType()},
ComplexTypeInvocationHandler.getInstance(
- client, property.getName(), getter.getReturnType(), null));
+ client, property.getName(), getter.getReturnType(), null));
populate(client, complex, Property.class, property.getValue().asComplex().iterator());
setPropertyValue(bean, getter, complex);
@@ -356,7 +362,7 @@ public final class CoreUtils {
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {collItemClass},
ComplexTypeInvocationHandler.getInstance(
- client, property.getName(), collItemClass, null));
+ client, property.getName(), collItemClass, null));
populate(client, collItem, Property.class, value.asComplex().iterator());
collection.add(collItem);
@@ -371,6 +377,29 @@ public final class CoreUtils {
}
}
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ private static Enum<?> buildEnumInstance(final ODataEnumValue value) {
+ try {
+ for (String enumTypeName
+ : StringUtils.split(IOUtils.toString(CoreUtils.class.getResourceAsStream("/META-INF/enumTypes")), '\n')) {
+
+ final Class<Enum> enumClass =
+ (Class<Enum>) Thread.currentThread().getContextClassLoader().loadClass(enumTypeName);
+ if (enumClass != null) {
+ final Namespace namespace = enumClass.getAnnotation(Namespace.class);
+ final EnumType enumType = enumClass.getAnnotation(EnumType.class);
+ if (value.getTypeName().equals(namespace.value() + "." + enumType.name())) {
+ return Enum.valueOf(enumClass, value.getValue());
+ }
+ }
+ }
+ } catch (Exception e) {
+ LOG.error("While trying to load enum for {}", value, e);
+ }
+
+ return null;
+ }
+
@SuppressWarnings("unchecked")
public static Object getValueFromProperty(
final CommonEdmEnabledODataClient<?> client,
@@ -379,8 +408,6 @@ public final class CoreUtils {
final EntityTypeInvocationHandler<?> entityHandler)
throws InstantiationException, IllegalAccessException {
- final Object res;
-
Class<?> internalRef;
if (typeRef == null) {
internalRef = null;
@@ -392,6 +419,8 @@ public final class CoreUtils {
}
}
+ final Object res;
+
if (property == null || property.hasNullValue()) {
res = null;
} else if (property.hasComplexValue()) {
@@ -399,8 +428,7 @@ public final class CoreUtils {
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {internalRef},
ComplexTypeInvocationHandler.getInstance(
- client, property.getValue().asComplex(), internalRef, entityHandler));
-
+ client, property.getValue().asComplex(), internalRef, entityHandler));
} else if (property.hasCollectionValue()) {
final ArrayList<Object> collection = new ArrayList<Object>();
@@ -414,15 +442,17 @@ public final class CoreUtils {
Thread.currentThread().getContextClassLoader(),
new Class<?>[] {internalRef},
ComplexTypeInvocationHandler.getInstance(
- client, value.asComplex(), internalRef, entityHandler));
+ client, value.asComplex(), internalRef, entityHandler));
collection.add(collItem);
}
}
res = collection;
+ } else if (property instanceof ODataProperty && ((ODataProperty) property).hasEnumValue()) {
+ res = buildEnumInstance(((ODataProperty) property).getEnumValue());
} else {
- res = CoreUtils.primitiveValueToObject(property.getPrimitiveValue());
+ res = primitiveValueToObject(property.getPrimitiveValue());
}
return res;
@@ -440,10 +470,10 @@ public final class CoreUtils {
return null;
}
- public static URI getEditMediaLink(final String name, final CommonODataEntity entity) {
- for (ODataLink editMediaLink : entity.getMediaEditLinks()) {
- if (name.equalsIgnoreCase(editMediaLink.getName())) {
- return editMediaLink.getLink();
+ public static URI getMediaEditLink(final String name, final CommonODataEntity entity) {
+ for (ODataLink link : entity.getMediaEditLinks()) {
+ if (name.equalsIgnoreCase(link.getName())) {
+ return link.getLink();
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ead588e8/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
index b2023a7..ce566ee 100644
--- a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
@@ -227,8 +227,7 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo {
namespaces.add(schema.getNamespace().toLowerCase());
}
- final Set<String> complexTypeNames = new HashSet<String>();
- final File services = mkdir("META-INF/services");
+ final StringBuilder enumTypeNames = new StringBuilder();
for (EdmSchema schema : edm.getSchemas()) {
createUtility(edm, schema, basePackage);
@@ -249,6 +248,7 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo {
// write types into types package
for (EdmEnumType enumType : schema.getEnumTypes()) {
final String className = utility.capitalize(enumType.getName());
+ enumTypeNames.append(typesPkg).append('.').append(className).append('\n');
objs.clear();
objs.put("enumType", enumType);
parseObj(typesBaseDir, typesPkg, "enumType", className + ".java", objs);
@@ -256,7 +256,6 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo {
for (EdmComplexType complex : schema.getComplexTypes()) {
final String className = utility.capitalize(complex.getName());
- complexTypeNames.add(typesPkg + "." + className);
objs.clear();
objs.put("complexType", complex);
parseObj(typesBaseDir, typesPkg, "complexType", className + ".java", objs);
@@ -324,10 +323,10 @@ public abstract class AbstractPOJOGenMojo extends AbstractMojo {
}
}
}
-
- parseObj(services, true, null, "services", "org.apache.olingo.ext.proxy.api.AbstractComplexType",
- Collections.singletonMap("services", (Object) complexTypeNames));
}
+
+ final File metaInf = mkdir("META-INF");
+ FileUtils.fileWrite(metaInf.getPath() + File.separator + "enumTypes", enumTypeNames.toString());
} catch (Exception t) {
getLog().error(t);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ead588e8/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 d0bbaad..2d774d5 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4Services.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
@@ -111,7 +111,7 @@ public class V4Services extends AbstractServices {
protected V4Services(final Metadata metadata) throws Exception {
super(ODataServiceVersion.V40, metadata);
}
-
+
@GET
@Path("/$crossjoin({elements:.*})")
public Response crossjoin(
@@ -1239,26 +1239,15 @@ public class V4Services extends AbstractServices {
acceptType = Accept.parse(accept, version);
}
- final Accept contentTypeValue = Accept.parse(contentType, version);
- Property property;
- if (contentTypeValue == Accept.XML) {
- final ResWrap<AtomPropertyImpl> paramContainer = atomDeserializer.read(
- IOUtils.toInputStream(param, Constants.ENCODING), AtomPropertyImpl.class);
- property = paramContainer.getPayload();
- } else {
- final ResWrap<JSONPropertyImpl> paramContainer =
- mapper.readValue(IOUtils.toInputStream(param, Constants.ENCODING),
- new TypeReference<JSONPropertyImpl>() {
- });
- property = paramContainer.getPayload();
- }
+ final Accept contentTypeValue = Accept.parse(contentType, version);
+ final AtomEntityImpl entity = xml.readEntity(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
- assert "Microsoft.Test.OData.Services.ODataWCFService.Address".equals(property.getType());
- assert property.getValue().isComplex();
+ assert "Microsoft.Test.OData.Services.ODataWCFService.Address".equals(entity.getType());
+ assert entity.getProperty("address").getValue().isComplex();
return xml.createResponse(
null,
- IOUtils.toInputStream(param, Constants.ENCODING),
+ xml.writeProperty(acceptType, entity.getProperty("address")),
null,
acceptType);
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ead588e8/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
index 77c24d6..00259321 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
@@ -41,7 +41,6 @@ import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.Response;
import javax.xml.stream.XMLStreamException;
import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.vfs2.FileObject;
import org.apache.olingo.commons.api.data.Entity;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ead588e8/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OperationImportInvokeTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OperationImportInvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OperationImportInvokeTestITCase.java
new file mode 100644
index 0000000..7231ddc
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OperationImportInvokeTestITCase.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.fit.proxy.v4;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.Collection;
+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.Person;
+import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.
+ ProductCollection;
+import org.junit.Test;
+
+public class OperationImportInvokeTestITCase extends AbstractTestITCase {
+
+ @Test
+ public void getDefaultColor() {
+ final Color color = container.operations().getDefaultColor();
+ assertEquals(Color.Red, color);
+ }
+
+ @Test
+ public void getPerson2() {
+ final Person person = container.operations().getPerson2("London");
+ assertEquals(1, person.getPersonID(), 0);
+ }
+
+ @Test
+ public void getPerson() {
+ final Address address = container.getPeople().newPerson().factory().newHomeAddress();
+ address.setStreet("1 Microsoft Way");
+ address.setPostalCode("98052");
+ address.setCity("London");
+
+ final Person person = container.operations().getPerson(address);
+ assertEquals(1, person.getPersonID(), 0);
+ }
+
+ @Test
+ public void getAllProducts() {
+ final ProductCollection products = container.operations().getAllProducts();
+ assertEquals(5, products.size());
+ }
+
+ @Test
+ public void getProductsByAccessLevel() {
+ final Collection<String> products = container.operations().getProductsByAccessLevel(AccessLevel.None);
+ assertEquals(5, products.size());
+ assertTrue(products.contains("Car"));
+ }
+
+ @Test
+ public void discount() {
+ container.operations().discount(22);
+ }
+
+ @Test
+ public void resetBossAddress() {
+ final Address address = container.getPeople().newPerson().factory().newHomeAddress();
+ address.setStreet("Via Le Mani Dal Naso, 123");
+ address.setPostalCode("Tollo");
+ address.setCity("66010");
+
+ final Address actual = container.operations().resetBossAddress(address);
+ assertEquals(address.getStreet(), actual.getStreet());
+ assertEquals(address.getPostalCode(), actual.getPostalCode());
+ assertEquals(address.getCity(), actual.getCity());
+ }
+
+ @Test
+ public void bossEmails() {
+ final Collection<String> result = container.operations().resetBossEmail(Arrays.asList(
+ new String[] {"first@olingo.apache.org", "second@olingo.apache.org"}));
+ assertEquals(2, result.size());
+
+ final Collection<String> result2 = container.operations().getBossEmails(0, 100);
+ assertEquals(result, result2);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ead588e8/fit/src/test/java/org/apache/olingo/fit/v4/OperationImportInvokeTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/OperationImportInvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/OperationImportInvokeTestITCase.java
index fbca0fb..36ad27b 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v4/OperationImportInvokeTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v4/OperationImportInvokeTestITCase.java
@@ -191,6 +191,7 @@ public class OperationImportInvokeTestITCase extends AbstractTestITCase {
resetBossAddressReq.setFormat(format);
final ODataProperty resetBossAddress = resetBossAddressReq.execute().getBody();
assertNotNull(resetBossAddress);
+ assertEquals(address, resetBossAddress.getComplexValue());
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ead588e8/fit/src/test/resources/META-INF/enumTypes
----------------------------------------------------------------------
diff --git a/fit/src/test/resources/META-INF/enumTypes b/fit/src/test/resources/META-INF/enumTypes
new file mode 100644
index 0000000..c1e5365
--- /dev/null
+++ b/fit/src/test/resources/META-INF/enumTypes
@@ -0,0 +1,3 @@
+org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccessLevel
+org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Color
+org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCategory
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ead588e8/fit/src/test/resources/META-INF/services/org.apache.olingo.ext.proxy.api.AbstractComplexType
----------------------------------------------------------------------
diff --git a/fit/src/test/resources/META-INF/services/org.apache.olingo.ext.proxy.api.AbstractComplexType b/fit/src/test/resources/META-INF/services/org.apache.olingo.ext.proxy.api.AbstractComplexType
deleted file mode 100644
index b72e0ee..0000000
--- a/fit/src/test/resources/META-INF/services/org.apache.olingo.ext.proxy.api.AbstractComplexType
+++ /dev/null
@@ -1,14 +0,0 @@
-
-org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ComplexWithAllPrimitiveTypes
-org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ComplexToCategory
-org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ContactDetails
-org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ConcurrencyInfo
-org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.AuditInfo
-org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Dimensions
-org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Phone
-org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Aliases
-
-org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.HomeAddress
-org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address
-org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyAddress
-org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfo
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ead588e8/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java
index 21669b1..5cf9308 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/AbstractODataInvokeRequest.java
@@ -98,9 +98,6 @@ public abstract class AbstractODataInvokeRequest<T extends ODataInvokeResult>
: format.toString(odataClient.getServiceVersion());
}
- /**
- * {@inheritDoc }
- */
@Override
public void setFormat(final ODataPubFormat format) {
final String _format = getActualFormat(format);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ead588e8/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/ODataInvokeRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/ODataInvokeRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/ODataInvokeRequestImpl.java
index a64d991..57d391f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/ODataInvokeRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v4/ODataInvokeRequestImpl.java
@@ -49,7 +49,7 @@ public class ODataInvokeRequestImpl<T extends ODataInvokeResult> extends Abstrac
@Override
protected ODataPubFormat getPOSTParameterFormat() {
- return format;
+ return format == null ? getDefaultFormat() : format;
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ead588e8/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
index 0527951..c245498 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
@@ -313,7 +313,7 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
final ODataLinkedComplexValue lcValue =
((ODataClient) client).getObjectFactory().newLinkedComplexValue(type == null ? null : type.toString());
- for (Property property : valuable.getValue().asComplex().get()) {
+ for (Property property : valuable.getValue().asLinkedComplex().get()) {
lcValue.add(getODataProperty(new ResWrap<Property>(contextURL, metadataETag, property)));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ead588e8/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
index f902a0d..03f30d7 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
@@ -29,12 +29,12 @@ import java.util.Iterator;
import java.util.List;
import java.util.TimeZone;
import java.util.UUID;
-import javax.xml.datatype.Duration;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
@@ -122,12 +122,14 @@ public class PrimitiveValueTest extends AbstractTest {
@Test
public void time() throws EdmPrimitiveTypeException {
final String primitive = "-P9DT51M10.5063807S";
- final ODataValue value =
- getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Time).
- setText(primitive).build();
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Time).setText(primitive).build();
assertEquals(EdmPrimitiveTypeKind.Time, value.asPrimitive().getTypeKind());
- // performed cast to improve the check
- assertEquals("-780670.5063807", value.asPrimitive().toCastValue(BigDecimal.class).toString());
+ assertEquals(-780670.5063807, value.asPrimitive().toCastValue(BigDecimal.class));
+
+ final ODataPrimitiveValue write = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Time).setValue(-780670.5063807).build();
+ assertEquals(primitive, write.toString());
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ead588e8/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ba29b92..23e6460 100644
--- a/pom.xml
+++ b/pom.xml
@@ -430,7 +430,7 @@
</goals>
<configuration>
<excludes>
- <exclude>**/META-INF/services/*</exclude>
+ <exclude>**/META-INF/**</exclude>
<exclude>**/*.txt</exclude>
<exclude>**/*.ini</exclude>
<exclude>**/*.bin</exclude>